Unable to lookup transform
Using this code
geometry_msgs::PoseStamped current_position()
{
tf::TransformListener my_temp_listener;
geometry_msgs::PoseStamped pose;
pose.header.stamp = ros::Time::now();
pose.header.frame_id = "/base_link";
pose.pose = pose_zero;
my_temp_listener.waitForTransform("map", "/base_link", ros::Time(0), ros::Duration(3.0));
tf::StampedTransform my_transform;
my_temp_listener.lookupTransform("/map","/base_link",ros::Time(0), my_transform);
my_temp_listener.transformPose("map", pose, pose);
return pose;
}
I get terminate called after throwing an instance of tf::ExtrapolationException
what(): Unable to lookup transform, cache is empty, when looking up transform from frame [/base_link] to frame [/map] at runtime.
However, looking at the frames using rosrun tf tf_echo /base_link /map I correctly get
At time 1400687504.239
- Translation:
[-8.817, 0.695, 0.000]
- Rotation:
- in Quaternion
[0.000, 0.000, 0.097, 0.995]
- in RPY
[0.000, -0.000, 0.194]
Thank you!
- in Quaternion