ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
You need to provide more of your code. However, it appears to me that you misunderstand subscriptions.
That is, a topic is associated with a particular type of message; for instance, a geometry_msgs::Point
. The callback for a particular subscriber processes the specified type of message declared when the subscriber is instantiated (through a NodeHandle
). Typically, the code looks like this:
// this is NOT valid code!!! (e.g., no main()!)
ros::Subscriber m_sub;
ros::NodeHandle nh;
...
void pointCallback(const geometry_msgs::Point &point) {
// do something with point message
}
...
// topic: /some_point, message type: geometry_msgs::Point
// queue size: 1, callback method: pointCallback
m_sub = nh.subscribe<geometry_msgs::Point>("/some_point", 1, &pointCallback);
...
// begin processing messages
ros::spin();
It appears that you want to process two Point
s on one topic. ROS doesn't work that way.
You have multiple solutions, though. You could:
ApproximateTime
)Point
s (left as an exercise for the poster)If that doesn't help, again: post more of your code so that what you are attempting is (more) clear.