Hi,
I want to **calculate robot's current position with respect to the map**. Autonomous navigation of ROS works **fine**.
Following is my **"rosrun tf view_frames"**
[tf tree](http://answers.ros.org/upfiles/13988714412451395.jpg)
I have **tried following two commands which gives robot position?? And it works correctly**
rosrun tf tf_echo /map /base_link
rosrun tf tf_echo /odom /base_footprint
Code snippet used the **listen the transform** is given below::::::I have used this code **inside a nodelet's init()** method..Code ***compiled successfully***. transform and listener are made public class members.
while (nh.ok())
{
//tf::StampedTransform transform;
try
{
//ROS_INFO("Attempting to read pose...");
listener.lookupTransform("/map","/base_link",ros::Time(0), transform);
//listener.lookupTransform("/odom","/base_footprint",ros::Time(0), transform); //SECOND STATEMENT//
ROS_INFO("Got a transform! x = %f, y = %f",transform.getOrigin().x(),transform.getOrigin().y());
}
catch (tf::TransformException ex)
{
ROS_ERROR("Nope! %s", ex.what());
}
//rate.sleep();
}
**ERROR [lookupTransform.jpg](/upfiles/13990283806989855.jpg)**
Even if I try "**SECOND STATEMENT"(see code snippet)**, we get following error.
[ERROR] [1399027108.366171508]: Nope! Could not find a connection between '/odom' and '/base_footprint' because they are not part of the same tree.Tf has two or more unconnected trees.
[ERROR] [1399027108.366232448]: Nope! Could not find a connection between '/odom' and '/base_footprint' because they are not part of the same tree.Tf has two or more unconnected trees.
Thank you for any kind of help...................
**rxconsole OUTPUT [transform.jpg](/upfiles/13991314003247882.jpg) and "rosrun tf tf_echo /map /base_link" output** [map to base_link.jpg](/upfiles/1399131441608574.jpg)
↧