Ask Your Question
0

How to respawn kobuki or turtlebot on Gazebo

asked 2019-01-17 06:32:27 -0500

poor_hirose gravatar image

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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-01-17 06:53:26 -0500

Delb gravatar image

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 ).

edit flag offensive delete link more

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?

poor_hirose gravatar imagepoor_hirose ( 2019-01-17 07:39:50 -0500 )edit

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

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

Delb gravatar imageDelb ( 2019-01-17 07:48:37 -0500 )edit

I made a mistake.

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

I can reset the map with this code.

Thank you!!

poor_hirose gravatar imagepoor_hirose ( 2019-01-18 01:49:45 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2019-01-17 06:32:27 -0500

Seen: 46 times

Last updated: Jan 17