Not receiving any callback for synchronized PointCloud2 and Robot EndpointState
I am trying to receive data from two different publishers as listed below-
- Message Type: baxter_core_msgs::EndpointState. Topic Name: /robot/limb/right/endpoint_state
- Message Type: sensor_msgs::PointCloud2. Topic Name: /kinect2/sd/points
Please see the code snippet below-
void DataCollector::callback(const baxter_core_msgs::EndpointStateConstPtr& ee_msg, const sensor_msgs::PointCloud2ConstPtr& pc_msg)
{
std::cout << "Solve all of perception here" << std::endl;
}
DataCollector::DataCollector()
{
ros::NodeHandle nh;
message_filters::Subscriber<baxter_core_msgs::EndpointState> baxter_arm_sub(nh, "/robot/limb/right/endpoint_state", 1);
message_filters::Subscriber<sensor_msgs::PointCloud2> point_cloud_sub(nh, "/kinect2/sd/points", 1);
TimeSynchronizer<baxter_core_msgs::EndpointState, sensor_msgs::PointCloud2> sync(baxter_arm_sub, point_cloud_sub, 100);
sync.registerCallback(boost::bind(&DataCollector::callback, this, _1, _2));
ros::spin();
}
Unfortunately, there is no callback received. I dig into the problem and noticed that baxter_core_msgs::EndpointState
message is being received in high frequency compared to sensor_msgs::PointCloud2
.
Plese see below the screenshot of the output of rostopic echo /robot/limb/right/endpoint_state|grep secs
and rostopic echo /kinect2/sd/points|grep secs
in respective terminals taken at the same time-