What is the meaning of ConstPtr& in ROS callbacks?

D
5 min readApr 11, 2021
Example of a callback in the AMCL source code: https://github.com/ros-planning/navigation/blob/kinetic-devel/amcl/src/amcl_node.cpp

The idea of a ConstPtr& may seem convoluted and therefore, confusing but fret not, for there is actually a pretty intuitive reasoning behind its use. The idea of callbacks in ROS refers to function which perform computation on a set of data. Imagine a robot with multiple callbacks to the same topic, and multiple topics. Now further imagine that some of these callbacks are dealing with data which are…

--

--

D

An aspiring Robotics Researcher. I am currently in my 4th year of undergraduate studies. I am working on optimising the ROS navigation packages. Follow 4 more!