I have a Gazebo Garden simulation and I struggle to make it work with Gazebo plugins for the URDF file.
Context
I have a URDF file of my robot, but I first could not find an obvious way to make it work in Gazebo Garden, so I created a simplified SDF version of the robot.
I first made the simulation work with an SDF file for the robot, but I could not get it to work with the robot_state_publisher. I could not find any example of how to publish the robot_description and the tf from Gazebo directly so I could use it without launching the robot_state_publisher manually through a ROS 2 launch file. (I wanted to avoid this as then I needed to recreate my SDF file as URDF file to give it to the state publisher node.
I then figured out how to use the URDF version of my model and I made a launch file that loads the URDF of the robot and gives it to Gazebo. The simulation launches fine, the robot model is there, and I can use the robot_state_publisher to get the proper tf of the robot and the robot_description.
BUT: I fail to load any plugins written inside the URDF file since I can't find any examples on how to do this.
Current state
I found this comment that I could load the plugins the same way as I would in the classic Gazebo: https://github.com/gazebosim/ros_gz/issues/109
I receive the following error messages related to my problem:
[ruby $(which gz) sim-1] [Wrn] [SystemPaths.cc:168] Finding plugins using deprecated IGN_ prefixed environment variable [IGN_GAZEBO_SYSTEM_PLUGIN_PATH]. Please use the GZ_ prefix instead.
[ruby $(which gz) sim-1] [Err] [SystemLoader.cc:118] Failed to load system plugin: (Reason: Could not find shared library)
[ruby $(which gz) sim-1] - Requested plugin name: [camera_controller]
[ruby $(which gz) sim-1] - Requested library name: [libgazebo_ros_camera.so]
[ruby $(which gz) sim-1] - Library search paths:
[ruby $(which gz) sim-1] - /home/leo/.gz/sim/plugins/
[ruby $(which gz) sim-1] - /usr/lib/x86_64-linux-gnu/gz-sim-7/plugins/
[ruby $(which gz) sim-1] - /home/leo/.ignition/gazebo/plugins/
[ruby $(which gz) sim-1] - /
[ruby $(which gz) sim-1] - /home/leo/ros2_ws/install/sdformat_urdf/lib/
[ruby $(which gz) sim-1] - /home/leo/ros2_ws/install/ros_gz_sim/lib/
[ruby $(which gz) sim-1] - /home/leo/ros2_ws/install/ros_gz_bridge/lib/
[ruby $(which gz) sim-1] - /home/leo/ros2_ws/install/ros_gz_interfaces/lib/
[ruby $(which gz) sim-1] - /opt/ros/humble/lib/x86_64-linux-gnu/
[ruby $(which gz) sim-1] - /opt/ros/humble/lib/
[ruby $(which gz) sim-1] - (Deprecated) /
[ruby $(which gz) sim-1] - (Deprecated) /home/leo/ros2_ws/install/sdformat_urdf/lib/
[ruby $(which gz) sim-1] - (Deprecated) /home/leo/ros2_ws/install/ros_gz_sim/lib/
[ruby $(which gz) sim-1] - (Deprecated) /home/leo/ros2_ws/install/ros_gz_bridge/lib/
[ruby $(which gz) sim-1] - (Deprecated) /home/leo/ros2_ws/install/ros_gz_interfaces/lib/
[ruby $(which gz) sim-1] - (Deprecated) /opt/ros/humble/lib/x86_64-linux-gnu/
[ruby $(which gz) sim-1] - (Deprecated) /opt/ros/humble/lib/
Maybe the following information is important to know:
When I set the variable GZ_SIM_RESOURCE_PATH, it did not work, I also had to set the variable IGN_GAZEBO_RESOURCE_PATH for Gazebo to be able to load the robot model as URDF.
What I need
I need examples of how to add different sensors to my URDF (actually the XACRO) file. I want to add the differential drive controller to move the robot, a regular RGB camera, a depth camera and a LiDAR. They all work fine in the SDF file, but I do not know how to translate them into the URDF file.
I am using ROS 2 Humble with Gazebo Garden inside a Docker container.
My Files
My files are available for inspection on GitHub: https://github.com/Dave-van-der-Meer/leorover_gazebo_sim_docker
The latest changes are on the "add_sensors_to_URDF" branch.