ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I don't know about converting (as that would seem to violate semantics), but according to wiki/roscpp/Overview - Publishers and Subscribers - Subscribing to a Topic - Callback Signature, non-const callbacks are also fully supported:

You can also request a non-const message, in which case a copy will be made if necessary (i.e. there are multiple subscriptions to the same topic in a single node):

void callback(const boost::shared_ptr<std_msgs::String>&);
void callback(boost::shared_ptr<std_msgs::String>);
void callback(const std_msgs::StringPtr&);
void callback(const std_msgs::String::Ptr&);
void callback(std_msgs::StringPtr);
void callback(std_msgs::String::Ptr);
void callback(const ros::MessageEvent<std_msgs::String>&);