How to import plugins?

Hi i’m trying to simulate standard_vtol at Gazebo garden with several sensors(gps, magnetometer). Unfortunately i don’t know how to import those sensor’s plugins. currently using is PX4 v1.14.0, Gazebo garden, ros2 humble and Ubunto.

What i want to know about those plugin import line at sdf file

<plugin name='gz::sim::systems::Imu' filename='gz-sim-imu-system'/>
<plugin name='gz::sim::systems::AirPressure' filename='gz-sim-air-pressure-system'/>

First. why can’t i change plugin name freely? Everytime i changed name, error has occurred after turn on the sitl.
Second. what should i set plugin name and filename for using other plugins (like gps or magnetometer)?
I just find the plingin cpp files location at ~/PX4-Autopilot/Tools/simulation/gazebo-classic/sitl_gazebo-classic/src. however it doesn’t match to filename=‘gz-sim-imu-system’. so i wonder how can i know ‘filename’ of plugin and also plugin name?
Third. after modifiy plugin cpp in ~/PX4-Autopilot/Tools/simulation/gazebo-classic/sitl_gazebo-classic/src. how do i compile it?

1 Like


You can’t change the name freely because it refers to the class name and namespace of the gazebo plugin.
The name is similar to the include path you would write in a c++ file where you replace “/” with “::”,
for example for the IMU plugin :
in c++ : #include <gz/sim/systems/Imu.hh>
plugin name in sdf file : gz::sim::systems::Imu

To use other plugin you can see them here : Gazebo Sim: gz::sim::systems Namespace Reference

The plugin file you found at ~/PX4-Autopilot/Tools/simulation/gazebo-classic/sitl_gazebo-classic/src is for the old version of gazebo names gazebo classic

For compilation nothing change, just in case you write your own gazebo plugin, make sure it is located somewhere GAZEBO_PLUGIN_PATH is pointing at.

Thanks for comment!

I was trying to find plugin reference at 2.0.2 version which is uploaded at Gazebo main website, and there is no such info about PX4’s gazebo. Now i could find correct references with URL you provided. Thank you so much!!