Transformation between two frames from unconnected trees
Hi: I want to transform a point from /map frame to /base_link.
I used the following method but it didn't work out:-
tf::TransformListener listener(ros::Duration(10));
geometry_msgs::PoseStamped map_pose, base_link_pose;
<---Input map_pose here-->
listener.transformPose("base_link", map_pose, base_link_pose);
Got the following error:-
terminate called after throwing an instance of 'tf::LookupException'
what(): Frame id /base_link does not exist! Frames (1):
Aborted
I double checked with tf tools and my tree is well connected, only thing is /map and /base_link are from two unconnected trees, I don't know why it says "Frame /base_footprint exists with parent NO_PARENT." although it exists (checked with rviz and "rosrun tf view_frames"), suddenly it starts publishing transformation (you can see below):
$ rosrun tf tf_echo map base_link
Failure at 450.800000000
Exception thrown:Could not find a connection between '/map' and '/base_link' because they are not part of the same tree.Tf has two or more unconnected trees.
The current list of frames is:
Frame /top_plate exists with parent /base_link.
Frame /back_sonar exists with parent /base_link.
Frame /base_link exists with parent /base_footprint.
Frame /front_sonar exists with parent /base_link.
Frame /base_link_left_hubcap exists with parent /base_link_left_wheel_link.
Frame /base_link_left_wheel_link exists with parent /base_link.
Frame /base_link_right_hubcap exists with parent /base_link_right_wheel_link.
Frame /base_link_right_wheel_link exists with parent /base_link.
Frame /base_scan_link exists with parent /laser_base_link.
Frame /laser_base_link exists with parent /top_plate.
Frame /odom exists with parent /map.
Frame /map exists with parent NO_PARENT.
Frame /base_caster_support_link exists with parent /base_link.
Frame /caster_wheel_link exists with parent /base_caster_support_link.
Frame /base_footprint exists with parent NO_PARENT.
At time 451.374
- Translation: [2.048, 0.805, 0.000]
- Rotation: in Quaternion [0.000, 0.000, -0.678, 0.735]
in RPY [0.000, 0.000, -1.491]
At time 451.924
- Translation: [2.048, 0.805, 0.000]
- Rotation: in Quaternion [0.000, 0.000, -0.678, 0.735]
in RPY [0.000, 0.000, -1.491]
At time 452.274
- Translation: [2.048, 0.805, 0.000]
- Rotation: in Quaternion [0.000, 0.000, -0.678, 0.735]
in RPY [0.000, 0.000, -1.491]
At time 452.874
- Translation: [2.048, 0.805, 0.000]
- Rotation: in Quaternion [0.000, 0.000, -0.678, 0.735]
in RPY [0.000, 0.000, -1.491]
At time 453.524
- Translation: [2.048, 0.805, 0.000]
- Rotation: in Quaternion [0.000, 0.000, -0.678, 0.735]
in RPY [0.000, 0.000, -1.491]
I googled this before asking on forum thinking that it is a basic question, should have been answered by now but no success.
Looking for help please. Thanks