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/Tutori... , requires both tf transforms and odom nav_msgs. I am able to write a node to derive nav_msgs from p_pub_odometry_topic of hector mapping but am stuck on how to derive the transforms from the following :
if (p_pub_map_odom_transform_) { tf::StampedTransform odom_to_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.