Restarting and modifying a world/model in gazebo

asked 2020-03-04 13:16:57 -0600

FranJRO gravatar image

Hi everyone again! I'm programing an reinforcemente learning aplication for a robot. I've crated the whole learning code, but I need one more thing to finish: restarting the world. I'm using the gazebo simulator, and when teh robot have achive its objetive, I have to change the world, I mean, reset the robot pose and change the obstacles poses randonly). I have found some solutions for changing the pose of the obstacles randonly (modifying the line with determines the pose of the obstacle in the xml file from c++ and strings, scan and thats stuff, I don't know if it is a good idea, could you tell me?). But for the pose reset of the robot I have no idea. I've looking for how to make a roslaunch of the .launch which contain the urdf model, the necesary nodes, etc, but from c++. But it could be slow doesn't it? Because it would have to re-open the simulator..

Please if you know or you have some information or advices I'll apreciate it so much. Thanks :)

edit retag flag offensive close merge delete



I think there is no such a thing as "Restarting the world" in Gazebo, in fact if you use the "restart" functionality of the GUI you will need to restart the rest of the ROS architecture. An approximated solution to the problem you stated would be to implement a World plugin, executing it every time the robot finish its tasks, setting the new pose of each model in the simulation enviroment.

Weasfas gravatar image Weasfas  ( 2020-03-05 05:12:14 -0600 )edit