Skip to content
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

Restructure TPE related tutorials #419

Merged
merged 4 commits into from
Sep 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions examples/simple_plugin/EntityManagementFeatures.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ using namespace gz;
using namespace physics;
using namespace simpleplugin;

//! [code]
/////////////////////////////////////////////////
Identity EntityManagementFeatures::ConstructEmptyWorld(
const Identity &, const std::string &_name)
{
// Generate dummy identity
return this->GenerateIdentity(0);
}
//! [code]
3 changes: 2 additions & 1 deletion examples/simple_plugin/EntityManagementFeatures_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "EntityManagementFeatures.hh"

// Simple executable that loads the simple plugin and constructs a world.

//! [code]
struct TestFeatureList : gz::physics::FeatureList<
gz::physics::simpleplugin::EntityManagementFeatureList
> { };
Expand Down Expand Up @@ -58,3 +58,4 @@ int main(int argc, char *argv[])

return 0;
}
//! [code]
2 changes: 2 additions & 0 deletions examples/simple_plugin/plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include "EntityManagementFeatures.hh"

//! [code]
namespace gz {
namespace physics {
namespace simpleplugin {
Expand All @@ -45,3 +46,4 @@ namespace simpleplugin {
}
}
}
//! [code]
2 changes: 1 addition & 1 deletion tutorials.md.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Gazebo @GZ_DESIGNATION_CAP@ library and how to use the library effectively.
6. \subpage physicsconcepts "Gazebo Physics simulation concepts"
7. \subpage createphysicsplugin "Implement a physics feature"
8. \subpage createcustomfeature "Implement a custom feature"
9. \subpage setupphysicsenginetpe "Use custom engine with Gazebo Physics"
9. \subpage usecustomengine "Use custom engine with Gazebo Physics"

## License

Expand Down
282 changes: 0 additions & 282 deletions tutorials/09-set-up-physics-engine-tpe.md

This file was deleted.

16 changes: 9 additions & 7 deletions tutorials/09_use_custom_engine.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
\page setupphysicsenginetpe Use a custom engine with Gazebo Physics
\page usecustomengine Use a custom engine with Gazebo Physics

## Prerequisites

- \ref installation "Installation"
- \ref physicsplugin "Understand physics plugin"
- \ref physicsengine "Use different physics engines"
- \ref loadplugin "Load physics plugin"
- \ref implementcustomfeature "Implement custom feature"
- \ref pluginloading "Load physics plugin"
- \ref createcustomfeature "Implement custom feature"

## How to interface with physics engine

Expand Down Expand Up @@ -72,7 +72,7 @@ simple_plugin
└── EntityManagementFeatures_TEST.cc
```

### `plugin.cc`
### plugin.cc

In this tutorial, we will show how to construct a simple simulation world using
[TPE](https://github.com/gazebosim/gz-physics/tree/main/tpe) physics
Expand All @@ -83,7 +83,9 @@ named `EntityManagementFeatureList` defined in `EntityManagementFeatures.hh`.
We first include the `EntityManagementFeatureList` in `plugin.cc` main file
and register the example TPE physics plugin as follow:

\snippet examples/simple_plugin/plugin.cc

\snippet examples/simple_plugin/plugin.cc code


Those are 3 things needed to be specified in `plugin.cc`:
- Define the conclusive \ref gz::physics::FeatureList "FeatureList" including
Expand Down Expand Up @@ -139,7 +141,7 @@ custom feature with \ref gz::physics::FeaturePolicy3d "FeaturePolicy3d"

Then we can go ahead with the implementation of `ConstructEmptyWorldFeature`:

\snippet examples/simple_plugin/EntityManagementFeatures.cc
\snippet examples/simple_plugin/EntityManagementFeatures.cc code

Here we show the overriding of `ConstructEmptyWorld` member function of
\ref gz::physics::ConstructEmptyWorldFeature "ConstructEmptyWorldFeature",
Expand All @@ -152,7 +154,7 @@ Simple unit tests are good practice for sanity checks.
While we won't go into detail, here is an example to test our new
\ref gz::physics::ConstructEmptyWorldFeature "ConstructEmptyWorldFeature":

\snippet examples/simple_plugin/EntityManagementFeatures_TEST.cc
\snippet examples/simple_plugin/EntityManagementFeatures_TEST.cc code

To get a more comprehensive view of how `EntityManagementFeatures` are constructed in TPE and Dartsim,
feel free to take a look here:
Expand Down