message_filters doesn't call the callback function
I gonna synchronize an image by its camera_info. The code is attached, after finishing constructor, it just stays without going to the callback function. I have tried different QoS, made sure topics are published, ...
OverheadCamNode::OverheadCamNode(rclcpp::NodeOptions options): Node("overhead_camera_node", options){
message_filters::Subscriber<sensor_msgs::msg::Image> overhead_cam1_sub_(this, "/image",
rmw_qos_profile_sensor_data);
message_filters::Subscriber<sensor_msgs::msg::CameraInfo> camera_info_sub_(this, "/camera_info",
rmw_qos_profile_sensor_data);
typedef message_filters::sync_policies::ApproximateTime<sensor_msgs::msg::Image ,
sensor_msgs::msg::CameraInfo> approximate_policy;
message_filters::Synchronizer<approximate_policy> syncApproximate(approximate_policy(10),
overhead_cam1_sub_, camera_info_sub_);
syncApproximate.registerCallback(std::bind(&OverheadCamNode::synchronized_images_callback,
this,std::placeholders::_1, std::placeholders::_2));
RCLCPP_INFO(this->get_logger(), "Constructor");
}
void OverheadCamNode::synchronized_images_callback(
const sensor_msgs::msg::Image::ConstSharedPtr image_1,
const sensor_msgs::msg::CameraInfo::ConstSharedPtr cam_info) {
RCLCPP_INFO(this->get_logger(), "in CB");
}
Unfortunately, I don't think there is enough information to answer here. A few questions:
ros2 topic info -v /image
andros2 topic info -v /camera_info
to get that information.