Gazebo doesn't look at GAZEBO_PLUGIN_PATH when loading a model via ROS2 service "spawn_entity"

asked 2020-12-18 04:16:00 -0500

Kreace gravatar image


I'm having an issue with Gazebo and ROS2, it is related to GAZEBO_PLUGIN_PATH, i found quite a lot of post here about problems around this environment variable but they didn't resolve my problem. Here it is :

I work with Gazebo 11.3.0, ROS2 Foxy and PX4 Firmware (master and sitl_gazebo). I would like to launch a Gazebo simulation, then spawn a typhoon_h480 drone.

To do that I use :gazebo --verbose -s It launches the sim with no problems.

Then to spawn the drone I use : ros2 run gazebo_ros -entity DRONE -file models/typhoon_h480/typhoon_h480.sdf -x 0 -y 0 -z 0.2 in the "sitl_gazebo" directory.

Here I get theses errors :

[Err] [Plugin.hh:178] Failed to load plugin /usr/lib/x86_64-linux-gnu/mavlink_sitl_gazebo/plugins/ cannot open shared object file: No such file or directory

So I checked the path of plugins : echo $GAZEBO_PLUGIN_PATH


Then after searching and try things I figured out that "" is in "/home/chris/sitl_gazebo/build" directory. And i changed the path in order to have this directory in first like this :


And here it works, so what I understand is that gazebo doesn't look at all the directories when the ROS2 service is called. It only look at the first one I guess.

To complete my question I set the GAZEBO_PLUGIN_PATH in my ".bashrc" like this :

# ROS2
source /opt/ros/foxy/setup.bash
. /usr/share/gazebo/
. /usr/share/mavlink_sitl_gazebo/

I only put here what I think it was necessary but they are other environment variables that I set here.

So I hope you have all infos and you can help me, thanks in advance for reading all of this.

edit retag flag offensive close merge delete