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

resetting pose in odom

asked 2017-04-22 06:49:11 -0500

rsmitha gravatar image

updated 2017-04-22 16:37:50 -0500


I am running a simulation with jackal. I am performing some tests where I ask the jackal to run a certain distance, stop and return to (0,0). When I try to set the pose of the jackal in the odometry frame to (0,0), using /set_pose, the pose does not get reset. For example, after the robot moves for a distance of 10m, the position is (10.503, -0.0001). I want to have the robot's odometry position to be (0,0) and starting counting is position again from (0,0).

In other words, I want to be able to erase the sensor data from the odometry source in ROS for each run, so that for every run it can start as it does at startup. Is that possible through some parameters?

Please help. Regards, rsmitha.

edit retag flag offensive close merge delete


Suggestion: You could set the target pose in robots base frame instead odom, that is always relative to current position.

Humpelstilzchen gravatar image Humpelstilzchen  ( 2017-04-24 06:36:56 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-04-27 18:40:55 -0500

rsmitha gravatar image


Just to close the issue and inform others of the methods, if anyone else has the same requirements and are looking for answers:

I managed to reset the simulation, odom frame and the "ground-truth" (in this case, gazebo world frame) and get the odometry to forget its collected data and start from (0,0) for every iteration of the runs, by writing a bash script to cycle through the runs. The bash script restarts the simulation in a separate terminal and launches the application using rosrun in another terminal.

The gazebo topics such as "gazebo/reset_simulation" and "gazebo/reset_world" only seem to reset the pose of the robot in simulation. The word "reset" in these topics seems to be misleading because the rest of the factors/parameters such as odometry/sensor states do not get re-initialised with reset. In order to reset practically everything, ROS has to be stopped and restarted and there is no clean way to do this from within the application. The bash script seems to be the cleaner approach. Apart from this, there are methods where the launch files can be written to do the stop and start. However, if tests where multiple runs are being performed are being executed, the launch files would still need to be controlled from bash scripts or another application. Hope this helps !! Regards, rsmitha.

edit flag offensive delete link more


Cant accept my own answer :)

rsmitha gravatar image rsmitha  ( 2017-04-27 18:41:47 -0500 )edit

Is it possible to create a service to reset the sensor readings ? Not sure if that still lies in the tangibility without tampering the sensor.

Vignesh_93 gravatar image Vignesh_93  ( 2021-03-19 09:34:23 -0500 )edit


Can you maybe also put the bash script here ? Or any pointers on how to write a bash script of my own ?

Thanks in advance!

Sid05 gravatar image Sid05  ( 2022-05-24 07:33:41 -0500 )edit

Question Tools

1 follower


Asked: 2017-04-22 06:49:11 -0500

Seen: 2,096 times

Last updated: Apr 27 '17