Error: "[Err] [Plugin.hh:212] Failed to load plugin libgazebo_x.so: libgazebo_x.so: cannot open shared object file: No such file or directory"

Hello! I have a question about the using the PX4-Autopilot package with the gazebo-classic simulator and ROS2 Foxy. In the github repository of the PX4-Autopilot package under this path “PX4-Autopilot/Tools/simulation/gazebo-classic/sitl_gazebo-classic/include” there are multiple gazebo plugins saved with the “.h” extension instead of the “.so” extension which gazebo plugins are usually saved with. When I run this command “./Tools/simulation/gazebo-classic/sitl_multiple_run.sh -t px4_sitl_rtps -m iris -n 2” to launch a gazebo simulation with two iris drone models, I get the error below which I think is due to the fact that the gazebo plugins used in the sdf file for the iris drone model have the “.so” extension instead of the “.h” extension.
Error:

“[Err] [Plugin.hh:212] Failed to load plugin libgazebo_gps_plugin.so: libgazebo_gps_plugin.so: cannot open shared object file: No such file or directory
[Err] [Plugin.hh:212] Failed to load plugin libgazebo_multirotor_base_plugin.so: libgazebo_multirotor_base_plugin.so: cannot open shared object file: No such file or directory
[Err] [Plugin.hh:212] Failed to load plugin libgazebo_motor_model.so: libgazebo_motor_model.so: cannot open shared object file: No such file or directory
[Err] [Plugin.hh:212] Failed to load plugin libgazebo_motor_model.so: libgazebo_motor_model.so: cannot open shared object file: No such file or directory
[Err] [Plugin.hh:212] Failed to load plugin libgazebo_motor_model.so: libgazebo_motor_model.so: cannot open shared object file: No such file or directory
[Err] [Plugin.hh:212] Failed to load plugin libgazebo_motor_model.so: libgazebo_motor_model.so: cannot open shared object file: No such file or directory
[Err] [Plugin.hh:212] Failed to load plugin libgazebo_groundtruth_plugin.so: libgazebo_groundtruth_plugin.so: cannot open shared object file: No such file or directory
[Err] [Plugin.hh:212] Failed to load plugin libgazebo_magnetometer_plugin.so: libgazebo_magnetometer_plugin.so: cannot open shared object file: No such file or directory”

I am new to using gazebo with PX4-Autopilot and I was wondering if I need to compile these plugins into “.so” files, and if so how do I it? Or am I doing this wrong and I need to approach it differently? Any help regarding this would be extremely useful.

I am using ubuntu 20.04.6 LTS, ROS2 Foxy and Gazebo-11. Thank you!

I guess you are using v1.13, right?

Did you go through the toolchain installation? And is the simple gazebo simulation working?

If so, then go through the multi vehicle simulation guide, you are probably missing some steps.

Thank you for a quick response, I really appreciate it. Yes I am using v1.13.3 and I managed to resolve the error by sourcing “setup_gazebo.bash” stored under “/PX4-Autopilot/Tools/simulation/gazebo-classic/setup_gazebo.bash”.
However, I am still not sure how I can interact with the iris models in the gazebo simulation after running the “./Tools/simulation/gazebo-classic/sitl_multiple_run.sh -t px4_sitl_rtps -m iris -n 2” command. For example, are there terminal commands to tell the iris models to takeoff? are there ros topics I can work with to interact with the models? How would go about using these iris models in a custom gazebo world? If there is any documentation that can help me find answers to these questions, it would be very helpful, because most of the documentation about using PX4 with Gazebo that I found are for ROS melodic and noetic, I couldn’t find any useful information for ROS2 distributions.

Again, thank you so much for your help!

Do you have any knowledge about MAVROS or microRTPS?

If not, please look into them, they both provides ROS 2 interfacing with PX4.

only for PX4 v1.14-beta: you can also look into XRCE-DDS

Thanks for sharing the documentations, I went through them and I have a few questions.

  1. If I am using the microRTPS bridge or the XRCE-DDS bridge do I still need mavros? (I know this question might be trivial but I want to make sure).

  2. Can I only use mavros by itself as the bridge between PX4 and ROS for ROS2 foxy, or do I need to use it with microRTPS or XRCE-DDS? (I used MAVROS with ROS melodic before, so I was wondering if the logic of its implementation with ROS2 is similar).

I am also having trouble finding information about how to set up the agent side of the microRTPS bridge, it would be helpful if you have some additional resources you can share. Thank you!