I'm having some trouble getting TF to convert a point from /base_link frame
to /map frame. I made a function for it, shown below, based on code in the
TF tutorials:
geometry_msgs::PointStamped baseToMapFrame(geometry_msgs::PointStamped p)
{
tf::TransformListener TFlistener(ros::Duration(1.0)); //Used for
listening to transforms
geometry_msgs::PointStamped q;
try{
ros::Time now = ros::Time::now();
geometry_msgs::PointStamped p,q;
p.header.frame_id = "/base_link";
p.header.stamp = ros::Time(0);
TFlistener.transformPoint("/map",p,q);
} catch (tf::TransformException ex){
ROS_ERROR("%s",ex.what());
}
return q;
}
The error message I get when running is:
[ERROR] [1287786203.075208516, 13.800000000]: Frame id /map does not exist!
When trying to transform between /base_link and /map.
This is even after initializing the map frame with AMCL. Strangely, if I do
tf_echo to see if TF knows this conversion, I get:
$ rosrun tf tf_echo /map /base_link
Failure at 75.200000000
Exception thrown:Frame id /map does not exist! When trying to transform
between /base_link and /map.
The current list of frames is:
At time 76.100
- Translation: [46.885, 45.869, 0.000]
- Rotation: in Quaternion [0.000, 0.000, 1.000, -0.022]
in RPY [0.000, -0.000, -3.097]
At time 77.200
- Translation: [46.885, 45.869, 0.000]
- Rotation: in Quaternion [0.000, 0.000, 1.000, -0.022]
in RPY [0.000, -0.000, -3.097]
Any thoughts on what might be happening? It seems that tf_echo fails on the
first try but succeeds later on.
Help is appreciated.
--
View this message in context:
http://ros-users.122217.n3.nabble.com/Trouble-converting-points-with-TF-tp1755749p1755749.html
Sent from the ROS-Users mailing list archive at Nabble.com.