ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

TF Lookup working with ros::Time(0) but not ros::Time::now()?

asked 2013-07-15 11:13:26 -0500

cmdli gravatar image

First off, the code:

tf::TransformListener listener;
tf::StampedTransform transform;
try {
  ros::Time now = ros::Time::now(); //The changing code

  ROS_INFO("Waiting for transform...");
  listener.waitForTransform("/base_footprint", "/map",
                          now, ros::Duration(5.0));

  ROS_INFO("Looking up transform...");
  listener.lookupTransform("/base_footprint", "/map",
                           now, transform);
}
catch(tf::TransformException ex) {
  ROS_ERROR("%s", ex.what());
  return 1;
}

This code is supposed to lookup the current position of the robot. However, when I run the code as is, I get the error:

[ INFO] [1373921514.306158805]: Waiting for transform...
[ INFO] [1373921514.316335148, 908.830000000]: Looking up transform...
[ERROR] [1373921514.316529725, 908.830000000]: Frame id /base_footprint does not exist! Frames (1):

If I change the marked Time to ros::Time(0), as so:

ros::Time now = ros::Time(0);

the code works fine. Why? What difference does it make?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2013-07-15 17:42:48 -0500

lindzey gravatar image

updated 2013-07-15 22:01:17 -0500

weiin gravatar image

Not an answer, but hopefully a pointer to an answer:

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-07-15 11:13:26 -0500

Seen: 6,127 times

Last updated: Jul 15 '13