Hi there. I'm trying to add external data in the callback function of subscriber. I have read somethings about that and the option is to use "boost::bind". I have developed this code but I get an error. Somebody can help me?
THIS IS THE CALLBACK FUNCTION:
void chatterCallback(const geometry_msgs::PoseStamped::ConstPtr& msg, int MY_NUMBER)
{
ROS_INFO_STREAM("Received pose: " << msg->pose.position.x);
cout<<"The number is= "<< MY_NUMBER <<endl;
}
AND THIS IS THE CALL:
int i=5;
ros::Subscriber sub = node.subscribe("/vrpn_client_node/irobot/pose", 1000, boost::bind(chatterCallback, _1, i));
P.S. I know that I can create a global variable of MY_NUMBER and it would works good. The variable: "MY_NUMBER" is just to give a trivial example. Thanks
Originally posted by Hector on ROS Answers with karma: 1 on 2016-12-21
Post score: 0