Unable to lookup tf transform
Hi,
I'm unable to lookup tf transforms in my C++ node for some reason, unless the parent and child are the same. I have done this many times before and checked with the tutorials and wikis but am not having any luck. The tf tree displays fine in RVIZ as well as command line with the tf_echo. I've tried multiple different rosbags that worked fine in other ROS nodes but nothing is working with this node.
What is different is that this time I am working with a ROS package where there are no classes, everything is in functions but I don't think that should matter because that is how the tutorial is done.
Here is a code snippet:
void laserCloudHandler(const sensor_msgs::PointCloud2ConstPtr &laserCloudMsg) {
tf::TransformListener tf_listener;
if (tf_listener.waitForTransform("world", "velodyne_frame", laserCloudMsg->header.stamp, ros::Duration(0.2))) {
// Get the tf transform.
tf::StampedTransform tf_transform;
tf_listener.lookupTransform(world_frame, velo_frame, laserCloudMsg->header.stamp, tf_transform);
}
else
{
ROS_FATAL("UNABLE TO LOOKUP INITIAL TRANSFORM!");
}
}
Does anyone have any idea what may be wrong?
Thanks!
@gvdhoorn thanks for fixing that formatting, i couldn't get it to work