Robotics StackExchange | Archived questions

How to respawn kobuki or turtlebot on Gazebo

I'm trying reinforcement learning on Gazebo. If robot hit the wall,bumper sensor reaction. So, I wanna respawn robot in start position. Sorry my poor English.Do you have any idea?

Asked by poor_hirose on 2019-01-17 07:32:27 UTC

Comments

Answers

There is a service available to do this, all you have to do is call it with :

rosservice call /gazebo/reset_simulation "{}" 

Just note that if you use AMCL or gmapping you will have to reset those nodes too, the service will only reset the robot in the gazebo world (so in case of gmapping that won't reset the map ).

Asked by Delb on 2019-01-17 07:53:26 UTC

Comments

Thank you! It can work in terminal.

I want to do the script in Python.I tried the following code:

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

but robot doesn't reset the map.

How can I run it in Python?

Asked by poor_hirose on 2019-01-17 08:39:50 UTC

The type isn't Empty but std_srvs/Empty so that should be :

service = rospy.ServiceProxy('/gazebo/reset_simulation', std_srvs.srv.Empty)

Asked by Delb on 2019-01-17 08:48:37 UTC

I made a mistake.

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

I can reset the map with this code.

Thank you!!

Asked by poor_hirose on 2019-01-18 02:49:45 UTC