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

Revision history [back]

You could do something like this:

void chatterCallback(const std_msgs::String::ConstPtr& msg)
 {
  my_function(msg);
 }

 void my_function(const std_msgs::String::ConstPtr& c)
 {
  ROS_INFO("I heard from my function: [%s]", c->data.c_str());
 }