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

Revision history [back]

Quick question: is the code you posted in your question inside a callback? If so, you need to not create the TransformListener object inside of it. Try making it a member variable if it's a class or a global variable otherwise and see if that helps.

If it doesn't, then there might be one or two other issues (at least that I noticed). Here's what I did:

  1. Stripped your launch file down to just the static_transform_publisher
  2. Opened up a console and started a roscore
  3. Opened up another console and launched your file
  4. Opened up two more consoles and echoed your /pose and /odom topics.
  5. Opened up a final console and echoed the tf topic.

Here's what I found:

  1. The time stamps between your pose, odom, and tf world->map transforms were all sufficiently small.
  2. Your /pose topic has no frame_id. Not sure how you're getting your pose_world object above, but you might want to check that.

So, without running your whole system, my best guess is that something is blocking the processing of your incoming data, i.e., you get a pose message, but then a large amount of time passes before you attempt to transform it, at which point the transforms are too old. Try doing what I suggested above with your TransformListener (assuming this is in a callback) and also adding a frame_id to your /pose topic.

Quick question: is the code you posted in your question inside a callback? If so, you need to not create the TransformListener object inside of it. Try making it a member variable if it's a class or a global variable otherwise and see if that helps.

If it doesn't, then there might be one or two other issues (at least that I noticed). Here's what I did:

  1. Stripped your launch file down to just the static_transform_publisher
  2. Opened up a console and started a roscore
  3. Opened up another console and launched your file
  4. Opened up two more consoles and echoed your /pose and /odom /pose and /odom topics.
  5. Opened up a final console and echoed the tf topic.
  6. Did rosbag play bagfile.bag --clock -r 0.01.
  7. I then waited for the pose message to get updated, paused the playback, and looked at your available transforms from the tf topic.

Here's what I found:

  1. The time stamps between your pose, odom, and tf world->map transforms were all sufficiently small.
  2. Your /pose /pose topic has no frame_id. frame_id. Not sure how you're getting your pose_world pose_world object above, but you might want to check that.

So, without running your whole system, my best guess is that something is blocking the processing of your incoming data, i.e., you get a pose message, but then a large amount of time passes before you attempt to transform it, at which point the transforms are too old. Try doing what I suggested above with your TransformListener (assuming this is in a callback) and also adding a frame_id to your /pose topic.