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

Set/Reset odometry values

asked 2020-11-18 02:30:22 -0600

Qilos gravatar image

Hello

Im currently trying to implement a navigation based on DRL with ros One of the inputs of my Network is the current distance to the goal

I randomly set 1 of 4 starting points and 1 of 3 goals

So while debugging i noticed that the distance to the goal got bigger with each episode.

I am getting the information about the current pose of the robot via the /odometry topic.

It seems the odometry topic does not reset when an episode ended and a new start pose is chosen That means the odometry topic calculates poses that are outside of my environment.

Does anyone know how i can reset the odometry in python so that it is set back to 0 when i start a new episode? Also is it possible to initialize a certain pose to the odometry topic so it knows it knows it doesnt start in (0,0) as well the direction it is moving?

edit retag flag offensive close merge delete

Comments

Hey i'm facing the same problem. How did you solve it ?

btech gravatar image btech  ( 2022-05-29 11:09:07 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-11-18 06:35:24 -0600

tryan gravatar image

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.

edit flag offensive delete link more

Comments

No i just wanted to find out how i can set or reset the odometry data the robot has accumulated after one episode

I also wanted the the odometry values to match the starting point of the robot. So if the starting point is (3,5) and the robot is facing south and moving the value of 5 should get smaller.

I managed to write a publisher that does that but its not working perfectly but i dont understand why

i wrote a while loop that awaits my input to execute one iteration in that loop i first set the robot to my desired pose and then i publish the x and y values as well as the orientation to the /odom topic

And then let it print the pose i set and the pose the odometry provides Most of the time the odometry topic has the correct value which ...(more)

Qilos gravatar image Qilos  ( 2020-11-18 07:59:17 -0600 )edit

Please, post the code for your odometry node.

tryan gravatar image tryan  ( 2020-11-18 13:12:37 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-11-18 02:30:22 -0600

Seen: 706 times

Last updated: Nov 18 '20