ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
The issued is solved by add the type to subscribe(). Also, do not forget to add 'int i' to the assignment of callback().
void chatterCallback(const std_msgs::String::ConstPtr& msg, int i) {
ROS_INFO("I heard: [%s]", msg->data.c_str());
}
In main():
ros::Subscriber sub = n.subscribe<std_msgs::String>("chatter0", 1000, boost::bind(chatterCallback, _1, i));