I’m using ROS 2 Humble and having an issue with my URDF. The links of my robot defined using STL files are not showing up in Gazebo, although they display correctly in RViz.
Here are the details of my problem:
- Links created with predefined shapes (e.g.,
box
,cylinder
) show up fine in Gazebo. - However, links that are defined using STL files with the
<mesh>
tag do not appear in Gazebo. There are no errors when running the node the robot state publisher and the spawner.
In my URDF, I'm using the following to load the STL files:
<mesh filename="package://pizibot_description/meshes/chassis.stl" scale="0.001 0.001 0.001"/>
I suspect that Gazebo is not finding my ROS package. I tried using the absolute path with this syntax:
<mesh filename="$(find pizibot_description)/meshes/left_wheel.stl" scale="0.001 0.001 0.001"/>
When using the absolute path, all the links display correctly in Gazebo. However, this causes an issue in RViz, and I get the following error:
Errors loading geometries:
- for link 'left_wheel':
Could not load mesh resource '/home/axel/ROS/pizi_ws/install/pizibot_description/share/pizibot_description/meshes/left_wheel.stl'
It seems there is a problem with the path or resource resolution between Gazebo and RViz. The package containing my models and URDF files can be found here: pizibot_description GitHub Repository.
Any advice on how to fix this issue so that STL files are properly displayed in both Gazebo and RViz?
Note: I am correctly sourcing my workspace before running any commands:
source ~/ROS/pizi_ws/install/setup.bash
Is there any specific path I need to add somewhere so that Gazebo can find my ROS packages?
Also I’ve already done simulations with robots using predefined shapes, but this is my first time writing URDFs with meshes, so the issue might be caused by a beginner mistake 😅. Thanks in advance for your help!