Sending waypoints to move_base should be odom or map frame?
Hello,
I have some doubts about sending waypoints to /move_base. First, is it ok to send waypoints in map frame or should be always in odom frame.
Second: I'm trying to get the TF from map to odom, but I'm not sure how to do it.
If I do
map_point.header.stamp = ros::Time::now();
the code works, but I think the correct way should be:
odom_pose->header.stamp = ros::Time::now();
But if I do like this I just get the following message for ever:
[ WARN] [1684852027.274208035, 51.481000000]: Lookup would require extrapolation 0.298000000s into the past. Requested time 48.476000000 but the earliest data is at time 48.774000000, when looking up transform from frame [map] to frame [odom]
I'm using the following function:
geometry_msgs::PointStamped GpsWaypoints::MaptoOdom(geometry_msgs::PointStamped map_point, geometry_msgs::PointStamped* odom_pose)
{
geometry_msgs::PointStamped odom_point_output;
bool notDone = true;
tf::TransformListener listener; //create transformlistener object called listener
ros::Time time_now = ros::Time::now();
while(notDone)
{
try
{
map_point.header.stamp = ros::Time::now();
listener.waitForTransform("odom", "map", time_now, ros::Duration(3.0));
listener.transformPoint("odom", map_point, odom_point_output);
notDone = false;
}
catch (tf::TransformException& ex)
{
ROS_WARN("%s", ex.what());
ros::Duration(0.01).sleep();
//return;
}
}
return odom_point_output;
}