gazebosim / gz-sim

Open source robotics simulator. The latest version of Gazebo.
https://gazebosim.org
Apache License 2.0
695 stars 265 forks source link

System plugin tutorial not fully correct and incomplete; should refer to the template. #2072

Open jrutgeer opened 1 year ago

jrutgeer commented 1 year ago

I tried to compile a gz-sim system plugin outside the Gazebo source directory based on the tutorial, but it is incomplete and not fully correct, e.g.:

This should probably rather be add_library(SampleSystem SHARED SampleSystem.cc SampleSystem2.cc) https://github.com/gazebosim/gz-sim/blob/e19f26d429c00dedabd596cd82344dbaedad3cc0/tutorials/create_system_plugins.md?plain=1#L92

But also the gz_find_package commands are unknown, unless you figure out which packages to include so they are defined. https://github.com/gazebosim/gz-sim/blob/e19f26d429c00dedabd596cd82344dbaedad3cc0/tutorials/create_system_plugins.md?plain=1#L88

It took me a lot of trial and error to no avail.

In the end I realized that the ros_gz_project_template repository actually holds a nice and up to date example wrt building a system plugin.

Instead of changing this tutorial, I submitted this PR for an extra readme and clarification of the CMakeLists.txt file, as I think extra clarifications have a wider reach if included in that repository, compared to (only) being added to this tutorial.

For this tutorial, I think the best solution would be to update it to refer to the ros_gz_project_template repository:

In any case the tutorial should refer to the ros_gz_project_template repository.

Sebastian-Schroder commented 1 year ago

@jrutgeer I think the gz_find_package cmake command is added by the the gz-cmake3 package. you should be able to add them via

find_package(gz-cmake3 REQUIRED)

I just realised that you probably already knew that. but I'll keep the comment here for posterity reasons