Plugin to connect Rodos topics and Gazebo topics on Linux. This allows "Software in the Loop"-testing for RODOS components by simulating interaction with simulated hardware in Gazebo. Gazebo simulates environments, robot hardware and sensors.
In your existing RODOS components that you want to test, replace the Topic
instances
that you want to share with Gazebo with GazeboTopic
instances. E.g
Topic<int> exampleTopic(1, "example");
would become
GazeboTopic<int> exampleTopic(1, "example");
You can also use a preprocessor macro:
#define Topic GazeboTopic
When a RODOS component writes to that topic, the value will be published to a Gazebo topic with the same name.
On the other hand, if a RODOS component wants to read a topic from Gazebo, you need to create a GazeboTopic with the same name and type as the original Gazebo topic and create a RODOS Subscriber for it.
Finally, for Gazebo to load your code you need to create a shared library that links to the rodos_plugin and include that library in the world file (line 168). See the example for an illustration on how to use the plugin.
You also need something that handles messages and controls the model on the Gazebo side that were send by your RODOS components. See the Gazebo model plugin tutorial and the cessna example plugin for more information.
- Install Gazebo 9+.
- Checkout the Gazebo Rodos Plugin repository as a dependency of your project using git.
- Download the RODOS dependency with the following command in the cloned repository:
git submodule update --init
- Modify your CMakeLists.txt according to the provided example CMakeLists.txt.
- Create a build folder
mkdir build
- Change to the build folder
cd build
- Initialize the cmake project
cmake ..
- Build the plugins
This will build RODOS and the two plugins and place them in the build folder.
cmake --build .
Configure cmake to build the example:
cmake -DBUILD_GAZEBO_RODOS_PLUGIN_EXAMPLE=ON ..
Make sure that the paths to the libraries in the world file and in the model file are correct. E.g. you might need to change
<plugin name="rodosPlugin" filename="cmake-build-debug/libexample.so"/>
to point to the library you built:
<plugin name="rodosPlugin" filename="build/libexample.so"/>
Then you can use the run_example target in the example to build the example and start Gazebo:
cmake --build . --target run_example