ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I don't know all of the details, so forgive me if I misinterpret your question. I'm assuming the robot and goal are where you expect them to be, but the odometry does not match your expectations. By definition, odometry always starts at (0, 0) as it measures how far the robot has moved. It doesn't sound like odometry is really what you're after.
To get the robot's distance from something in a world frame, say map
, I would use a tf listener. If the goal has its own frame in the tf tree, you can get the transform between the goal and robot directly. If the goal is just a known point in the map
frame, you can get the transform between the robot and map
frames, then calculate the distance from the robot's pose to the goal location.
That said, if you do want to deal with odometry, it's not clear what you're trying to achieve. I assume you want something to publish manipulated values, though there may be a simpler solution if you explain more about your use case (what's publishing odometry, what's consuming it, how you're starting a new episode, etc.).
If you want to manipulate the odometry values and republish them on another topic, one option is to use a transform
node from topic_tools
, which would allow you to add an offset (or otherwise manipulate) the odometry message and republish it.