Home | Tutorials | Wiki | Issues
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hello, first I suspect that if you want to reset the world and models you should look at the World class Reset not the Model class Reset. If that does not work you can reset the world using the world_control gazebo topic, this should reset your robot models to the initial positions as well as reset the simulation, but does not reset joint commands.

E.g. supposing you have already run the transport and initialized a node

-Create a publisher for your message:

gazebo::transport::PublisherPtr reset_pub; reset_pub=node->Advertise<gazebo::msgs::worldcontrol>("~/world_control");

-Create a message and set it to indicate what you want yo control:

gazebo::msgs::WorldControl w_ctrl; w_ctrl.mutable_reset()->set_all(true); //I believe this is equal to indicating a world reset reset_pub->Publish(w_ctrl);

BTW I'm evolving controllers for robot locomotion too.

Hello, first I suspect that if you want to reset the world and models you should look at the World class Reset not the Model class Reset. If that does not work you can reset the world using the world_control gazebo topic, this should reset your robot models to the initial positions as well as reset the simulation, but does not reset joint commands.

E.g. supposing you have already run the transport and initialized a node

-Create a publisher for your message:

gazebo::transport::PublisherPtr reset_pub; reset_pub;

reset_pub=node->Advertise<gazebo::msgs::worldcontrol>("~/world_control");

-Create a message and set it to indicate what you want yo control:

gazebo::msgs::WorldControl w_ctrl; w_ctrl;

w_ctrl.mutable_reset()->set_all(true); //I believe this is equal to indicating a world reset reset

reset_pub->Publish(w_ctrl);

BTW I'm evolving controllers for robot locomotion too.

Hello, first I suspect that if you want to reset the world and models you should look at the World class Reset not the Model class Reset. If that does not work you can reset the world using the world_control gazebo topic, this should reset your robot models to the initial positions as well as reset the simulation, but does not reset joint commands.

E.g. supposing you have already run the transport and initialized a node

-Create a publisher for your message:

gazebo::transport::PublisherPtr reset_pub;

reset_pub=node->Advertise<gazebo::msgs::worldcontrol>("~/world_control");

-Create a message and set it to indicate what you want yo control:

gazebo::msgs::WorldControl w_ctrl;

w_ctrl.mutable_reset()->set_all(true); //I believe this is equal to indicating a world reset

reset_pub->Publish(w_ctrl);

BTW I'm evolving controllers for robot locomotion too.