Gazebo doesn't look at GAZEBO_PLUGIN_PATH when loading a model via ROS2 service "spawn_entity"
Hello,
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 libgazebo_ros_factory.so
It launches the sim with no problems.
Then to spawn the drone I use : ros2 run gazebo_ros spawn_entity.py -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/libgazebo_motor_model.so: libphysics_msgs.so: cannot open shared object file: No such file or directory
So I checked the path of plugins : echo $GAZEBO_PLUGIN_PATH
/usr/lib/x86_64-linux-gnu/mavlink_sitl_gazebo/plugins:/usr/lib/x86_64-linux-gnu/gazebo-11/plugins:/home/chris/sitl_gazebo/build:
Then after searching and try things I figured out that "libphysics_msgs.so" is in "/home/chris/sitl_gazebo/build" directory. And i changed the path in order to have this directory in first like this :
/home/chris/sitl_gazebo/build:/usr/lib/x86_64-linux-gnu/mavlink_sitl_gazebo/plugins:/usr/lib/x86_64-linux-gnu/gazebo-11/plugins:
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
# SITL GAZEBO
export GAZEBO_PLUGIN_PATH=$HOME/sitl_gazebo/build:${GAZEBO_PLUGIN_PATH}
# GAZEBO
. /usr/share/gazebo/setup.sh
# MAVLINK
. /usr/share/mavlink_sitl_gazebo/setup.sh
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.