How can we use a tf listener and message filter in one node?
I`m trying to get tf transform and sensor msgs from a rosbag. But I found the message filter with a call back function can only work outside the while loop, and tf transform can only work inside a while loop.
Is there any possible way to get tf and image_raw>
code:
void ImageCallback(const sensor_msgs::ImageConstPtr& msg){
std::string odom = "/odom";
std::string velo = "/velodyne";
tf::TransformListener listener;
tf::StampedTransform transform;
try {
listener.lookupTransform(odom, velo,
msg->header.stamp, transform);
std::cout << transform.stamp_ << std::endl;
std::cout << "img: " << msg->header.stamp << "\n";
}
catch (tf2::LookupException ex){
}
}
I plan to get the sensor_msg in the call back and use the timestamp to get the transform, but I can not get it. Is this way plausible?`