Skip to content

Added reset simulation tutorial #1824

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tutorials.md.in
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Gazebo @GZ_DESIGNATION_CAP@ library and how to use the library effectively.
* \subpage spherical_coordinates "Spherical coordinates": Working with latitude and longitude
* \subpage python_interfaces Python interfaces
* \subpage headless_rendering "Headless rendering": Access the GPU on a remote machine to produce sensor data without an X server.
* \subpage reset_simulation Reset simulation

**Migration from Gazebo classic**

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions tutorials/reset_simulation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
\page reset_simulation Reset simulation

The Reset Gazebo transport API is exposed to allow resetting simulation to time zero.
It's possible to call this API using the command line or through the GUI.
In addition to the API, we have also expanded the simulation system API with a Reset interface.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there limitations to the Reset system - are there known things that might have trouble being reset?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mjcarroll, when you implemented this feature, do you consider any limitations ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe that there are any major limitations with systems implementing the reset interface. They should have full access to the ECM functionality.

Systems that you may want to implement reset for are typically things that have a lot of loaded assets. This prevents having to reload those assets, and instead allow for a "warm" reboot of the system.


# Reset interface

System authors may now choose to implement the Reset interface to have a more intelligent
reset process (avoiding reloading assets or regenerating scene graphs being the motivating examples).
Since this interface is opt-in, systems that don't implement the API will still be reset via destruction and reconstruction.
The physics and rendering systems are the first two to implement this optimized reset functionality, with more to come as it makes sense to.

Following the tutorial \subpage createsystemplugins we should implement `ISystemReset` interface.

# Transport API

To call the reset transport API we should call the service `/world/default/control` and fill the request message type
`gz.msgs.WorldControl`, this service return a `gz.msgs.Boolean` with the status of the reset (true is everything was fine, false otherwise)

The `WorldControl` message now contains a reset field that we should filled if we want to reset the world:

```bash
gz service -s /world/default/control --reqtype gz.msgs.WorldControl --reptype gz.msgs.Boolean --timeout 3000 --req 'reset: {all: true}'
```

# GUI

We included a new button in the `World Control` plugin allowing to reset the simulation from the GUI

@image html files/reset_simulation/reset_button.gif