Gazebo | Ignition | Community
Ask Your Question

Programmatically restart simulation with different object poses

asked 2017-05-21 13:45:37 -0500

hamzamerzic gravatar image

updated 2017-05-22 01:58:59 -0500

I am trying to create a reinforcement learning like simulation, where after each trial (episode) the simulation is restarted and the object pose is sampled from some initial pose distribution. I have tried to change the object pose by calling the /gazebo/set_model_state ROS service, but on the next simulation step, the pose changes back.

I have found a question that address the same issue that I have: but it does not work for me. I have a model with a link connected through a fixed joint and when I try to detach and re-attach the joint, it still does not work - the hand gets back to the previous state. I have tried both Model::SetLinkWorldPose() SetLinkWorldPose() and Model::SetLinkWorldPose() (for the base link), but it did not prevent the behavior.

What would be the best way to do this? I am using Gazebo 7 with ROS.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-06-27 14:26:09 -0500

JLiviero gravatar image

Have you tried Model::SetWorldPose() (as opposed to SetLinkPose())? Seems like it would be more effective than setting the position of an individual link. I know that method has worked for me personally, but your situation is a little different.

edit flag offensive delete link more


I haven't tried your recommendation. I will try it and post here. The solution that I went with in the end is to delete the model and then spawn it again at a new pose.

hamzamerzic gravatar imagehamzamerzic ( 2017-07-03 04:04:16 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-05-21 13:45:37 -0500

Seen: 341 times

Last updated: Jun 27 '17