'msg' folder ## add_message_files( ## FILES ## Message1.msg ## Message2.msg ##
) add_message_files( FILES mycustomMSG.msg ) ## Generate services in the 'srv'
folder # add_service_files( # FILES # Service1.srv # Service2.srv # ) ##
Generate actions in the 'action' folder # add_action_files( # FILES #
Action1.action # Action2.action # ) ## Generate added messages and services
with any dependencies listed here ##uncommented generate_messages(
DEPENDENCIES std_msgs ) ################################### ## catkin specific
configuration ## ################################### ## The catkin_package
macro generates cmake config files for your package ## Declare things to be
passed to dependent projects ## INCLUDE_DIRS: uncomment this if you package
contains header files ## LIBRARIES: libraries you create in this project that
dependent projects also need ## CATKIN_DEPENDS: catkin_packages dependent
projects also need ## DEPENDS: system dependencies of this project that
dependent projects also need catkin_package( # INCLUDE_DIRS include #
LIBRARIES custom_msgs # CATKIN_DEPENDS std_msgs message_runtime # DEPENDS
system_lib ) ########### ## Build ## ########### ## Specify additional
locations of header files ## Your package locations should be listed before
other locations # include_directories(include) include_directories(
${catkin_INCLUDE_DIRS} ) ## Declare a cpp library # add_library(custom_msgs #
src/${PROJECT_NAME}/custom_msgs.cpp # ) ## Declare a cpp executable #
add_executable(custom_msgs_node src/custom_msgs_node.cpp) ## Add cmake target
dependencies of the executable/library ## as an example, message headers may
need to be generated before nodes # add_dependencies(custom_msgs_node
custom_msgs_generate_messages_cpp) ## Specify libraries to link a library or
executable target against # target_link_libraries(custom_msgs_node #
${catkin_LIBRARIES} # ) ############# ## Install ## ############# # all
install targets should use catkin DESTINATION variables # See
http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html ## Mark
executable scripts (Python etc.) for installation ## in contrast to setup.py,
you can choose the destination # install(PROGRAMS # scripts/my_python_script #
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} # ) ## Mark executables and/or
libraries for installation # install(TARGETS custom_msgs custom_msgs_node #
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} # LIBRARY DESTINATION
${CATKIN_PACKAGE_LIB_DESTINATION} # RUNTIME DESTINATION
${CATKIN_PACKAGE_BIN_DESTINATION} # ) ## Mark cpp header files for
installation # install(DIRECTORY include/${PROJECT_NAME}/ # DESTINATION
${CATKIN_PACKAGE_INCLUDE_DESTINATION} # FILES_MATCHING PATTERN "*.h" # PATTERN
".svn" EXCLUDE # ) ## Mark other files for installation (e.g. launch and bag
files, etc.) # install(FILES # # myfile1 # # myfile2 # DESTINATION
${CATKIN_PACKAGE_SHARE_DESTINATION} # ) ############# ## Testing ##


[ Browse latest ](//question1970.rssing.com/chan-34075453/index-latest.php) [
View live ](//question1970.rssing.com/chan-34075453/article21-live.html)


###  [ Ghafil Tujhe Gharyal Ye Deta Hai Manadi
](////nazam1.rssing.com/chan-8572938/article97.html#c8572938a97i52404577)


[ ](javascript:; "Like") 0


How can I ensure my custom message packages is made before my arduino packages
attempts to build? I have an arduino package that relies on a custom message
package, relative_nav_msgs. In a standard ROS package I would call $
add_dependencies(node_name relative_nav_msgs_generate_messages_cpp) to ensure
that the messages are being built before I try building my node. I feel like I
need to call something similar before calling the rosserial_generate_ros_lib
command in the CMake file. Without it, make_libraries fails to generate
headers for my relative_nav_msgs packages. I found that I can hack
make_libraries.py by adding a 15 second delay before it tries to generate
ros_lib, this allows time for the relative_nav_msgs to be built. I would
prefer a legit method though. I have included the packages CMake, package.xml,
and the firmware CMake. Thank you for any help! Package CMakeLists.txt:
cmake_minimum_required(VERSION 2.8.3) project(rc_read) find_package(catkin
REQUIRED COMPONENTS rosserial_arduino rosserial_client relative_nav_msgs )
catkin_package() rosserial_generate_ros_lib( PACKAGE rosserial_arduino SCRIPT
make_libraries.py ) rosserial_configure_client( DIRECTORY firmware
TOOLCHAIN_FILE ${ROSSERIAL_ARDUINO_TOOLCHAIN} )
rosserial_add_client_target(firmware rc_read ALL)
rosserial_add_client_target(firmware rc_read-upload) package.xml  rc_read
0.0.0  The rc_read package  paul  TODO  catkin  relative_nav_msgs
rosserial_arduino  rosserial_client  std_msgs  relative_nav_msgs
rosserial_arduino  rosserial_client  std_msgs  and finally my firmware CMake
file: cmake_minimum_required(VERSION 2.8.3)
include_directories(${ROS_LIB_DIR}) # Remove this if using an Arduino without
native USB (eg, other than Leonardo) add_definitions(-DUSB_CON)
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../libraries)
generate_arduino_firmware(rc_read SRCS rc_read.cpp ${ROS_LIB_DIR}/time.cpp
BOARD uno PORT /dev/ttyACM0 )


The ZED node will start to publish image data in the network only if there is
another node that subscribes to the relative topic.


[ _≪_ Previous: Append data to vector3[] array - custom message
](//question1970.rssing.com/chan-34075453/all_p2.html#c34075453a37 "Previous
Article")


June 11, 2014, 1:03 am


[ _≫_ Next: Time Synchronizer (message_filters) with Custom Message type
](//question1970.rssing.com/chan-34075453/all_p2.html#c34075453a31 "Next
Article")


If you properly followed the [ ROS 2 Examples Installation Guide
](https://github.com/stereolabs/zed-ros2-examples#build-the-package) , the
executable of this tutorial has been compiled and you can run the subscriber
node using this command:


Now we must define the callbacks to execute when one of the subscribed topics
is received:


[ Remove ADS ](//www.rssing.com/account.php?r=27)


Viewing all 75 articles


###  The code  #


Start the tick count publisher.


#  [ android custom messages - Subscriber handshake failed - Message types
don't match ](//question1970.rssing.com/chan-34075453/article26-live.html)


[ ](javascript:; "Ouch") 0


    nav_msgs::Odometry odomNew;
    nav_msgs::Odometry odomOld;

    // Initial pose
    const double initialX = 0.0;
    const double initialY = 0.0;
    const double initialTheta = 0.00000000001;
    const double PI = 3.141592;

    // Robot physical constants
    const double TICKS_PER_REVOLUTION = 620; // For reference purposes.
    const double WHEEL_RADIUS = 0.033; // Wheel radius in meters
    const double WHEEL_BASE = 0.17; // Center of left tire to center of right tire
    const double TICKS_PER_METER = 3100; // Original was 2800

    // Distance both wheels have traveled
    double distanceLeft = 0;
    double distanceRight = 0;

    // Flag to see if initial pose has been received
    bool initialPoseRecieved = false;

    using namespace std;

    // Get initial_2d message from either Rviz clicks or a manual pose publisher
    void set_initial_2d(const geometry_msgs::PoseStamped &rvizClick) {

      odomOld.pose.pose.position.x = rvizClick.pose.position.x;
      odomOld.pose.pose.position.y = rvizClick.pose.position.y;
      odomOld.pose.pose.orientation.z = rvizClick.pose.orientation.z;
      initialPoseRecieved = true;
    }

    // Calculate the distance the left wheel has traveled since the last cycle
    void Calc_Left(const std_msgs::Int16& leftCount) {

      static int lastCountL = 0;
      if(leftCount.data != 0 && lastCountL != 0) {

        int leftTicks = (leftCount.data - lastCountL);


[ ](//www.rssing.com/index.php?zw=2123 "Home") [ $ ](javascript:; "MoMoney")


As we will see, an essential best practice for any reference-counted smart
pointer type is to _avoid copying it unless you really mean to add a new
reference_ . This cannot be stressed enough. This directly addresses both of
these costs and pushes their performance impact down into the noise for most
applications, and especially eliminates the second cost because it is an
antipattern to add and remove references in tight loops.

At this point, we will be tempted to solve the problem by passing the
shared_ptr  by reference. But is that really the right thing to do? It
depends.


[ ↂ
](////topics4280.rssing.com/chan-62228694/article43158.html#c62228694a43158i1887057775
"Wondershare PDFelement v7.x.x Patch v3.4 By Deltafox")


November 17, 2015, 2:51 am


[ ↂ
](////murder540.rssing.com/chan-6412619/article1.html#c6412619a1i1155785771
"Murder in Australia: 2010")


In this tutorial, we will learn how to publish wheel odometry information over
ROS. We will assume a two-wheeled [ differential drive robot
](https://en.wikipedia.org/wiki/Differential_wheeled_robot) .


Skip to content

[ Sutter’s Mill ](https://herbsutter.com/)

Herb Sutter on software development


#  [ Error compiling send_goal function of action client - WallFollower
Project ](/t/error-compiling-send-goal-function-of-action-client-wallfollower-
project/23051)


RSSing.com


[ ](javascript:; "Share Article") [
](//www.rssing.com/contact.php?r=o6&u=%2F%2Fquestion1970.rssing.com%2Fchan-34075453%2Farticle38-live.html
"Article Support")


  * [ November 2018 ](https://herbsutter.com/2018/11/) (2)
  * [ September 2018 ](https://herbsutter.com/2018/09/) (3)
  * [ July 2018 ](https://herbsutter.com/2018/07/) (1)
  * [ April 2018 ](https://herbsutter.com/2018/04/) (1)
  * [ November 2017 ](https://herbsutter.com/2017/11/) (2)
  * [ October 2017 ](https://herbsutter.com/2017/10/) (3)
  * [ September 2017 ](https://herbsutter.com/2017/09/) (3)
  * [ July 2017 ](https://herbsutter.com/2017/07/) (2)
  * [ June 2017 ](https://herbsutter.com/2017/06/) (1)
  * [ March 2017 ](https://herbsutter.com/2017/03/) (1)
  * [ February 2017 ](https://herbsutter.com/2017/02/) (2)
  * [ November 2016 ](https://herbsutter.com/2016/11/) (1)
  * [ September 2016 ](https://herbsutter.com/2016/09/) (4)
  * [ June 2016 ](https://herbsutter.com/2016/06/) (2)
  * [ March 2016 ](https://herbsutter.com/2016/03/) (1)
  * [ October 2015 ](https://herbsutter.com/2015/10/) (1)
  * [ September 2015 ](https://herbsutter.com/2015/09/) (1)
  * [ July 2015 ](https://herbsutter.com/2015/07/) (1)
  * [ June 2015 ](https://herbsutter.com/2015/06/) (1)
  * [ May 2015 ](https://herbsutter.com/2015/05/) (1)
  * [ April 2015 ](https://herbsutter.com/2015/04/) (1)
  * [ January 2015 ](https://herbsutter.com/2015/01/) (1)
  * [ December 2014 ](https://herbsutter.com/2014/12/) (1)
  * [ November 2014 ](https://herbsutter.com/2014/11/) (3)
  * [ October 2014 ](https://herbsutter.com/2014/10/) (2)
  * [ September 2014 ](https://herbsutter.com/2014/09/) (2)
  * [ August 2014 ](https://herbsutter.com/2014/08/) (1)
  * [ July 2014 ](https://herbsutter.com/2014/07/) (2)
  * [ May 2014 ](https://herbsutter.com/2014/05/) (3)
  * [ April 2014 ](https://herbsutter.com/2014/04/) (4)
  * [ March 2014 ](https://herbsutter.com/2014/03/) (4)
  * [ February 2014 ](https://herbsutter.com/2014/02/) (2)
  * [ January 2014 ](https://herbsutter.com/2014/01/) (4)
  * [ December 2013 ](https://herbsutter.com/2013/12/) (4)
  * [ November 2013 ](https://herbsutter.com/2013/11/) (4)
  * [ October 2013 ](https://herbsutter.com/2013/10/) (2)
  * [ September 2013 ](https://herbsutter.com/2013/09/) (6)
  * [ August 2013 ](https://herbsutter.com/2013/08/) (5)
  * [ July 2013 ](https://herbsutter.com/2013/07/) (1)
  * [ June 2013 ](https://herbsutter.com/2013/06/) (7)


Good evening, I am working in the Biorobotics Lab at the National University
of Mexico, my workmates and me are working with mobile domestic services
robots made of custom hardware. I am getting interested in ROS as a tool to
speed up robotics research, but our robots have hardware which is not covered
in ROS. So I would like to know if there is any documentation on writing
hardware drivers for ROS.


Regards,
Girish


comment-10987)

@mttpd: I’m using WordPress.com, not a WP.org installation. In return for much
less admin hassle, it’s more restrictive — I can’t install packages, only use
what they give me. I’ll poke around and see if there’s something available
though.

  38. ![](https://0.gravatar.com/avatar/928f5830f12d8977791539452bfc25c92912322476f0725253697ee1c45ce036?s=48&d=identicon&r=G) **[ Herb Sutter ](http://www.herbsutter.com) ** says:

[ 2013-06-05 at 4:38 pm  ](https://herbsutter.com/2013/06/05/gotw-91-solution-
smart-pointer-parameters/


  * **/odom_data_euler** : [ Position and velocity estimate ](http://docs.ros.org/en/melodic/api/nav_msgs/html/msg/Odometry.html) . The orientation.z variable is an [ Euler angle ](https://en.wikipedia.org/wiki/Euler_angles) representing the [ yaw angle ](https://automaticaddison.com/yaw-pitch-and-roll-diagrams-using-2d-coordinate-systems/) . ( [ nav_msgs/Odometry ](http://docs.ros.org/en/api/nav_msgs/html/msg/Odometry.html) )
  * **/odom_data_quat** : Position and velocity estimate. The orientation is in [ quaternion format ](https://automaticaddison.com/how-to-convert-a-quaternion-to-a-rotation-matrix/) . ( [ nav_msgs/Odometry ](http://docs.ros.org/en/api/nav_msgs/html/msg/Odometry.html) )


code
](http://daringfireball.net/projects/markdown/syntax


##  Post navigation


Open a new terminal window.


[ ](javascript:;)


2\. What are the _correctness_ implications of the function declaration in


[ Course Support  ](/c/course-support/ros2-basics-in-5-days-galactic-c/108) [
ROS2 Basics in 5 Days (C++)  ](/c/course-support/ros2-basics-in-5-days-
galactic-c/108)


#  Adding Positional Tracking in ROS 2


Now we need to add the C++ program we just wrote to the CMakeLists.txt file.


comment-11832)

Okay, fine, so leave threads out of it. If you call some other function that
does something to the object that you’re working on, then it’s still a
problem. This same problem exists whether you have a copy of the shared_ptr or
a reference to the shared_ptr. The copy of the shared_ptr only gives you
additional safety against the object being destroyed if there is someone else
that has a non-const reference to the shared_ptr itself. In that case,
however, it still gives you no safety against changes in the object itself.

If you and your caller both have a pointer to the object, but so does someone
else, and you call that someone else to do something, and it, unknown to you,
changes all the data in that object, how has the copy of the shared_ptr helped
you?

Analogies don’t generally work very well, but let me give it a shot with what
you used.

Say that you are holding a single red rose between your teeth, and I’m holding
your hand. The other person who is also holding the same single red rose
between their teeth can bite through the stem and ruin the rose. My holding
the rose between my teeth in addition to holding your hand doesn’t prevent the
other person from biting through the stem. If you want the other person to not
be able to bite through the stem, you better make sure that they don’t have it
between their teeth. It won’t make a bit of difference how I hold the rose.

Since you’re holding the rose between your teeth, and you are frozen until I
go away, then I know that you can’t open your mouth and drop the rose. I can
either simply hold your hand, or I can hold your hand and also hold the rose
between my teeth, and the rose won’t be dropped on the ground no matter what
happens.

  18. ![](https://2.gravatar.com/avatar/22cef4c4339ca700ce58fd79c311243f87ddd220788be7e1aa498621626bbb75?s=48&d=identicon&r=G) **earwicker** says:

[ 2013-07-04 at 2:18 am  ](https://herbsutter.com/2013/06/05/gotw-91-solution-
smart-pointer-parameters/


###  [ Noise Industries FxFactory Pro 3.0.2 [MAC]
](////heroturko111.rssing.com/chan-16832457/article82.html#c16832457a82i1004730930)


comment-10976)

@ Róbert Dávid,

        std::optional<Widget&>

would “own” the reference, not the `Widget` being referenced to. I already use

        boost::optional<Widget&>

in code to express “non-owning observing reference”.

  45. ![](https://graph.facebook.com/100004054812229/picture?type=large) **[ Róbert Dávid ](http://www.facebook.com/profile.php?id=100004054812229) ** says:

[ 2013-06-05 at 1:06 pm  ](https://herbsutter.com/2013/06/05/gotw-91-solution-
smart-pointer-parameters/


###  [ PANASONIC SC AKX50LB - CD Stereo system - Power Amp - Main power SMPS -
Schematic (Circuit Diagram) - C1BA00000497 (Power Amp IC) -[TDA 8950J]
](////electro404.rssing.com/chan-13553321/article484.html#c13553321a484i592237786)


roscore


89). When
you pass by value, you have to copy the argument (usually) on entry to the
function, and then destroy it (always) on function exit. Let’s dig into what
this means.

When you enter the function, the  shared_ptr  is copy-constructed, and this
requires incrementing the strong reference count. (Yes, if the caller passes a
temporary  shared_ptr  , you _move_ -construct and so don’t have to update the
count. But: (a) it’s quite rare to get a temporary  shared_ptr  in normal
code, other than taking one function’s return value and immediately passing
that to a second function; and (b) besides as we’ll see most of the expense is
on the destruction of the parameter anyway.)

When exiting the function, the  shared_ptr  is destroyed, and this requires
decrementing its internal reference count.

What’s so bad about a “shared reference count increment and decrement?” Two
things, one related to the “shared reference count” and one related to the
“increment and decrement.” It’s good to be aware of how this can incur
performance costs for two reasons: one major and common, and one less likely
in well-designed code and so probably more minor.

First, the major reason is the performance cost of the “increment and
decrement”: Because the reference count is an  atomic  shared variable (or
equivalent), incrementing and decrementing it are internally-synchronized
read-modify-write shared memory operations.

Second, the less-likely minor reason is the potentially scalability-bustingly
contentious nature of the “shared reference count”: Both increment and
decrement update the reference count, which means that at the processor and
memory level only one core at a time can be executing such an instruction on
the same reference count because it needs exclusive access to the count’s
cache line. The net result is that this causes some contention on the count’s
cache line, which can affect scalability if it’s a popular cache line being
touched by multiple threads in tight loops—such as if two threads are calling
functions like this one in tight loops and accessing  shared_ptr  s that own
the same object. “So don’t do that, thou heretic caller!” we might righteously
say. Well and good, but the caller doesn’t always know when two  shared_ptr  s
used on two different threads refer to the same object, so let’s not be quick
to pile the wood around his stake just yet.


[ ](javascript:; "Share Article") [
](//www.rssing.com/contact.php?r=o6&u=%2F%2Fquestion1970.rssing.com%2Fchan-34075453%2Farticle35-live.html
"Article Support")


[ _≪_ Previous: Time Synchronizer (message_filters) with Custom Message type
](//question1970.rssing.com/chan-34075453/all_p2.html#c34075453a31 "Previous
Article")


Set the goal destination using the button at the top of RViz.


$ ros2 run zed_tutorial_pos_tracking zed_tutorial_pos_tracking --ros-args -r odom:=/zed/zed_node/odom -r pose:=/zed/zed_node/pose


Compile the code.


[ ![Automatic Addison](https://automaticaddison.com/wp-
content/uploads/2018/11/cropped-logo_sq_240.png)
](https://automaticaddison.com/)


RSSing.com


I like this question I cannot answer by myself:
http://answers.ros.org/question/200876/rqt-custom-imageview-showing-images-
from-different-cameras/ I thought about that serveral times but I am going to
ask a bit more general: We all know as a user you can configure the appearance
of rqt_gui, (which plugin widgets, positions, some state variables of the
widgets etc.) yourself. Now I as a developer your like to have a custom gui
for my user, i. e. I do not want that my user has to configure the appearance
initially but I as developer want to provide the initial arrangement of the
rqt plugins, maybe along with some custom plugin widgets. Is this kind of
predefining the arrangement of the rqt gui possible by providing an XML,
python, whatever script? Ideally I would also be able to set some state
variables, e. g. topic names as asked in the linked question? Could I launch
this predefined arrangement using an executable (script) in my own package
(rather than rosrun rqt_gui rqt_gui)?


[ Search ](javascript:;)


November 19, 2014, 3:03 pm


I would like to communicate (mulitple) custom C++ classes between nodes. On
the ROS wiki I have found how to adapt C++ types to be used with publish and
subcribe:
http://wiki.ros.org/roscpp/Overview/MessagesSerializationAndAdaptingTypes
Using the approach above I can publish only one class for each topic. However,
I would also like to use these C++ classes in the messages used by the
SimpleActionServer/SimpleActionClient and send some additional information (so
not only sending the class itself). Hence, I had to idea to use these classes
inside a message file. I have tried to use a test class in an example message
*item_test.msg* with some class *Item*, adapted as described on the ROS wiki.
Item item This was to test if it is possible to use the adapted C++ classes
with .msg/.srv/.action files. However, I got the following error when
compiling: CMake Error at
/home/mathijs/git/rose2_0/gui/build/gui_item_selector/cmake/gui_item_selector-
genmsg.cmake:3 (message): Could not find messages which
'/home/mathijs/git/rose2_0/gui/src/gui_item_selector/msg/item_test.msg'
depends on. Did you forget to specify generate_messages(DEPENDENCIES ...)?
Cannot locate message [Item]: unknown package [custom_classes] on search path
[{{'geometry_msgs': ['/opt/ros/hydro/share/geometry_msgs/cmake/../msg'],
'gui_item_selector':
['/home/mathijs/git/rose2_0/gui/src/gui_item_selector/msg',
'/home/mathijs/git/rose2_0/gui/devel/share/gui_item_selector/msg'],
'std_msgs': ['/opt/ros/hydro/share/std_msgs/cmake/../msg'], 'actionlib_msgs':
['/opt/ros/hydro/share/actionlib_msgs/cmake/../msg'],}}] Call Stack (most
recent call first): /opt/ros/hydro/share/genmsg/cmake/genmsg-extras.cmake:303
(include) gui_item_selector/CMakeLists.txt:39 (generate_messages) I have
specified generate_messages(DEPENDENCIES custom_classes) in the CMakelist, so
that is not the fault. Is there a way to use the Item class in a
.msg/.srv/.action file?


> **Note** : the old launch command ` $ ros2 launch zed_display_rviz2
> display_<camera model>.launch.py ` is now obsolete and will be removed in a
> future release of the wrapper.


#  [ Custom message
](//question1970.rssing.com/chan-34075453/article21-live.html)


Let me know if this gets your problem fixed. I believe this should get your
issue fixed.


[ ](javascript:; "Like") 0


[ ](javascript:; "Share Article") [
](//www.rssing.com/contact.php?r=o6&u=%2F%2Fquestion1970.rssing.com%2Fchan-34075453%2Farticle40-live.html
"Article Support")


[ ](javascript:; "Share Article") [
](//www.rssing.com/contact.php?r=o6&u=%2F%2Fquestion1970.rssing.com%2Fchan-34075453%2Farticle39-live.html
"Article Support")


[ ![Stay Salty POTS Awareness Stretchy Stacking Bracelets | Set of
Three|...](//i.etsystatic.com/28677176/r/il/b2413c/4350795851/il_570xN.4350795851_fflz.jpg)
](////pomaces4.rssing.com/chan-3795444/article11960.html#c3795444a11960i1086411135)


Channel: ROS Answers: Open Source Q&A Forum - RSS feed


Above you can see both the ` Pose ` (green) and the ` Odometry ` (red) paths.


[ Docs Home  ](https://www.stereolabs.com/docs/)


[ ](//www.rssing.com/index.php?zw=2123 "Home") [ $ ](javascript:; "MoMoney")


comment-11825)

@GregM – re: “data races with your smart pointer” – this is about shared_ptr,
not any old smart pointer. The standard shared_ptr is in fact thread-safe
w.r.t. assignment. This is why it is so slow, which in turn is why Herb is so
keen on discouraging patterns where shared_ptr gets copied a lot.

And in any case, re: the part I’m questioning, why bring threads into it? Herb
(correctly) does not..His “2. What are the correctness implications…” makes no
mention at all of data races or multiple threads, and nor does it need to:
it’s about the relationship between variables declared at different places in
a single call/variable stack, such as is found in a single-threaded C++
program.

Herb: “Even if we passed the shared_ptr by reference, our function would as
good as hold a strong refcount because the caller already has one—he passed us
the shared_ptr in the first place, and won’t release it until we return. (Note
this assumes the pointer is not aliased… in this respect it’s no different
than any other aliased object.)”

That guarantee (including the disclaimer-in-brackets that sadly undermines it)
is all about a single thread.

My point is that it’s about as helpful as:

Me: “If I hold a single red rose between my teeth, you and I can tango into
the Room of Poison Gas without dying! (Assuming of course that there’s no
poison gas in the room at this particular moment – but hey, poison gas is
generally dangerous so why should this little tacked-on caveat be any kind of
surprise?)”

  19. ![](https://1.gravatar.com/avatar/a12c460153c92c0e538e2a4868063eed2cd68457f678eaf9b55531a07ec70c4f?s=48&d=identicon&r=G) **[ Emmanuel Thivierge ](http://gravatar.com/monamimani) ** says:

[ 2013-07-02 at 5:27 pm  ](https://herbsutter.com/2013/06/05/gotw-91-solution-
smart-pointer-parameters/


June 7, 2011, 1:29 pm


April 28, 2015, 4:21 am


[ Previous  Previous post:  How to Create an Initial Pose and Goal Publisher
in ROS  ](https://automaticaddison.com/how-to-create-an-initial-pose-and-goal-
publisher-in-ros/)


#  Add the Wheel Odometry Publisher to a Launch File


Viewing all 75 articles


RSSing.com


[ ](//www.rssing.com/index.php)


I tried to follow the instructions of the course, I don’t understand what
could be the problem. My code related to the constructor and action client
function is posted bellow:


![Murder in Australia:
2010](//2.bp.blogspot.com/-zEjZIawSSso/UMBtH81fykI/AAAAAAAAAMU/PNsllPLf124/s640/hunterian.jpg)


My goal is to meet everyone in the world who loves robotics. **[ Connect with
me on LinkedIn ](https://www.linkedin.com/in/addisonsearscollins/) ** if you
found my information useful to you. Also **[ follow my LinkedIn page
](https://www.linkedin.com/company/automaticaddison) where I post cool
robotics-related content. ** Don't be shy! I’d love to hear from you!


  * [ November 2009 ](https://herbsutter.com/2009/11/) (4)
  * [ October 2009 ](https://herbsutter.com/2009/10/) (6)
  * [ September 2009 ](https://herbsutter.com/2009/09/) (2)
  * [ August 2009 ](https://herbsutter.com/2009/08/) (2)
  * [ July 2009 ](https://herbsutter.com/2009/07/) (2)
  * [ June 2009 ](https://herbsutter.com/2009/06/) (3)
  * [ May 2009 ](https://herbsutter.com/2009/05/) (4)
  * [ April 2009 ](https://herbsutter.com/2009/04/) (2)
  * [ March 2009 ](https://herbsutter.com/2009/03/) (4)
  * [ February 2009 ](https://herbsutter.com/2009/02/) (3)
  * [ January 2009 ](https://herbsutter.com/2009/01/) (5)
  * [ December 2008 ](https://herbsutter.com/2008/12/) (4)
  * [ November 2008 ](https://herbsutter.com/2008/11/) (2)
  * [ October 2008 ](https://herbsutter.com/2008/10/) (3)
  * [ September 2008 ](https://herbsutter.com/2008/09/) (3)
  * [ August 2008 ](https://herbsutter.com/2008/08/) (4)
  * [ July 2008 ](https://herbsutter.com/2008/07/) (6)
  * [ June 2008 ](https://herbsutter.com/2008/06/) (6)
  * [ May 2008 ](https://herbsutter.com/2008/05/) (2)
  * [ April 2008 ](https://herbsutter.com/2008/04/) (6)
  * [ March 2008 ](https://herbsutter.com/2008/03/) (5)
  * [ February 2008 ](https://herbsutter.com/2008/02/) (1)
  * [ January 2008 ](https://herbsutter.com/2008/01/) (7)
  * [ December 2007 ](https://herbsutter.com/2007/12/) (5)
  * [ November 2007 ](https://herbsutter.com/2007/11/) (4)
  * [ October 2007 ](https://herbsutter.com/2007/10/) (1)
  * [ September 2007 ](https://herbsutter.com/2007/09/) (6)
  * [ August 2007 ](https://herbsutter.com/2007/08/) (6)
  * [ July 2007 ](https://herbsutter.com/2007/07/) (6)
  * [ June 2007 ](https://herbsutter.com/2007/06/) (3)
  * [ May 2007 ](https://herbsutter.com/2007/05/) (3)
  * [ April 2007 ](https://herbsutter.com/2007/04/) (2)
  * [ March 2007 ](https://herbsutter.com/2007/03/) (3)
  * [ February 2007 ](https://herbsutter.com/2007/02/) (3)
  * [ January 2007 ](https://herbsutter.com/2007/01/) (6)
  * [ December 2006 ](https://herbsutter.com/2006/12/) (2)

[ Blog at WordPress.com. ](https://wordpress.com/?ref=footer_blog)

  * [ Reblog  ]()


comment-10943)

Are non-owning raw pointers really such a worth-while idea in C++14? What are
they good for anymore in “modern” code? If I want to observe something that
can optionally be null, wouldn’t std::optional be a better candidate than
Widget*?

Additionally, in the real world, not all code is necessarily modern. So
although all raw pointers should be only observing in modern code, legacy code
still uses them to mean something else. Now you have to ask yourself: is this
function that wants a Widget* modern, or is it still living by old implicit
ownership semantics with raw pointers? If the function is living by modern
guidelines, it’s not doing a good job of telling you that in its signature.
Using std::optional eliminates this ambiguity.

  53. ![](https://0.gravatar.com/avatar/c8088f2d382a9266927ac6db45d164fe38c29dbd92e1bff63f9f11484bf47d95?s=48&d=identicon&r=G) **[ zahirtezcan (@zahirtezcan) ](http://twitter.com/zahirtezcan) ** says:

[ 2013-06-05 at 7:58 am  ](https://herbsutter.com/2013/06/05/gotw-91-solution-
smart-pointer-parameters/


![Ghafil Tujhe Gharyal Ye Deta Hai
Manadi](//lh4.ggpht.com/-Tms8XN2rRKk/UbaawljfJEI/AAAAAAAAJks/DuLSCBxA3v8/Inspiration-
watch-poetry_thumb%25255B3%25255D.jpg?imgmax=800)


[ ](javascript:; "Share Article") [
](//www.rssing.com/contact.php?r=o6&u=%2F%2Fquestion1970.rssing.com%2Fchan-34075453%2Farticle26-live.html
"Article Support")


[ _≪_ Previous: Custom classes in message files
](//question1970.rssing.com/chan-34075453/all_p2.html#c34075453a28 "Previous
Article")


In this case, the QOS profile is configured to keep the last received 10
messages with “best effort” reliability and “volatile” durability. This
configuration is highly compatible with many possible publisher
configurations.


comment-10990)

@Herb: “If the local scope is not the final destination, just std::move the
shared_ptr onward to wherever it needs to go.” Why is this better than passing
by const shared_ptr& through a chain of functions until we’re ready for the
final destination? What if the callee will make a decision about whether to
share ownership or not? If it decides not to, then we’ve copied for no reason.

Also I noted that you said “always pass them by reference to const, and very
occasionally maybe because you know what you called might modify the thing you
got a reference from, maybe then you might pass by value” ( [
http://stackoverflow.com/a/8844924/297451
](http://stackoverflow.com/a/8844924/297451) ). Can I confirm that your
opinion has changed since then?

  36. ![](https://0.gravatar.com/avatar/9e30405458e3b0e25736ed83f61c341ced364b5c831d36433ec5bc79ef4c3ee7?s=48&d=identicon&r=G) **[ Bret Kuhns ](http://gravatar.com/bkuhns) ** says:

[ 2013-06-05 at 4:49 pm  ](https://herbsutter.com/2013/06/05/gotw-91-solution-
smart-pointer-parameters/


  * [ Home ](https://automaticaddison.com)
  * [ Need Help? ](https://automaticaddison.com/contact/)
  * [ Tutorials ](https://automaticaddison.com/tutorials/)
  * [ About Me ](https://automaticaddison.com/about-me/)


comment-10931)

Regarding the following in the last guideline: “Don’t use a const shared_ptr&
parameter; use widget* instead.”
Why not widget&?

BTW, is there a way to enable inline code formatting, e.g., using backticks `
` like on StackOverflow?

  57. ![](https://0.gravatar.com/avatar/ce729e763ea61b1cb3fad18bfc6233d8f47cad29894d8b4d8acbd2893a8e58a4?s=48&d=identicon&r=G) **[ Lars Viklund ](http://gravatar.com/larsviklund) ** says:

[ 2013-06-05 at 6:57 am  ](https://herbsutter.com/2013/06/05/gotw-91-solution-
smart-pointer-parameters/


                        msg->pose.pose.orientation.z,
                        msg->pose.pose.orientation.w);

            // 3x3 Rotation matrix from quaternion
            tf2::Matrix3x3 m(q);

            // Roll Pitch and Yaw from rotation matrix
            double roll, pitch, yaw;
            m.getRPY(roll, pitch, yaw);

            // Output the measure
            RCLCPP_INFO(get_logger(), "Received odometry in '%s' frame : X: %.2f Y: %.2f Z: %.2f - R: %.2f P: %.2f Y: %.2f - Timestamp: %u.%u sec ",
                     msg->header.frame_id.c_str(),
                     tx, ty, tz,
                     roll * RAD2DEG, pitch * RAD2DEG, yaw * RAD2DEG,
                        msg->header.stamp.sec,msg->header.stamp.nanosec);
        }


Best Regards


The ` odometry pose ` is calculated with a pure “visual odometry” algorithm as
the sum of the movement from one step to the next. It is therefore affected by
drift.


[ ↂ
](////arrests130.rssing.com/chan-8670761/article2736.html#c8670761a2736i331208640
"CALIFORNIA: DUI arrests by Chico Police March 2019")


[ ](javascript:; "Share Article") [
](//www.rssing.com/contact.php?r=o6&u=%2F%2Fquestion1970.rssing.com%2Fchan-34075453%2Farticle32-live.html
"Article Support")


[ English  ](javascript:; "English")


[ ](javascript:;)


  * [ RSSing>> ](//www.rssing.com/index.php)
    * Collections:
    * [ RSSing ](//www.rssing.com/index.php)
    * [ EDA ](//www.rssing.com/d/eda/index.php)
    * [ Intel ](//www.rssing.com/d/intel/index.php)
    * [ Mesothelioma ](//www.rssing.com/d/mesothelioma/index.php)
    * [ SAP ](//www.rssing.com/d/sap/index.php)
    * [ SEO ](//www.rssing.com/d/seo/index.php)
  * [ Latest  ](//www.rssing.com/index.php?l=l)
    * [ Articles ](//www.rssing.com/index.php?l=la)
    * [ Channels ](//www.rssing.com/index.php?l=lc)
    * [ Super Channels ](//www.rssing.com/index.php?l=ls)
  * [ Popular  ](//www.rssing.com/index.php?l=p)
    * [ Articles ](//www.rssing.com/index.php?l=pa)
    * [ Pages ](//www.rssing.com/index.php?l=pp)
    * [ Channels ](//www.rssing.com/index.php?l=pc)
    * [ Super Channels ](//www.rssing.com/index.php?l=ps)
  * [ Top Rated  ](//www.rssing.com/index.php?l=r)
    * [ Articles ](//www.rssing.com/index.php?l=ra)
    * [ Pages ](//www.rssing.com/index.php?l=rp)
    * [ Channels ](//www.rssing.com/index.php?l=rc)
    * [ Super Channels ](//www.rssing.com/index.php?l=rs)
  * [ Trending  ](//www.rssing.com/index.php?l=t)
    * [ Articles ](//www.rssing.com/index.php?l=ta)
    * [ Pages ](//www.rssing.com/index.php?l=tp)
    * [ Channels ](//www.rssing.com/index.php?l=tc)
    * [ Super Channels ](//www.rssing.com/index.php?l=ts)


Open a new console and use this command to connect the camera to the ROS 2
network:


###  [ People's Blog • First Pictures of the Eclipse ! ! !
](////satire6144.rssing.com/chan-78334822/article122.html#c78334822a122i1295535114)


[ ](//www.rssing.com/index.php?zw=2123 "Home") [ $ ](javascript:; "MoMoney")


[ X ](javascript:;) Mark channel Not-Safe-For-Work?  [ cancel ](javascript:;)
[ confirm ](javascript:;) NSFW Votes:  (  0  votes)


###  [ Frequency Adverbs
](////adverbs45.rssing.com/chan-14763103/article227.html#c14763103a227i286089440)


[ _≪_ Previous: rosserial_arduino generate dependent packages before
make_libraries
](//question1970.rssing.com/chan-34075453/all_p2.html#c34075453a34 "Previous
Article")


#  Real-World Applications


###  [ Highlights - Bringing young people to the forefront of EU policy making
-...
](////europees185.rssing.com/chan-78228109/article559.html#c78228109a559i1335926349)


#  Prerequisites


Build the Future


April 8, 2024, 1:08 pm


##  Recent Posts


1 to make a correction (remove the comment
about increment being cheap, as there overhead and it does incur a fence on
x86/x64) and add the following new explanatory paragraph to drive home an
essential point made again later on:

New text: “As we will see, an essential best practice for any reference-
counted smart pointer type is to avoid copying it unless you really mean to
add a new reference. This cannot be stressed enough. This directly addresses
both of these costs and pushes their performance impact down into the noise
for most applications, and especially eliminates the second cost because it is
an antipattern to add and remove references in tight loops.”

Thanks, Andrei!

  13. ![](https://2.gravatar.com/avatar/2d23c8aa1e14697964288c6f1d4d10eaa934a0f053e5f9062ed475b7ce6a5f8e?s=48&d=identicon&r=G) **leo_carvalho** says:

[ 2013-11-19 at 4:02 pm  ](https://herbsutter.com/2013/06/05/gotw-91-solution-
smart-pointer-parameters/


[ ](javascript:; "Ouch") 0


Hi [ @w.ronaldo.cd ](/u/w.ronaldo.cd) ,


comment-10986)

@BrianM: But the Guidelines are simple — don’t pass by smart pointer unless
you want to use/modify the smart pointer itself (like any object). The main
thing is that pass by value/*/& are all still good and should still be used
primarily. It’s just that we now have a couple of idioms for expressing
ownership transfer in function signatures, notably passing a unique_ptr by
value means “sink” and passing a shared_ptr by value means “gonna share
ownership.” That’s pretty much it.

  39. ![](https://graph.facebook.com/501542799/picture?type=large&_md5=83e24ccaec516edd38c78ac901e35de2) **[ Leszek Swirski ](http://www.facebook.com/leszek.swirski) ** says:

[ 2013-06-05 at 4:27 pm  ](https://herbsutter.com/2013/06/05/gotw-91-solution-
smart-pointer-parameters/


      nav_msgs::Odometry quatOdom;
      quatOdom.header.stamp = odomNew.header.stamp;
      quatOdom.header.frame_id = "odom";
      quatOdom.child_frame_id = "base_link";
      quatOdom.pose.pose.position.x = odomNew.pose.pose.position.x;
      quatOdom.pose.pose.position.y = odomNew.pose.pose.position.y;
      quatOdom.pose.pose.position.z = odomNew.pose.pose.position.z;
      quatOdom.pose.pose.orientation.x = q.x();
      quatOdom.pose.pose.orientation.y = q.y();
      quatOdom.pose.pose.orientation.z = q.z();
      quatOdom.pose.pose.orientation.w = q.w();
      quatOdom.twist.twist.linear.x = odomNew.twist.twist.linear.x;
      quatOdom.twist.twist.linear.y = odomNew.twist.twist.linear.y;
      quatOdom.twist.twist.linear.z = odomNew.twist.twist.linear.z;
      quatOdom.twist.twist.angular.x = odomNew.twist.twist.angular.x;
      quatOdom.twist.twist.angular.y = odomNew.twist.twist.angular.y;
      quatOdom.twist.twist.angular.z = odomNew.twist.twist.angular.z;

      for(int i = 0; i<36; i++) {
        if(i == 0 || i == 7 || i == 14) {
          quatOdom.pose.covariance[i] = .01;
         }
         else if (i == 21 || i == 28 || i== 35) {
           quatOdom.pose.covariance[i] += 0.1;
         }
         else {
           quatOdom.pose.covariance[i] = 0;
         }
      }

      odom_data_pub_quat.publish(quatOdom);
    }

    // Update odometry information
    void update_odom() {

      // Calculate the average distance
      double cycleDistance = (distanceRight + distanceLeft) / 2;

      // Calculate the number of radians the robot has turned since the last cycle


[ _≫_ Next: Using custom messages in ROSAndroid
](//question1970.rssing.com/chan-34075453/all_p2.html#c34075453a25 "Next
Article")


[ NSFW?  ](javascript:; "Mark channel Not-Safe-For-Work")


#  [ custom rqt gui
](//question1970.rssing.com/chan-34075453/article35-live.html)


[ _≫_ Next: Error in Importing Custom Message Types in a Python File in
Eclipse ](//question1970.rssing.com/chan-34075453/all_p2.html#c34075453a29
"Next Article")


2, this is recommended only when the function wants to retain a
copy of the  shared_ptr  and share ownership. In that case, a copy is needed
anyway so the copying cost is fine. If the local scope is not the final
destination, just  std::move  the  shared_ptr  onward to wherever it needs to
go.

> **Guideline:** Express that a function will store and share ownership of a
> heap object using a by-value **shared_ptr** parameter.

Otherwise, prefer passing a  *  or  & (possibly to  const  ) instead, since
that doesn’t restrict the function to only objects that happen to be owned by
shared_ptr  s.


[ ](javascript:; "Like") 0


comment-10973)

BTW, it’s better if the function in 3(a) is a pointer constant, not (just) a
pointer-to-constant:

f(widget * const);
f(const widget * const);

Doesn’t matter too much (as it’s just a matter of a copy to get a modifiable
pointer), but it does document that the function will inspect only the pointed
object, and won’t do tricky traversals.

  46. ![](https://graph.facebook.com/100004054812229/picture?type=large) **[ Róbert Dávid ](http://www.facebook.com/profile.php?id=100004054812229) ** says:

[ 2013-06-05 at 1:01 pm  ](https://herbsutter.com/2013/06/05/gotw-91-solution-
smart-pointer-parameters/


#  [ How to set custom location for urdf files created from xacro with cmake?
](//question1970.rssing.com/chan-34075453/article40-live.html)


##  Position with RVIZ  #


[ _≪_ Previous: android custom messages - Subscriber handshake failed -
Message types don't match
](//question1970.rssing.com/chan-34075453/all_p2.html#c34075453a26 "Previous
Article")


        if (leftTicks > 10000) {
          leftTicks = 0 - (65535 - leftTicks);
        }
        else if (leftTicks < -10000) {
          leftTicks = 65535-leftTicks;
        }
        else{}
        distanceLeft = leftTicks/TICKS_PER_METER;
      }
      lastCountL = leftCount.data;
    }

    // Calculate the distance the right wheel has traveled since the last cycle
    void Calc_Right(const std_msgs::Int16& rightCount) {

      static int lastCountR = 0;
      if(rightCount.data != 0 && lastCountR != 0) {

        int rightTicks = rightCount.data - lastCountR;

        if (rightTicks > 10000) {
          distanceRight = (0 - (65535 - distanceRight))/TICKS_PER_METER;
        }
        else if (rightTicks < -10000) {
          rightTicks = 65535 - rightTicks;
        }
        else{}
        distanceRight = rightTicks/TICKS_PER_METER;
      }
      lastCountR = rightCount.data;
    }

    // Publish a nav_msgs::Odometry message in quaternion format
    void publish_quat() {

      tf2::Quaternion q;

      q.setRPY(0, 0, odomNew.pose.pose.orientation.z);


comment-10930)

The assumption in (2) that the caller will not destroy their shared_ptr that’s
passed by reference does not always hold. It’s trivial that from the leaf
function invoke something that indirectly changes the state of the calling
function, not uncommon when there’s callbacks and notifications involved. I
would augment the advise to only recommend references to shared_ptr if you’re
properly sure that they are valid for the duration of the call.

Comments are closed.

Search for:


###  [ Giant Crop Cheat Sheet
](////starve149.rssing.com/chan-67795027/article12985.html#c67795027a12985i625842650)


        double tx = msg->pose.position.x;
        double ty = msg->pose.position.y;
        double tz = msg->pose.position.z;


October 24, 2014, 8:37 am


ROS2 Foxy GoalResponseCallback:


RVIZ provides plugins for visualizing the camera’s pose and its path over
time.


comment-10957)

That’ll teach me from not refreshing the page before I post a comment. Good
thing I’m not the only one thinking happy thoughts about optional.

  50. ![](https://2.gravatar.com/avatar/efa797d6cdcba682be8fd94668b0bfbb9c1a1a1ca3806ecbdfbe5d590dd7051f?s=48&d=identicon&r=G) **[ Arthur Langereis ](http://cpphappyfunhouse.com/) ** says:

[ 2013-06-05 at 9:49 am  ](https://herbsutter.com/2013/06/05/gotw-91-solution-
smart-pointer-parameters/


Hi [ @girishkumar.kannan ](/u/girishkumar.kannan) ,
The error appears during compilation ( _colcon build_ ) I posted that image
because it shows where the problem is and the error. I will keep reviewing my
code.
Best regards


[ ](javascript:; "Share Article") [
](//www.rssing.com/contact.php?r=o6&u=%2F%2Fquestion1970.rssing.com%2Fchan-34075453%2Farticle24-live.html
"Article Support")


![Duas for Difficulties, Ism Adham-'Allah’s Greatest Name' and Secrets of Ya
Hayyu Ya
Qayyum](//2.bp.blogspot.com/-IJM3qg4P1NQ/Ugc0BBcHquI/AAAAAAAAAVc/XjnDYEvefA8/s400/Istighfar+al-
Kabir.jpg)


optional_ref
](http://isocpp.org/files/papers/N3672.html


Hi, i am doing
http://wiki.ros.org/rosjava/Tutorials/hydro/Unofficial%20Messages and
http://wiki.ros.org/ROS/Tutorials/CreatingMsgAndSrv can anyone have a short
look on my CMakeList.txt? When i do catkin_make i get the error \-- ==>
add_subdirectory(custom_msgs) \-- Using these message generators:
gencpp;genlisp;genpy CMake Error at /opt/ros/hydro/share/genmsg/cmake/genmsg-
extras.cmake:85 (message): add_message_files() directory not found:
/home/user/rosjava/src/custom_msgs/msg Call Stack (most recent call first):
custom_msgs/CMakeLists.txt:68 (add_message_files) \-- Configuring incomplete,
errors occurred! make: *** [cmake_check_build_system] Fehler 1 Invoking "make
cmake_check_build_system" failed In my Folder custom_msgs i have the file
mycustomMSG.msg CMakeList: cmake_minimum_required(VERSION 2.8.3)
project(custom_msgs) ##Tutorial
http://wiki.ros.org/ROS/Tutorials/CreatingMsgAndSrv ## Find catkin macros and
libraries ## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS
xyz) ## is used, also find other catkin packages ##find_package(catkin
REQUIRED COMPONENTS ## std_msgs ##) find_package(catkin REQUIRED COMPONENTS
roscpp rospy std_msgs message_generation ) ## System dependencies are found
with CMake's conventions # find_package(Boost REQUIRED COMPONENTS system) ##
Uncomment this if the package has a setup.py. This macro ensures ## modules
and global scripts declared therein get installed ## See
http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html #
catkin_python_setup() ################################################ ##
Declare ROS messages, services and actions ##
################################################ ## To declare and build
messages, services or actions from within this ## package, follow these steps:
## * Let MSG_DEP_SET be the set of packages whose message types you use in ##
your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...). ## * In
the file package.xml: ## * add a build_depend and a run_depend tag for each
package in MSG_DEP_SET ## * If MSG_DEP_SET isn't empty the following
dependencies might have been ## pulled in transitively but can be declared for
certainty nonetheless: ## * add a build_depend tag for "message_generation" ##
* add a run_depend tag for "message_runtime" ## * In this file
(CMakeLists.txt): ## * add "message_generation" and every package in
MSG_DEP_SET to ## find_package(catkin REQUIRED COMPONENTS ...) ## * add
"message_runtime" and every package in MSG_DEP_SET to ##
catkin_package(CATKIN_DEPENDS ...) ## * uncomment the add_*_files sections
below as needed ## and list every .msg/.srv/.action file to be processed ## *
uncomment the generate_messages entry below ## * add every package in
MSG_DEP_SET to generate_messages(DEPENDENCIES ...) ## Generate messages in the


Add the following lines.


#  [ teleoperation using custom key
](//question1970.rssing.com/chan-34075453/article36-live.html)


103-105. I decided
> leaving a gap in the numbers wasn’t best after all, so I am renumbering them
> to


[ _≪_ Previous: rosserial - arduino - custom message - message larger than
buffer ](//question1970.rssing.com/chan-34075453/all_p2.html#c34075453a38
"Previous Article")


[ _≫_ Next: rosserial - arduino - custom message - message larger than buffer
](//question1970.rssing.com/chan-34075453/all_p2.html#c34075453a38 "Next
Article")


© 2024 //www.rssing.com


[ _≫_ Next: rosserial_arduino Create custom messages from custom messages
](//question1970.rssing.com/chan-34075453/all_p2.html#c34075453a33 "Next
Article")


####  Latest Images


[ _≪_ Previous: Android pubsub Listener custom message
](//question1970.rssing.com/chan-34075453/all_p2.html#c34075453a27 "Previous
Article")


            std::bind(&WallFollower::feedback_callback, this, _1, _2);

            send_goal_options.result_callback =
            std::bind(&WallFollower::result_callback, this, _1);

            auto goal_handle_future = this->client_ptr_->async_send_goal(goal_msg, send_goal_options);
        }

    void goal_response_callback(const GoalHandleOdomRecord::SharedPtr & goal_handle)
        {
            if (!goal_handle) {
            RCLCPP_ERROR(this->get_logger(), "Goal was rejected by server");
            } else {
            RCLCPP_INFO(this->get_logger(), "Goal accepted by server, waiting for result");
            }
        }

        void feedback_callback(
            GoalHandleOdomRecord::SharedPtr,
            const std::shared_ptr<const OdomRecord::Feedback> feedback)
        {
            RCLCPP_INFO(
            this->get_logger(), "Feedback received: Total current distance = %f", feedback->current_total);
        }

        void result_callback(const GoalHandleOdomRecord::WrappedResult & result)
        {
            this->goal_done_ = true;
            switch (result.code) {
            case rclcpp_action::ResultCode::SUCCEEDED:
                break;
            case rclcpp_action::ResultCode::ABORTED:
                RCLCPP_ERROR(this->get_logger(), "Goal was aborted");
                return;
            case rclcpp_action::ResultCode::CANCELED:
                RCLCPP_ERROR(this->get_logger(), "Goal was canceled");
                return;
            default:
                RCLCPP_ERROR(this->get_logger(), "Unknown result code");


Hi [ @w.ronaldo.cd ](/u/w.ronaldo.cd) ,


###  [ The Umbrella Academy’s Justin Min shares adorable first selfie with new
boyfriend
](////metro2989.rssing.com/chan-40972540/article57410.html#c40972540a57410i495009908)


June 9, 2014, 3:14 am


[ ](//www.rssing.com/index.php?zw=2123 "Home") [ $ ](javascript:; "MoMoney")


[ ![Fake lip ring, silver lip ring, simple lip ring, unisex lip ring by
AIRlab](//i.etsystatic.com/10798216/r/il/3a91cc/761285074/il_570xN.761285074_fu8j.jpg)
](////kuteriot1.rssing.com/chan-5865851/article17035.html#c5865851a17035i913072506)


ros2 launch zed_display_rviz2 display_zed_cam.launch.py camera_model:=<camera model>


[ ↂ
](////drama1031.rssing.com/chan-27446141/article21.html#c27446141a21i856785604
"Za Pakhtoon Yum: A mind-altering foray into Pukhtun life and culture")


[ ](javascript:; "Like") 0


Menu


###  [ Duas for Difficulties, Ism Adham-'Allah’s Greatest Name' and Secrets of
Ya Hayyu Ya Qayyum
](////salawats2.rssing.com/chan-11490042/article47.html#c11490042a47i371003744)


Welcome to AutomaticAddison.com, the largest robotics education blog online
(~50,000 unique visitors per month)!


###  [ Fake lip ring, silver lip ring, simple lip ring, unisex lip ring by
AIRlab
](////kuteriot1.rssing.com/chan-5865851/article17035.html#c5865851a17035i913072506)


comment-10989)

@Herb, since reference types for `std::optional` was not approved, it makes it
all the more unfortunate that N3514 “A Proposal for the World’s Dumbest Smart
Pointer” didn’t make it either. A `std::exempt_ptr` would be an obvious answer
to explicitly express non-owning pointer semantics.

  37. ![](https://0.gravatar.com/avatar/928f5830f12d8977791539452bfc25c92912322476f0725253697ee1c45ce036?s=48&d=identicon&r=G) **[ Herb Sutter ](http://www.herbsutter.com) ** says:

[ 2013-06-05 at 4:39 pm  ](https://herbsutter.com/2013/06/05/gotw-91-solution-
smart-pointer-parameters/


Table of Contents


[ ](javascript:; "Share Article") [
](//www.rssing.com/contact.php?r=o6&u=%2F%2Fquestion1970.rssing.com%2Fchan-34075453%2Farticle34-live.html
"Article Support")


    rosrun localization_data_pub rviz_click_to_2d

    rviz


  (c) Passing unique_ptr by value means “sink.”

    void f( unique_ptr<widget> );   (c)

This is the preferred way to express a  widget  -consuming function, also
known as a “sink.”

Passing a  unique_ptr  by value is only possible by moving the object and its
unique ownership from the caller to the callee. Any function like (c) takes
ownership of the object away from the caller, and either destroys it or moves
it onward to somewhere else.

Note that, unlike some of the other options below, this use of a by-value
unique_ptr  parameter actually doesn’t limit the kind of object that can be
passed to those managed by a  unique_ptr  . Why not? Because any pointer can
be explicitly converted to a  unique_ptr  . If we didn’t use a  unique_ptr
here we would still have to express “sink” semantics, just in a more brittle
way such as by accepting a raw _owning_ pointer (anathema!) and documenting
the semantics in comments. Using (c) is vastly superior because it documents
the semantics in code, and requires the caller to explicitly move ownership.

Consider the major alternative:

    // Smelly 20th-century alternative
    void bad_sink( widget* p );  // will destroy p; PLEASE READ THIS COMMENT

    // Sweet self-documenting self-enforcing modern version (c)
    void good_sink( unique_ptr<widget> p );

And how much better (c) is:

    // Older calling code that calls the new good_sink is safer, because


comment-10970)

Concerning case e:

        void f( shared_ptr<widget> w);

The receiver will likely store the copy in a container. Will this incur the
cost of a second copy?

  49. ![](https://1.gravatar.com/avatar/18807f88f5160f1914fedbdd306200a150975fbb433fc103f75bceed58906fd0?s=48&d=identicon&r=G) **zenmumbler** says:

[ 2013-06-05 at 9:51 am  ](https://herbsutter.com/2013/06/05/gotw-91-solution-
smart-pointer-parameters/


[ Search ](javascript:;)


‘void message_filters::Synchronizer  ::connectInput(F0&, F1&, F2&) [with F0 =
message_filters::Subscriber<:featurebarray_>>>, F1 =
message_filters::Subscriber<:odometry_>>>, F2 =
message_filters::NullFilter<:nulltype>, Policy =
message_filters::sync_policies::ExactTime<:featurebarray_>>,
nav_msgs::Odometry_<:allocator>>, message_filters::NullType,
message_filters::NullType, message_filters::NullType,
message_filters::NullType, message_filters::NullType,
message_filters::NullType, message_filters::NullType>]’
/opt/ros/hydro/include/message_filters/synchronizer.h:240:5: instantiated from
‘void message_filters::Synchronizer  ::connectInput(F0&, F1&) [with F0 =
message_filters::Subscriber<:featurebarray_>>>, F1 =
message_filters::Subscriber<:odometry_>>>, Policy =
message_filters::sync_policies::ExactTime<:featurebarray_>>,
nav_msgs::Odometry_<:allocator>>, message_filters::NullType,
message_filters::NullType, message_filters::NullType,
message_filters::NullType, message_filters::NullType,
message_filters::NullType, message_filters::NullType>]’
/opt/ros/hydro/include/message_filters/time_synchronizer.h:120:5: instantiated
from ‘message_filters::TimeSynchronizer  ::TimeSynchronizer(F0&, F1&,
uint32_t) [with F0 = message_filters::Subscriber<:featurebarray_>>>, F1 =
message_filters::Subscriber<:odometry_>>>, M0 =
coop_est::FeatureBArray_<:allocator>>, M1 = nav_msgs::Odometry_<:allocator>>,
M2 = message_filters::NullType, M3 = message_filters::NullType, M4 =
message_filters::NullType, M5 = message_filters::NullType, M6 =
message_filters::NullType, M7 = message_filters::NullType, M8 =
message_filters::NullType, uint32_t = unsigned int]’
/home/quadrotor/catkin_ws/src/coop_est/src/coop_node.cpp:327:107: instantiated
from here
/opt/ros/hydro/include/message_filters/sync_policies/exact_time.h:127:102:
error: ‘value’ is not a member of
‘ros::message_traits::TimeStamp<:featurebarray_>>, void>’
/opt/ros/hydro/include/message_filters/sync_policies/exact_time.h: In member
function ‘void message_filters::sync_policies::ExactTime
::checkTuple(message_filters::sync_policies::ExactTime  ::Tuple&) [with M0 =
coop_est::FeatureBArray_<:allocator>>, M1 = nav_msgs::Odometry_<:allocator>>,
M2 = message_filters::NullType, M3 = message_filters::NullType, M4 =
message_filters::NullType, M5 = message_filters::NullType, M6 =
message_filters::NullType, M7 = message_filters::NullType, M8 =
message_filters::NullType, message_filters::sync_policies::ExactTime  ::Tuple


RSSing.com


Sharing:


comment-10972)

@Francis Rammeloo: If he moves w into the container, then no..

  47. ![](https://graph.facebook.com/100004054812229/picture?type=large&_md5=9e5f827892523ff7a319a1687be4b4dd) **[ Róbert Dávid ](http://www.facebook.com/profile.php?id=100004054812229) ** says:

[ 2013-06-05 at 1:01 pm  ](https://herbsutter.com/2013/06/05/gotw-91-solution-
smart-pointer-parameters/


[ ](javascript:; "Ouch") 0


Toggle


[ ↂ
](////downloadhub26.rssing.com/chan-63389705/article159.html#c63389705a159i1981662480
"Good Will Hunting 1997 Dual Audio 720p BRRip \[Hindi – English\] ESubs")


comment-10956)

Also, given that we’re talking C++14 here:

when you indicate that widget* should be used for optional objects, why not
advise to use
std::optional as a parameter instead? In fact, a GotW on optional would be
appreciated as I’m sure there are subtleties to it that require a closer look.

  51. ![](https://0.gravatar.com/avatar/9e30405458e3b0e25736ed83f61c341ced364b5c831d36433ec5bc79ef4c3ee7?s=48&d=identicon&r=G) **bkuhns** says:

[ 2013-06-05 at 8:55 am  ](https://herbsutter.com/2013/06/05/gotw-91-solution-
smart-pointer-parameters/


![Giant Crop Cheat
Sheet](//s3.amazonaws.com/kleiforums/monthly_2021_01/1434035901_SpringGiantCrops.thumb.png.da7c62531af2e491e13151bbb10b0f2f.png)


The parameters to be configured are analogous to the parameters seen above for
the ` Pose ` plugin.


![CALIFORNIA: DUI arrests by Chico Police March
2019](//i2.wp.com/www.dwihitparade.com/wp-
content/uploads/2019/04/Sean-P.-Biswurm-33-of-Chico-Calif.-DUI-arrest-on-
March-18-2019-by-Chico-Police.png?w=550)


  (a) and (b): Prefer passing parameters by * or &.

    void f( widget* );              (a)
    void f( widget& );              (b)

These are the preferred way to pass normal object parameters, because they
stay agnostic of whatever lifetime policy the caller happens to be using.

Non-owning raw  *  pointers and  & references are okay to observe an object
whose lifetime we know exceeds that of the pointer or reference, which is
usually true for function parameters. Thanks to structured lifetimes, by
default arguments passed to  f  in the caller outlive  f  ‘s function call
lifetime, which is extremely useful (not to mention efficient) and makes non-
owning  *  and  & appropriate for parameters.

Pass by  *  or  & to accept a  widget  independently of how the caller is
managing its lifetime. Most of the time, we don’t want to commit to a lifetime
policy in the parameter type, such as requiring the object be held by a
specific smart pointer, because this is usually needlessly restrictive. As
usual, use a  *  if you need to express null (no  widget  ), otherwise prefer
to use a  & ; and if the object is input-only, write  const widget*  or  const
widget& .


###  The code explained  #


rosrun localization_data_pub ekf_odom_pub


###  [ Calgary Hells Angels implicated in another fraud
](////hullabaloo16.rssing.com/chan-9145637/article818.html#c9145637a818i695428444)


[ ![image](https://get-
help.robotigniteacademy.com/uploads/default/optimized/2X/2/24add0ecd024a7f5276e15181b6dc454d3e48661_2_690x173.png)
image  1069×269 73.9 KB  ](https://get-
help.robotigniteacademy.com/uploads/default/original/2X/2/24add0ecd024a7f5276e15181b6dc454d3e48661.png
"image")


  Archives

  * [ April 2024 ](https://herbsutter.com/2024/04/) (1)
  * [ March 2024 ](https://herbsutter.com/2024/03/) (3)
  * [ February 2024 ](https://herbsutter.com/2024/02/) (1)
  * [ November 2023 ](https://herbsutter.com/2023/11/) (1)
  * [ October 2023 ](https://herbsutter.com/2023/10/) (1)
  * [ September 2023 ](https://herbsutter.com/2023/09/) (1)
  * [ August 2023 ](https://herbsutter.com/2023/08/) (1)
  * [ June 2023 ](https://herbsutter.com/2023/06/) (1)
  * [ April 2023 ](https://herbsutter.com/2023/04/) (2)
  * [ February 2023 ](https://herbsutter.com/2023/02/) (1)
  * [ December 2022 ](https://herbsutter.com/2022/12/) (1)
  * [ November 2022 ](https://herbsutter.com/2022/11/) (1)
  * [ October 2022 ](https://herbsutter.com/2022/10/) (2)
  * [ September 2022 ](https://herbsutter.com/2022/09/) (2)
  * [ October 2021 ](https://herbsutter.com/2021/10/) (1)
  * [ June 2021 ](https://herbsutter.com/2021/06/) (2)
  * [ May 2021 ](https://herbsutter.com/2021/05/) (1)
  * [ March 2021 ](https://herbsutter.com/2021/03/) (2)
  * [ February 2021 ](https://herbsutter.com/2021/02/) (4)
  * [ January 2021 ](https://herbsutter.com/2021/01/) (5)
  * [ December 2020 ](https://herbsutter.com/2020/12/) (1)
  * [ November 2020 ](https://herbsutter.com/2020/11/) (2)
  * [ October 2020 ](https://herbsutter.com/2020/10/) (1)
  * [ September 2020 ](https://herbsutter.com/2020/09/) (2)
  * [ July 2020 ](https://herbsutter.com/2020/07/) (1)
  * [ June 2020 ](https://herbsutter.com/2020/06/) (2)
  * [ May 2020 ](https://herbsutter.com/2020/05/) (3)
  * [ April 2020 ](https://herbsutter.com/2020/04/) (1)
  * [ March 2020 ](https://herbsutter.com/2020/03/) (1)
  * [ February 2020 ](https://herbsutter.com/2020/02/) (4)
  * [ November 2019 ](https://herbsutter.com/2019/11/) (1)
  * [ October 2019 ](https://herbsutter.com/2019/10/) (1)
  * [ September 2019 ](https://herbsutter.com/2019/09/) (4)
  * [ July 2019 ](https://herbsutter.com/2019/07/) (5)
  * [ June 2019 ](https://herbsutter.com/2019/06/) (1)
  * [ May 2019 ](https://herbsutter.com/2019/05/) (1)
  * [ April 2019 ](https://herbsutter.com/2019/04/) (1)
  * [ February 2019 ](https://herbsutter.com/2019/02/) (1)


April 14, 2024, 8:14 am


#  [ Append data to vector3[] array - custom message
](//question1970.rssing.com/chan-34075453/article37-live.html)


rostopic echo /odom_data_quat


[ ↂ
](////myanmar19.rssing.com/chan-7313589/article889.html#c7313589a889i784670228
"Last Day of Yangon Thingyan Festival Celebration 2014")


[ ↂ
](////dailyentertainmentnews33.rssing.com/chan-41166720/article94.html#c41166720a94i1969999888
"Meet Peter Nygard Girlfriends & Children")


Open another terminal window, and [ launch the initial pose and goal publisher
](https://automaticaddison.com/how-to-create-an-initial-pose-and-goal-
publisher-in-ros/) .


optional_ref) . I asked Andrzej
about it a few days ago and that part wasn’t accepted for C++14 and isn’t
likely to be. There is a workaround: std::optional<reference_wrapper>. IMO
it’s less clear, less efficient, and more verbose than plain widget*.

@Bret,Arthur: Yes, I intend to eventually write a GotW on parameter passing.
Probably not for a couple of months though, if I do get to it. And I may not.

  44. ![](https://0.gravatar.com/avatar/9e30405458e3b0e25736ed83f61c341ced364b5c831d36433ec5bc79ef4c3ee7?s=48&d=identicon&r=G) **[ Bret Kuhns ](http://gravatar.com/bkuhns) ** says:

[ 2013-06-05 at 1:48 pm  ](https://herbsutter.com/2013/06/05/gotw-91-solution-
smart-pointer-parameters/


catkin_make now i get user@Ubuntu-Test:~/rosjava$ locate function_drivinggoal
/home/user/catkin_ws/src/architecture/ros_messages/msg/function_drivinggoal.msg
/home/user/catkin_ws/src/architecture/yamdl_messages/include/function_drivinggoal_yamdl.hh
/home/user/catkin_ws/src/architecture/yamdl_messages/src/function_drivinggoal_yamdl.cpp
/home/user/rosjava/devel/include/custom_msgs/function_drivinggoal.h
/home/user/rosjava/devel/lib/python2.7/dist-
packages/custom_msgs/msg/_function_drivinggoal.py
/home/user/rosjava/devel/share/common-
lisp/ros/custom_msgs/msg/_package_function_drivinggoal.lisp
/home/user/rosjava/devel/share/common-
lisp/ros/custom_msgs/msg/function_drivinggoal.lisp
/home/user/rosjava/src/custom_msgs/msg/function_drivinggoal.msg
/home/user/rosjava/src/my_custom_messages/custom_msgs/build/classes/main/custom_msgs/function_drivinggoal.class
/home/user/rosjava/src/my_custom_messages/custom_msgs/build/generated-
src/custom_msgs/function_drivinggoal.java and i think i got it
custom_msgs-0.0.0.jar finally exists What are the steps to use this custom
messages in my android project???


Powered by [ Discourse ](https://www.discourse.org) , best viewed with
JavaScript enabled


  * [ Documentation ](https://www.stereolabs.com/docs/)
  * [ Samples ](https://www.stereolabs.com/docs/samples/)
  * [ API Reference ](https://www.stereolabs.com/docs/api/)
  * [ Support ](https://support.stereolabs.com/hc/en-us/)
  * [ Downloads ](https://www.stereolabs.com/developers/release/)


February 13, 2014, 11:39 pm


April 12, 2024, 3:59 pm


[ ](//www.rssing.com/index.php?zw=2123 "Home") [ $ ](javascript:; "MoMoney")


Paste the errors that occur during compilation carefully here, screenshot or
just copy and paste in a code block (better).


Regards,
Girish


comment-10981)

@Herb: fair enough. I can see you’re using WordPress, how about adding WP-
Markdown to enable MarkDown (also mentioned by Bret, it’s what’s used on
GitHub, Reddit, StackOverflow, and many others — and supports the backticks
syntax for the inline code formatting): [ http://wordpress.org/plugins/wp-
markdown/ ](http://wordpress.org/plugins/wp-markdown/)

// Here’s the relevant feature: [
http://daringfireball.net/projects/markdown/syntax


[ _≫_ Next: compile twice to see custom message
](//question1970.rssing.com/chan-34075453/all_p2.html#c34075453a22 "Next
Article")


    int main(int argc, char* argv[]) {
        rclcpp::init(argc, argv);

        auto pos_track_node = std::make_shared<MinimalPoseOdomSubscriber>();

        rclcpp::spin(pos_track_node);
        rclcpp::shutdown();
        return 0;
    }


  * [ //collezione297.rssing.com/chan-78094842/index-latest.php ](//collezione297.rssing.com/chan-78094842/index-latest.php)
  * [ //farms2994.rssing.com/chan-78094631/index-latest.php ](//farms2994.rssing.com/chan-78094631/index-latest.php)
  * [ //compagnie701.rssing.com/chan-78095112/article13.html ](//compagnie701.rssing.com/chan-78095112/article13.html)
  * [ //vault3040.rssing.com/chan-78095394/article111.html ](//vault3040.rssing.com/chan-78095394/article111.html)
  * [ //dunstable190.rssing.com/chan-78094592/index-page1.html ](//dunstable190.rssing.com/chan-78094592/index-page1.html)
  * [ //rinunciare27.rssing.com/chan-44441575/index-page1.html ](//rinunciare27.rssing.com/chan-44441575/index-page1.html)
  * [ //sanitary384.rssing.com/chan-6365953/article35.html ](//sanitary384.rssing.com/chan-6365953/article35.html)
  * [ //income4471.rssing.com/chan-78095055/article88.html ](//income4471.rssing.com/chan-78095055/article88.html)
  * [ //tolidine77.rssing.com/chan-78095000/index-latest.php ](//tolidine77.rssing.com/chan-78095000/index-latest.php)
  * [ //antibody204.rssing.com/chan-78095388/index-latest.php ](//antibody204.rssing.com/chan-78095388/index-latest.php)
  * [ //granite1744.rssing.com/chan-78094523/article4.html ](//granite1744.rssing.com/chan-78094523/article4.html)
  * [ //aveyron248.rssing.com/chan-78095398/article34.html ](//aveyron248.rssing.com/chan-78095398/article34.html)
  * [ //member6787.rssing.com/chan-78095293/article10.html ](//member6787.rssing.com/chan-78095293/article10.html)
  * [ //roost427.rssing.com/chan-78094425/article26.html ](//roost427.rssing.com/chan-78094425/article26.html)
  * [ //travail1342.rssing.com/chan-78095150/index-page1.html ](//travail1342.rssing.com/chan-78095150/index-page1.html)
  * [ //tokyoites77.rssing.com/chan-78094900/index-page1.html ](//tokyoites77.rssing.com/chan-78094900/index-page1.html)
  * [ //purified150.rssing.com/chan-78094678/article10.html ](//purified150.rssing.com/chan-78094678/article10.html)
  * [ //carpenters371.rssing.com/chan-78094450/index-latest.php ](//carpenters371.rssing.com/chan-78094450/index-latest.php)
  * [ //sensuelle478.rssing.com/chan-19990386/index-page1.html ](//sensuelle478.rssing.com/chan-19990386/index-page1.html)
  * [ //selecting752.rssing.com/chan-53835591/index-latest.php ](//selecting752.rssing.com/chan-53835591/index-latest.php)


![PANASONIC SC AKX50LB - CD Stereo system - Power Amp - Main power SMPS -
Schematic \(Circuit Diagram\) - C1BA00000497 \(Power Amp IC\) -\[TDA 8950J\]
](//4.bp.blogspot.com/-QQbgcQ8R1MM/UicZj96-4MI/AAAAAAAA4No/YLSvbnvbK5I/s1600/Power+Amp+Circuit.bmp)


  Post navigation

[ Previous Post  GotW


The ` camera pose ` is instead continuously fixed using the Stereolabs
tracking algorithm that combines visual information, space memory information
and if using a “ZED-M” or a “ZED2”, inertial information.


comment-11021)

Re:


[ girishkumar.kannan  ](https://get-help.theconstruct.ai/u/girishkumar.kannan)
March 14, 2023, 4:41am  2


message_filters::NullFilter<:nulltype>, F8 =
message_filters::NullFilter<:nulltype>, Policy =
message_filters::sync_policies::ExactTime<:featurebarray_>>,
nav_msgs::Odometry_<:allocator>>, message_filters::NullType,
message_filters::NullType, message_filters::NullType,
message_filters::NullType, message_filters::NullType,
message_filters::NullType, message_filters::NullType>]’
/opt/ros/hydro/include/message_filters/synchronizer.h:282:5: instantiated from
‘void message_filters::Synchronizer  ::connectInput(F0&, F1&, F2&, F3&, F4&,
F5&, F6&, F7&) [with F0 = message_filters::Subscriber<:featurebarray_>>>, F1 =
message_filters::Subscriber<:odometry_>>>, F2 =
message_filters::NullFilter<:nulltype>, F3 =
message_filters::NullFilter<:nulltype>, F4 =
message_filters::NullFilter<:nulltype>, F5 =
message_filters::NullFilter<:nulltype>, F6 =
message_filters::NullFilter<:nulltype>, F7 =
message_filters::NullFilter<:nulltype>, Policy =
message_filters::sync_policies::ExactTime<:featurebarray_>>,
nav_msgs::Odometry_<:allocator>>, message_filters::NullType,
message_filters::NullType, message_filters::NullType,
message_filters::NullType, message_filters::NullType,
message_filters::NullType, message_filters::NullType>]’
/opt/ros/hydro/include/message_filters/synchronizer.h:275:5: instantiated from
‘void message_filters::Synchronizer  ::connectInput(F0&, F1&, F2&, F3&, F4&,
F5&, F6&) [with F0 = message_filters::Subscriber<:featurebarray_>>>, F1 =
message_filters::Subscriber<:odometry_>>>, F2 =
message_filters::NullFilter<:nulltype>, F3 =
message_filters::NullFilter<:nulltype>, F4 =
message_filters::NullFilter<:nulltype>, F5 =
message_filters::NullFilter<:nulltype>, F6 =
message_filters::NullFilter<:nulltype>, Policy =
message_filters::sync_policies::ExactTime<:featurebarray_>>,
nav_msgs::Odometry_<:allocator>>, message_filters::NullType,
message_filters::NullType, message_filters::NullType,
message_filters::NullType, message_filters::NullType,
message_filters::NullType, message_filters::NullType>]’
/opt/ros/hydro/include/message_filters/synchronizer.h:268:5: instantiated from
‘void message_filters::Synchronizer  ::connectInput(F0&, F1&, F2&, F3&, F4&,
F5&) [with F0 = message_filters::Subscriber<:featurebarray_>>>, F1 =
message_filters::Subscriber<:odometry_>>>, F2 =


[ ](javascript:; "Ouch") 0


    void goal_response_callback(std::shared_future<GoalHandleOdomRecord::SharedPtr> future)
    {
        // ...
    }


91: Smart Pointer Parameters
](https://herbsutter.com/2013/05/30/gotw-91-smart-pointer-parameters/)

[ Next Post  GotW


comment-10978)

@mttpd: Maybe I should allude to this, thanks: Because const shared_ptr& and
widget* have the same (nullable) semantics. If you’re being tempted to pass
const shared&, widget* doesn’t lose information, whereas switching to widget&
can lose information. Sure, use a & if it can’t be null. And re code: All I
know of is for code blocks.

@David: Normally you’re right to be very suspicious about claims of no
barriers/synchronization. In this case, the key is that because we can
guarantee that no action is never taken by another thread because of a
refcount increment, it is not really a “publish” operation, so one can apply
subtle reasoning and prove that the increment can be memory_order_relaxed; but
it’s exceedingly subtle and most experts shouldn’t even try to venture into
waters like these. I explain this example toward the end of my “atomic
Weapons, Part 2” talk. See pages 50-52 of the slides at [
http://sdrv.ms/NxDB6u ](http://sdrv.ms/NxDB6u) . The talk video is at [
http://channel9.msdn.com/Shows/Going+Deep/Cpp-and-Beyond-2012-Herb-Sutter-
atomic-Weapons-2-of-2 ](http://channel9.msdn.com/Shows/Going+Deep/Cpp-and-
Beyond-2012-Herb-Sutter-atomic-Weapons-2-of-2) .

@zahirtezcan, Francis: Once you’ve copied the shared_ptr, If you want to move
the shared_ptr onward, that’s fine, just std::move it. Constructors aren’t
special, this applies to any function. I should mention this to avoid
confusion; added, thanks.

@Bret: Alas, std::optional isn’t standard; see that part of Andrzej’s paper at
[ http://isocpp.org/files/papers/N3672.html


###  Conclusions  #


![](https://secure.gravatar.com/avatar/922f86e5404970e513ffabee6f5a15e3?s=49&d=mm&r=g)
Author  [ automaticaddison
](https://automaticaddison.com/author/automaticaddison/) Posted on  [ June 14,
2021  October 11, 2022  ](https://automaticaddison.com/how-to-publish-wheel-
odometry-information-over-ros/) Categories  [ Robotics
](https://automaticaddison.com/category/robotics/) Tags  [ ground
](https://automaticaddison.com/tag/ground/)


Hey guys out there, with lovely help of ROSanswers I got into creating and
defining custom messages. My aim is to create a custom message which contains
of an array of vector3(). I basically got a couple of points, which i want to
publish in a single message. So I created a custom message which looks like:
geometry_msgs/Vector3[] Vector3DArray I was able to create a package with
catkin and I'm able to use the message. I got the following code: ... from
geometry_msgs.msg import Vector3 from vector_3_array.msg import Vector3DArray
... self.stelldaten = rospy.Publisher('Stelldaten', Vector3DArray,
queue_size=10) self.vectordaten_tabelle = Vector3DArray() ... vec3 = Vector3()
for i in range(0, self.anzahl_punkte): print 'Vektor ' + str(i) vec3.x =
self.q1_v[i] vec3.y = self.q2_v[i] vec3.z = self.tges[i] print vec3
self.vectordaten_tabelle.Vector3DArray.append(vec3) print self.q1_v print
self.q2_v print self.vectordaten_tabelle
self.stelldaten.publish(self.vectordaten_tabelle) So the problem right now is,
that self.vectordaten_tabelle has anzahl_punkte entries of vector3() (which is
perfect), but each entry gets overridden by the last vec3 which is added. Just
to show you an example: The prints in the for loop show smth like this: ...
Vektor 11 x: -35.2332092159 y: 2.95642070607 z: 0.057369297869 Vektor 12 x:
-29.4943008067 y: 3.36452718727 z: 0.0590352126953 Vektor 13 x: -29.4943008067
y: 3.36452718727 z: 0.0518744285557 Vektor 14 x: 0.0 y: 0.0 z: 0.0518744285557
But the self.vectordaten_tabelle looks like: ... x: 0.0 y: 0.0 z:
0.0518744285557 \- x: 0.0 y: 0.0 z: 0.0518744285557 \- x: 0.0 y: 0.0 z:
0.0518744285557 \- x: 0.0 y: 0.0 z: 0.0518744285557 Does somebody now what
exactly is going wrong here? Thanks alot in advance!


[ ](javascript:; "Share Article") [
](//www.rssing.com/contact.php?r=o6&u=%2F%2Fquestion1970.rssing.com%2Fchan-34075453%2Farticle33-live.html
"Article Support")


  * [ Contact Us  ](//www.rssing.com/contact.php)
    * [ Technical Support ](//www.rssing.com/contact.php)
    * [ Guest Posts/Articles ](//www.rssing.com/contact.php?r=o9)
    * [ Report Violations ](//www.rssing.com/contact.php)
    * [ Google Warnings ](//www.rssing.com/contact.php?r=o4)
    * [ Article Removal Requests ](//www.rssing.com/contact.php?r=o5_0)
    * [ Channel Removal Requests ](//www.rssing.com/contact.php?r=o5_0)
    * [ General Questions ](//www.rssing.com/contact.php?r=o8)
    * [ DMCA Takedown Notice ](//www.rssing.com/contact.php)


[ ↂ
](////starve149.rssing.com/chan-67795027/article12985.html#c67795027a12985i625842650
"Giant Crop Cheat Sheet")


[ ](javascript:; "Share Article") [
](//www.rssing.com/contact.php?r=o6&u=%2F%2Fquestion1970.rssing.com%2Fchan-34075453%2Farticle22-live.html
"Article Support")


92: Auto Variables, Part 1
](https://herbsutter.com/2013/06/05/gotw-92-auto-variables-part-1/)


August 14, 2014, 4:39 am


July 16, 2014, 11:52 am


Key parameters:


    /*
     * Automatic Addison
     * Date: May 20, 2021
     * ROS Version: ROS 1 - Melodic
     * Website: https://automaticaddison.com
     * Publishes odometry information for use with robot_pose_ekf package.
     *   This odometry information is based on wheel encoder tick counts.
     * Subscribe: ROS node that subscribes to the following topics:
     *  right_ticks : Tick counts from the right motor encoder (std_msgs/Int16)
     *
     *  left_ticks : Tick counts from the left motor encoder  (std_msgs/Int16)
     *
     *  initial_2d : The initial position and orientation of the robot.
     *               (geometry_msgs/PoseStamped)
     *
     * Publish: This node will publish to the following topics:
     *  odom_data_euler : Position and velocity estimate. The orientation.z
     *                    variable is an Euler angle representing the yaw angle.
     *                    (nav_msgs/Odometry)
     *  odom_data_quat : Position and velocity estimate. The orientation is
     *                   in quaternion format.
     *                   (nav_msgs/Odometry)
     * Modified from Practical Robotics in C++ book (ISBN-10 : 9389423465)
     *   by Lloyd Brombach
     */

    // Include various libraries
    #include "ros/ros.h"
    #include "std_msgs/Int16.h"
    #include <nav_msgs/Odometry.h>
    #include <geometry_msgs/PoseStamped.h>
    #include <tf2/LinearMath/Quaternion.h>
    #include <tf2_ros/transform_broadcaster.h>
    #include <cmath>

    // Create odometry data publishers
    ros::Publisher odom_data_pub;
    ros::Publisher odom_data_pub_quat;


#  [ Using custom messages in ROSAndroid
](//question1970.rssing.com/chan-34075453/article25-live.html)


##  Position info subscribing in C++  #


    MinimalPoseOdomSubscriber()
            : Node("zed_odom_pose_tutorial") {
            rclcpp::QoS qos(10);
            qos.keep_last(10);
            qos.best_effort();
            qos.durability_volatile();

            // Create pose subscriber
            mPoseSub = create_subscription<geometry_msgs::msg::PoseStamped>(
                        "pose", qos,
                        std::bind(&MinimalPoseOdomSubscriber::poseCallback, this, _1) );

            // Create odom subscriber
            mOdomSub = create_subscription<nav_msgs::msg::Odometry>(
                        "odom", qos,
                        std::bind(&MinimalPoseOdomSubscriber::odomCallback, this, _1) );
        }


[ _≪_ Previous: Custom message
](//question1970.rssing.com/chan-34075453/all_p2.html#c34075453a21 "Previous
Article")


comment-10992)

Re: “A Proposal for the World’s Dumbest Smart Pointer”

I’ve always wished the C++ language supported a simpler alternative syntax for
pointers:

        pointer<int> <--> int*
    pointer<const int> <--> const int *
    const pointer<int> <--> int * const
    const pointer<const int> <--> const int * const

this would make teaching pointer syntax to new developers much easier.

Obviously, we can add this as a language feature using

        template <typename T> struct pointer {
     typedef T* type;
    };
    pointer<int>::type

But this is not the same as a language feature. For example, the compiler
would not be able to compile the following code due to the templated function
parameter:

        template <typename T> void func(typename pointer<T>::type);
    int x;
    func(&x); //fails to compile

  34. ![](https://0.gravatar.com/avatar/66f79d8eeace7255925750593cf4e64f24063a6d5258ae4ea2c5419262ca3dce?s=48&d=identicon&r=G) **Jon** says:

[ 2013-06-05 at 6:00 pm  ](https://herbsutter.com/2013/06/05/gotw-91-solution-
smart-pointer-parameters/


comment-11588)

“What actual firm claim is being made here?”

Absent aliasing, which is a problem no matter which kind of pointer you are
using, and can’t be dealt with just by using a different kind of pointer, you
can be guaranteed that the object will be alive for as long as the function
call.

“When can it be relied on? How can we tell?”

It can be relied on as long as there is no aliasing of the pointer. As for how
you can tell, that’s going to require that you look at your program to see if
there is any aliasing going on.

  23. ![](https://2.gravatar.com/avatar/22cef4c4339ca700ce58fd79c311243f87ddd220788be7e1aa498621626bbb75?s=48&d=identicon&r=G) **earwicker** says:

[ 2013-06-21 at 5:27 am  ](https://herbsutter.com/2013/06/05/gotw-91-solution-
smart-pointer-parameters/


  Guru Questions

2\. What are the _correctness_ implications of the function declaration in


comment-10938)

For using “widget*” instead of “const shared_ptr&” guideline, what about
constructors taking a shared_ptr? Is it supposed to use shared_ptr by value
and move the incoming parameter to the member? Or take as a modifiable
reference and make copy out of it?

struct SomeStruct
{
shared_ptr memberPtr;

SomeStruct(const shared_ptr& in): memberPtr(in){}// <– this one?
Somestruct(shared_ptr in): : memberPtr(std::move(in)){}// <– or, this one?
Somestruct(shared_ptr& in): memberPtr(in){}// <– or, this one?
};

  55. ![](https://0.gravatar.com/avatar/63c8c0c83b832a29132a4c6ee5c6a8b18cf8ec6753e1bd3e0895c9e551fa3f4a?s=48&d=identicon&r=G) **David Oster** says:

[ 2013-06-05 at 7:52 am  ](https://herbsutter.com/2013/06/05/gotw-91-solution-
smart-pointer-parameters/


[ _≫_ Next: Custom classes in message files
](//question1970.rssing.com/chan-34075453/all_p2.html#c34075453a28 "Next
Article")


  (f) Passing shared_ptr& is useful for in/out shared_ptr manipulation.

    void f( shared_ptr<widget>& );  (f)

Similarly to (d), this should mainly be used to accept an in/out  shared_ptr
, when the function is supposed to actually modify the  shared_ptr  itself.
It’s usually a bad way to accept a  widget  , because it is restricted to a
particular lifetime strategy in the caller.

Note that per (e) we pass a  shared_ptr  by value if the function will share
ownership. In the special case where the function _might_ share ownership, but
doesn’t necessarily take a copy of its parameter on a given call, then pass a
const shared_ptr& to avoid the copy on the calls that don’t need it, and take
a copy of the parameter if and when needed.

> **Guideline:** Use a non-const **shared_ptr & ** parameter only to modify
> the **shared_ptr** . Use a **const shared_ptr & ** as a parameter only if
> you’re not sure whether or not you’ll take a copy and share ownership;
> otherwise use **widget*** instead (or if not nullable, a **widget & ** ).


In this tutorial, you will learn how to write a simple C++ node that
subscribes to messages of type ` geometry_msgs/PoseStamped ` and `
nav_msgs/Odometry ` to retrieve the position and the orientation of the ZED
camera in the ` Map ` and in the ` Odometry ` frames.


![Epsxe On-screen Gamepad skins \(For Android\)](//i.imgur.com/Oc5rtZR.jpg)


[ ](javascript:; "Share Article") [
](//www.rssing.com/contact.php?r=o6&u=%2F%2Fquestion1970.rssing.com%2Fchan-34075453%2Farticle27-live.html
"Article Support")


[ _≪_ Previous: Error in Importing Custom Message Types in a Python File in
Eclipse ](//question1970.rssing.com/chan-34075453/all_p2.html#c34075453a29
"Previous Article")


gedit ekf_odom_pub.cpp


[ ](javascript:; "Share Article") [
](//www.rssing.com/contact.php?r=o6&u=%2F%2Fquestion1970.rssing.com%2Fchan-34075453%2Farticle37-live.html
"Article Support")


[ ](javascript:; "Ouch") 0


[ ](javascript:;)


    #include <rclcpp/rclcpp.hpp>
    #include <rclcpp/qos.hpp>
    #include <nav_msgs/msg/odometry.hpp>
    #include <geometry_msgs/msg/pose_stamped.hpp>

    #include <tf2/LinearMath/Quaternion.h>
    #include <tf2/LinearMath/Matrix3x3.h>

    using namespace std::placeholders;

    #define RAD2DEG 57.295779513

    class MinimalPoseOdomSubscriber : public rclcpp::Node {
    public:
        MinimalPoseOdomSubscriber()
            : Node("zed_odom_pose_tutorial") {

            /* Note: it is very important to use a QOS profile for the subscriber that is compatible
             * with the QOS profile of the publisher.
             * The ZED component node uses a default QoS profile with reliability set as "RELIABLE"
             * and durability set as "VOLATILE".
             * To be able to receive the subscribed topic the subscriber must use compatible
             * parameters.
             */

            // https://github.com/ros2/ros2/wiki/About-Quality-of-Service-Settings

            rclcpp::QoS qos(10);
            qos.keep_last(10);
            qos.best_effort();
            qos.durability_volatile();

            // Create pose subscriber
            mPoseSub = create_subscription<geometry_msgs::msg::PoseStamped>(
                        "pose", qos,
                        std::bind(&MinimalPoseOdomSubscriber::poseCallback, this, _1) );

            // Create odom subscriber


[ ![People's Blog • Germany Bans the Number
44](//thepeoplescube.com/red/download/file.php?id=57239&sid=5e19e13fd670da65c8b6b496c0630b51)
](////political6769.rssing.com/chan-78425830/article66.html#c78425830a66i1994484930)


![](https://get-
help.robotigniteacademy.com/letter_avatar_proxy/v4/letter/w/9d8465/48.png)
w.ronaldo.cd:


#  Getting Started


    void goal_response_callback(const GoalHandleOdomRecord::SharedPtr & goal_handle)
    {
        // ...
    }


April 8, 2024, 1:08 pm


Skip to content


Copyright © 2024 Stereolabs Inc.


[ ↂ
](////metro2989.rssing.com/chan-40972540/article57410.html#c40972540a57410i495009908
"The Umbrella Academy’s Justin Min shares adorable first selfie with new
boyfriend")


If everything is working properly, you should see output when you type the
following in a new terminal window.


[ _≪_ Previous: rosserial_arduino Create custom messages from custom messages
](//question1970.rssing.com/chan-34075453/all_p2.html#c34075453a33 "Previous
Article")


[ ](//www.rssing.com/index.php?zw=2123 "Home") [ $ ](javascript:; "MoMoney")


Along with the node source code, you can find the ` package.xml ` and `
CMakeLists.txt ` files that complete the tutorial package.


[ _≫_ Next: custom message generation causes problems when compiling my code
](//question1970.rssing.com/chan-34075453/all_p2.html#c34075453a30 "Next
Article")


comment-10939)

I failed to use segments…

  54. ![](https://0.gravatar.com/avatar/c8088f2d382a9266927ac6db45d164fe38c29dbd92e1bff63f9f11484bf47d95?s=48&d=identicon&r=G) **[ zahirtezcan (@zahirtezcan) ](http://twitter.com/zahirtezcan) ** says:

[ 2013-06-05 at 7:56 am  ](https://herbsutter.com/2013/06/05/gotw-91-solution-
smart-pointer-parameters/


  Published by  Herb Sutter

Herb Sutter is an author and speaker, a software architect at Microsoft, and
chair of the ISO C++ standards committee. [ View all posts by Herb Sutter
](https://herbsutter.com/author/herbsutter/)

**Published** 2013-06-05  2013-12-03


###  [ Epsxe On-screen Gamepad skins (For Android)
](////ngemu1.rssing.com/chan-25253293/article13362.html#c25253293a13362i1209846253)


[ _≫_ Next: unable to read the data from micro controller on ROS
](//question1970.rssing.com/chan-34075453/all_p2.html#c34075453a23 "Next
Article")


comment-10971)

@Bret Kuhns: Raw pointers in modern C++ are not good (read: should not be
used) for anything else than that!

The problem with optional that it owns the object. The exact idea behind point
3a/b is that the function does not try to manage the lifetime. There you need
to have a non-owning reference: You can have reference semantics, use &, or if
it can be nullable, use a raw pointer.

  48. ![](https://2.gravatar.com/avatar/5848ae8b68c51aa5fdf3d2008974fb0b5c2f03dcb6b5a5d22379448722b08dfd?s=48&d=identicon&r=G) **[ Francis Rammeloo ](http://gravatar.com/stackedcrooked) ** says:

[ 2013-06-05 at 12:14 pm
](https://herbsutter.com/2013/06/05/gotw-91-solution-smart-pointer-
parameters/


comment-11857)

And again, refer to Herb’s section that spans “2. What are the correctness
implications… but in this respect it’s no different than any other aliased
object.)”

He is not talking at all about the internal state of the pointed-to object at
all. He’s talking only about “lifetime”, how it seems that “taking a copy of
the shared_ptr guarantees that the function itself holds a strong refcount on
the owned object, and that therefore the object will remain alive for the
duration of the function body, or until the function itself chooses to modify
its parameter.”

But he goes on: “However, we already get this for free… (except we don’t)” I
elided/paraphrased that last part, but quite adequately.

Hence just as there’s no need to mention threads, there’s also no need to
suppose some mutable state of the pointed-to object. The entire point here is
purely and only about the lifetime of the object, as controlled by the one-or-
more shared_ptrs that point to it.

To make this absolutely concrete: what if the pointed-to object is immutable?
Say we read a big map-of-strings-to-strings from a JSON file, and then
encapsulate it inside a Config class that only allows read access to the map.
This means that once loaded, we can safely share our single Config instance
around (between threads or otherwise) and know its contents won’t get mutated.
But we want it to be deleted when no longer in use. It’s a perfect application
for shared_ptr. Even though the Config is visible from multiple places, no one
can modify it, and so the only additional guarantee we need is that it won’t
get destroyed at the wrong time.

  17. ![](https://1.gravatar.com/avatar/15fd957a4ab2c9a249d6f8d9daceb90fe25bc313c9a8ad9d47b61a0477ea1b6d?s=48&d=identicon&r=G) **GregM** says:

[ 2013-07-04 at 10:28 am
](https://herbsutter.com/2013/06/05/gotw-91-solution-smart-pointer-
parameters/


= boost::tuples::tuple<:messageevent coop_est::featurebarray_>>>,
ros::MessageEvent  >>, ros::MessageEvent  , ros::MessageEvent  ,
ros::MessageEvent  , ros::MessageEvent  , ros::MessageEvent  ,
ros::MessageEvent  , ros::MessageEvent  , boost::tuples::null_type>, typename
message_filters::PolicyBase  ::M8Event = ros::MessageEvent  , typename
message_filters::PolicyBase  ::M7Event = ros::MessageEvent  , typename
message_filters::PolicyBase  ::M6Event = ros::MessageEvent  , typename
message_filters::PolicyBase  ::M5Event = ros::MessageEvent  , typename
message_filters::PolicyBase  ::M4Event = ros::MessageEvent  , typename
message_filters::PolicyBase  ::M3Event = ros::MessageEvent  , typename
message_filters::PolicyBase  ::M2Event = ros::MessageEvent  , typename
message_filters::PolicyBase  ::M1Event = ros::MessageEvent  >>, typename
message_filters::PolicyBase  ::M0Event = ros::MessageEvent  >>]’:
/opt/ros/hydro/include/message_filters/sync_policies/exact_time.h:130:5:
instantiated from ‘void message_filters::sync_policies::ExactTime  ::add(const
typename boost::mpl::at_c  ::Events, i>::type&) [with int i = 0, M0 =
coop_est::FeatureBArray_<:allocator>>, M1 = nav_msgs::Odometry_<:allocator>>,
M2 = message_filters::NullType, M3 = message_filters::NullType, M4 =
message_filters::NullType, M5 = message_filters::NullType, M6 =
message_filters::NullType, M7 = message_filters::NullType, M8 =
message_filters::NullType, typename boost::mpl::at_c  ::Events, i>::type =
ros::MessageEvent  >>]’
/opt/ros/hydro/include/message_filters/synchronizer.h:358:5: instantiated from
‘void message_filters::Synchronizer  ::cb(const typename boost::mpl::at_c
::type&) [with int i = 0, Policy =
message_filters::sync_policies::ExactTime<:featurebarray_>>,
nav_msgs::Odometry_<:allocator>>, message_filters::NullType,
message_filters::NullType, message_filters::NullType,
message_filters::NullType, message_filters::NullType,
message_filters::NullType, message_filters::NullType>, typename
boost::mpl::at_c  ::type = ros::MessageEvent  >>]’
/opt/ros/hydro/include/message_filters/synchronizer.h:290:5: instantiated from
‘void message_filters::Synchronizer  ::connectInput(F0&, F1&, F2&, F3&, F4&,
F5&, F6&, F7&, F8&) [with F0 = message_filters::Subscriber<:featurebarray_>>>,
F1 = message_filters::Subscriber<:odometry_>>>, F2 =
message_filters::NullFilter<:nulltype>, F3 =
message_filters::NullFilter<:nulltype>, F4 =
message_filters::NullFilter<:nulltype>, F5 =
message_filters::NullFilter<:nulltype>, F6 =
message_filters::NullFilter<:nulltype>, F7 =


[ Automatic Addison ](https://automaticaddison.com/) [ Proudly powered by
WordPress ](https://wordpress.org/)


January 15, 2015, 6:46 am


###  [ Last Day of Yangon Thingyan Festival Celebration 2014
](////myanmar19.rssing.com/chan-7313589/article889.html#c7313589a889i784670228)


###  [ Stay Salty POTS Awareness Stretchy Stacking Bracelets | Set of
Three|...
](////pomaces4.rssing.com/chan-3795444/article11960.html#c3795444a11960i1086411135)


  * [ Subscribe  ]() [ Subscribed  ]()

    * [ ![](https://secure.gravatar.com/blavatar/fe7f5b0b83dba894afe26c42bcab33fe2d1246d9730ef182c72c0bff0dc26acb?s=50&d=https%3A%2F%2Fs2.wp.com%2Fi%2Flogo%2Fwpcom-gray-white.png) Sutter’s Mill ](https://herbsutter.com)

Join 5,246 other subscribers

Sign me up

    * Already have a WordPress.com account? [ Log in now. ](https://wordpress.com/log-in?redirect_to=https%3A%2F%2Fr-login.wordpress.com%2Fremote-login.php%3Faction%3Dlink%26back%3Dhttps%253A%252F%252Fherbsutter.com%252F2013%252F06%252F05%252Fgotw-91-solution-smart-pointer-parameters%252F)

  *     * [ ![](https://secure.gravatar.com/blavatar/fe7f5b0b83dba894afe26c42bcab33fe2d1246d9730ef182c72c0bff0dc26acb?s=50&d=https%3A%2F%2Fs2.wp.com%2Fi%2Flogo%2Fwpcom-gray-white.png) Sutter’s Mill ](https://herbsutter.com)
    * [ Customize  ](https://herbsutter.wordpress.com/wp-admin/customize.php?url=https%3A%2F%2Fherbsutter.wordpress.com%2F2013%2F06%2F05%2Fgotw-91-solution-smart-pointer-parameters%2F)
    * [ Subscribe  ]() [ Subscribed  ]()
    * [ Sign up ](https://wordpress.com/start/)
    * [ Log in ](https://wordpress.com/log-in?redirect_to=https%3A%2F%2Fr-login.wordpress.com%2Fremote-login.php%3Faction%3Dlink%26back%3Dhttps%253A%252F%252Fherbsutter.com%252F2013%252F06%252F05%252Fgotw-91-solution-smart-pointer-parameters%252F)
    * [ Copy shortlink ](https://wp.me/peb5Y-xI)
    * [ Report this content ](https://wordpress.com/abuse/?report_url=https://herbsutter.com/2013/06/05/gotw-91-solution-smart-pointer-parameters/)
    * [ View post in Reader ](https://wordpress.com/read/blogs/3379246/posts/2090)
    * [ Manage subscriptions ](https://subscribe.wordpress.com/)
    * [ Collapse this bar ]()

![](https://pixel.wp.com/b.gif?v=noscript)


comment-13800)

I work a large project that has legacy going back to the ’80s. Some of the
code is Fortran, some C, but a large part is C++ and most of the new code is
C++.
Some of the C++ is in an old style and some has been updated to a more modern
style.

I come across a function with a pointer parameter:

        void DoSomethingAwesome(double *pVal);

Is this a modern “Non-owning raw * pointer”? or is this a legacy “bad_sink”
that should be updated?

If I’m lucky there is a comment somewhere that tells me, otherwise I need to
search into the .cpp file and decide if this is a bad_sink and perhaps update
it. (Of course pVal in this function could actually be used as an iterator
with some fun old school pointer math going on.)

It would be very nice if the language had a feature that allowed functions to
explicitly state “pass me a non-owning pointer”. As it is now all they can say
is “trust me, do I look like I might delete your non-owning raw pointer?”

  11. Pingback: [ C&B Background Reading, Part Deux | C++ and Beyond ](http://cppandbeyond.com/2013/12/06/cb-background-reading-part-deux/)

  12. ![](https://0.gravatar.com/avatar/928f5830f12d8977791539452bfc25c92912322476f0725253697ee1c45ce036?s=48&d=identicon&r=G) **[ Herb Sutter ](http://www.herbsutter.com) ** says:

[ 2013-12-03 at 8:51 am  ](https://herbsutter.com/2013/06/05/gotw-91-solution-
smart-pointer-parameters/


#  [ Android pubsub Listener custom message
](//question1970.rssing.com/chan-34075453/article27-live.html)


comment-11859)

Given that what you want is exactly what you get here, then we all agree.
Thanks for your time. Goodbye.

  16. ![](https://2.gravatar.com/avatar/22cef4c4339ca700ce58fd79c311243f87ddd220788be7e1aa498621626bbb75?s=48&d=identicon&r=G) **earwicker** says:

[ 2013-07-05 at 2:20 pm  ](https://herbsutter.com/2013/06/05/gotw-91-solution-
smart-pointer-parameters/


[ ](javascript:; "Like") 0


![JasperLoader Emerges, Targets Italy with Gootkit Banking
Trojan](//3.bp.blogspot.com/-PsLw92lxTvA/XMGnQCXq8uI/AAAAAAAABI4/KJ5XDuqo8PsOIDiWSJs9sqmx5UPuCaB5gCLcBGAs/s640/image36.png)


[ ↂ ](////nazam1.rssing.com/chan-8572938/article97.html#c8572938a97i52404577
"Ghafil Tujhe Gharyal Ye Deta Hai Manadi")


message_filters::NullType, message_filters::NullType,
message_filters::NullType, message_filters::NullType,
message_filters::NullType, message_filters::NullType>]’
/opt/ros/hydro/include/message_filters/synchronizer.h:268:5: instantiated from
‘void message_filters::Synchronizer  ::connectInput(F0&, F1&, F2&, F3&, F4&,
F5&) [with F0 = message_filters::Subscriber<:featurebarray_>>>, F1 =
message_filters::Subscriber<:odometry_>>>, F2 =
message_filters::NullFilter<:nulltype>, F3 =
message_filters::NullFilter<:nulltype>, F4 =
message_filters::NullFilter<:nulltype>, F5 =
message_filters::NullFilter<:nulltype>, Policy =
message_filters::sync_policies::ExactTime<:featurebarray_>>,
nav_msgs::Odometry_<:allocator>>, message_filters::NullType,
message_filters::NullType, message_filters::NullType,
message_filters::NullType, message_filters::NullType,
message_filters::NullType, message_filters::NullType>]’
/opt/ros/hydro/include/message_filters/synchronizer.h:261:5: instantiated from
‘void message_filters::Synchronizer  ::connectInput(F0&, F1&, F2&, F3&, F4&)
[with F0 = message_filters::Subscriber<:featurebarray_>>>, F1 =
message_filters::Subscriber<:odometry_>>>, F2 =
message_filters::NullFilter<:nulltype>, F3 =
message_filters::NullFilter<:nulltype>, F4 =
message_filters::NullFilter<:nulltype>, Policy =
message_filters::sync_policies::ExactTime<:featurebarray_>>,
nav_msgs::Odometry_<:allocator>>, message_filters::NullType,
message_filters::NullType, message_filters::NullType,
message_filters::NullType, message_filters::NullType,
message_filters::NullType, message_filters::NullType>]’
/opt/ros/hydro/include/message_filters/synchronizer.h:254:5: instantiated from
‘void message_filters::Synchronizer  ::connectInput(F0&, F1&, F2&, F3&) [with
F0 = message_filters::Subscriber<:featurebarray_>>>, F1 =
message_filters::Subscriber<:odometry_>>>, F2 =
message_filters::NullFilter<:nulltype>, F3 =
message_filters::NullFilter<:nulltype>, Policy =
message_filters::sync_policies::ExactTime<:featurebarray_>>,
nav_msgs::Odometry_<:allocator>>, message_filters::NullType,
message_filters::NullType, message_filters::NullType,
message_filters::NullType, message_filters::NullType,
message_filters::NullType, message_filters::NullType>]’
/opt/ros/hydro/include/message_filters/synchronizer.h:247:5: instantiated from


[ Browse latest ](//question1970.rssing.com/chan-34075453/index-latest.php) [
View live ](//question1970.rssing.com/chan-34075453/article21-live.html)


###  [ First Pictures of the Eclipse ! ! !
](////political6691.rssing.com/chan-78391714/article69.html#c78391714a69i1437484910)


If you get the same error during ` colcon build ... ` then post the complete
error here as code-block.