Skip to content

Commit

Permalink
tutorials/09_use_custom_engine: Add actual build and run instructions (
Browse files Browse the repository at this point in the history
…#689)

Signed-off-by: Martin Pecka <[email protected]>
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
Co-authored-by: Ian Chen <[email protected]>
  • Loading branch information
3 people authored Sep 16, 2024
1 parent 902824b commit 615afd9
Showing 1 changed file with 50 additions and 7 deletions.
57 changes: 50 additions & 7 deletions tutorials/09_use_custom_engine.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,56 @@ While we won't go into detail, here is an example to test our new

To get a more comprehensive view of how `EntityManagementFeatures` are constructed in TPE and Dartsim,
feel free to take a look here:
- Dartsim: [EntityManagementFeatures.hh](https://github.com/gazebosim/gz-physics/blob/ign-physics2/dartsim/src/EntityManagementFeatures.hh) and [EntityManagementFeatures.cc](https://github.com/gazebosim/gz-physics/blob/ign-physics2/dartsim/src/EntityManagementFeatures.cc)
- TPE: [EntityManagementFeatures.hh](https://github.com/gazebosim/gz-physics/blob/ign-physics2/tpe/plugin/src/EntityManagementFeatures.hh) and [EntityManagementFeatures.cc](https://github.com/gazebosim/gz-physics/blob/ign-physics2/tpe/plugin/src/EntityManagementFeatures.cc)
- Dartsim: [EntityManagementFeatures.hh](https://github.com/gazebosim/gz-physics/blob/main/dartsim/src/EntityManagementFeatures.hh) and [EntityManagementFeatures.cc](https://github.com/gazebosim/gz-physics/blob/main/dartsim/src/EntityManagementFeatures.cc)
- TPE: [EntityManagementFeatures.hh](https://github.com/gazebosim/gz-physics/blob/main/tpe/plugin/src/EntityManagementFeatures.hh) and [EntityManagementFeatures.cc](https://github.com/gazebosim/gz-physics/blob/main/tpe/plugin/src/EntityManagementFeatures.cc)

## Compile and run the example

Clone the source code, create a build directory and use `cmake` to compile the code:

```bash
git clone https://github.com/gazebosim/gz-physics
cd gz-physics/examples/simple_plugin
mkdir build
cd build
cmake ..
# Linux
cmake --build . --target PluginTest
# Windows
cmake --build . --target PluginTest --config Release
```

Run the test to verify the new physis plugin:

```bash
# Linux
./PluginTest

# Windows
.\Release\PluginTest.exe
```

You'll see:

```bash
$ ./PluginTest
Created empty world!
```

Once you implement more features, you could try passing `SimplePlugin` as the physics engine
to Gazebo Sim following \ref physicsengine "Use different physics engines" tutorial, e.g. setting

# Linux
export GZ_SIM_PHYSICS_ENGINE_PATH=$GZ_SIM_PHYSICS_ENGINE_PATH:$(pwd)/build
# Windows
set GZ_SIM_PHYSICS_ENGINE_PATH=<PATH_TO_THE_EXAMPLE_DIR>\build\Release

And run Gazebo sim with

## Load and test
gz sim -v4 -s --physics-engine SimplePlugin

Please follow the previous tutorial \ref installation "Installation" to build
`gz-physics` from source again for our new feature to be compiled.
However, with the poor one feature we have implemented in this tutorial, you will only see an error,
because Gazebo Sim needs much more features:

Now we can load the new physics plugin named `gz-physics-tpe-plugin`
to test it on Gazebo by following this \ref physicsengine "Use different physics engines" tutorial.
[error] [Physics.cc:854] No physics plugins implementing required interface found in library
[D:\programming\gz9-ws\gz-ws\src\gz-physics\examples\simple_plugin\build\Release\SimplePlugin.dll].

0 comments on commit 615afd9

Please sign in to comment.