Tf listener for navigation stack
Hello, I am a beginner in ROS and am using hector slam for a project. I have successfully implemented the mapping and am now working on the navigation stack. As my bot doesn't have a odom source, I am using the hector slam as a source of odom. The navigation stack as stated here http://wiki.ros.org/navigation/Tutorials/RobotSetup , requires both tf transforms and odom navmsgs. I am able to write a node to derive navmsgs from ppubodometry_topic of hector mapping but am stuck on how to derive the transforms from the following :
if (ppubmapodomtransform) { tf::StampedTransform odomto_base;
try
{
tf_.waitForTransform(p_odom_frame_, p_base_frame_, scan.header.stamp, ros::Duration(0.5));
tf_.lookupTransform(p_odom_frame_, p_base_frame_, scan.header.stamp, odom_to_base);
}
catch(tf::TransformException e)
{
ROS_ERROR("Transform failed during publishing of map_odom transform: %s",e.what());
odom_to_base.setIdentity();
}
map_to_odom_ = tf::Transform(poseInfoContainer_.getTfTransform() * odom_to_base.inverse());
tfB_->sendTransform( tf::StampedTransform (map_to_odom_, scan.header.stamp, p_map_frame_, p_odom_frame_));
}
How do I write a tf listener for this ? Thank You for your time, Regards - Apurv.
Asked by Apurv on 2020-04-16 03:48:20 UTC
Comments