How to reset the /odom topic to 0 pose?

asked 2020-04-23 11:08:07 -0500

kane_choigo gravatar image

updated 2020-04-23 21:05:38 -0500

Hello, I'm using ROS melodic and Kinetic with Ubuntu 18.04 and 16.04.

I'm practically trying to make the framework of a mobile robot's navigation with Deep Reinforcement Learning and it is imperative to make the mobile robot's /odom information be reset every new episode.

I did it following below codes:

    reset_proxy = rospy.ServiceProxy('gazebo/reset_simulation', Empty)

    rospy.wait_for_service('gazebo/reset_simulation')
    try:
        reset_proxy()
    except (rospy.ServiceException) as e:
        print("gazebo/reset_simulation service call failed")

And here is the weird problem arises, when I tried it with turtlebot3_burger, the /odom topic has been reset to 0 poses (that is, [x, y, z, roll, pitch, yaw] = [0,0,0,0,0,0] ) without any problem.

However, when I tried with turtlebot2_kobukiwhich has Asus Xtion camera and Hokuyo LiDAR sensor, it's /odom have not been reset 0.

Strictly, both are re-spawned to 0 poses with the above code, but only in the case of turtlebot2_kobuki, the /odom is not be reset to 0 poses! (I mean, it seems the mobile robot be re-spawned to 0 poses in GUI display, but just the odom topic still returns not reset messages. )

Just so you know, the reason why I'm trying to make the mobile robot be reset is that it has to be restarted when it collided with something ( obstacles or wall or human, etc) because the mobile robot failed to navigate to the goal point, according to related papers. (the final purpose is to get the ideal policy to navigate to the goal point without a collision as possible. This policy is something different from amcl-path planning, and I'd like to execute the self-navigation with that.)

I also have tried everything I can, but I literally have no idea now, how to fix it.

To be short, what I want to do is to make /odom publisher in gazebo-simulation publish the reset /odom topic when the reset_proxy is called.

If anyone is familiar with this kind of works, would you please give me helpful advice?

I have a feeling that any of your simple opinions must be a great help to me.

Thanks in advance. :)

edit retag flag offensive close merge delete

Comments

It seems like a poorly designed system if it has to start at 0 each time. You may consider redesigning your system so that assumption isn’t held.

stevemacenski gravatar image stevemacenski  ( 2020-04-23 12:19:13 -0500 )edit

could not just publish a blank odom message?

LukeBowersox gravatar image LukeBowersox  ( 2020-04-23 12:38:56 -0500 )edit

@stevemacenski@LukeBowersox Thanks for your quick reply. Now I noticed that my question would have been ambiguous rather. So I updated just now.

Just so you know, the reason why I'm trying to make the mobile robot be reset is that it has to be restarted when it collided with something ( obstacles or wall or human, etc) because the mobile robot failed to navigate to the goal point, according to related papers. (the final purpose is to get the ideal policy to navigate to the goal point without a collision as possible. This policy is something different from amcl-path planning, and I'd like to execute the self-navigation with that.)

kane_choigo gravatar image kane_choigo  ( 2020-04-23 21:08:44 -0500 )edit

@kane_choigo hello, did you find the solution for your problem ? Because i have the same problem as yours. If you found it, could you help me please ?

menes gravatar image menes  ( 2021-05-11 13:59:25 -0500 )edit

hello @menes did you find the solution to your problem ? I have the same problem

btech gravatar image btech  ( 2022-05-29 11:18:44 -0500 )edit