I want to access images and ultrasound reading from my ardrone parrot. To get readings in synchronized way i tried using message filter with approximate time policy.
image_transport::SubscriberFilter sub(it_,"/out_resize", 110);
message_filters::Subscriber<ardrone_autonomy::navdata_altitude> altitude_sub(nh,
"/ardrone/navdata_altitude", 100);
sync_policies::ApproximateTime<sensor_msgs::Image,ardrone_autonomy::navdata_altitude> MySyncPolicy;
Synchronizer sync(MySyncPolicy(200),sub,altitude_sub);
sync.registerCallback(boost::bind(&VideoSource::callback,this, _1, _2));
Callback function
void VideoSource::callback(const sensor_msgs::ImageConstPtr& img_msg,const ardrone_autonomy::navdata_altitude::ConstPtr &msg)
{
fprintf(stderr,"inside\n");
alti_raw=*msg;
img = *img_msg;
is_frame_available = true;
}
This callback is only called once even though I am receiving continuous messages on both the topics. The difference between timestamps is around 100ms.
Can anyone tell me why this callback is getting called only once..
Originally posted by ayush_dewan on ROS Answers with karma: 1610 on 2013-06-09
Post score: 1
Original comments
Comment by ayush_dewan on 2013-06-09:
@sergey_alexandrov Thanks a lot man..declaring sync in constructor was the problem..
Comment by sergey_alexandrov on 2013-06-10:
You may close the question so as to remove it from the "Unanswered" list and improve the overall statistics :)