0
$\begingroup$

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!

$\endgroup$

1 Answer 1

0
$\begingroup$

Absolute path needs to begin with file:// so that Rviz gets it. As for package:// you got it right, Gazebo does not know about ROS packages.

You can use ament hooks to have Gazebo look inside ROS shares, see e.g what we did here: https://github.com/CentraleNantesRobotics/baxter_common_ros2/tree/master/baxter_description

$\endgroup$
1
  • $\begingroup$ Thank you for your help, the issue is resolved. $\endgroup$
    – niato axel
    Commented Oct 19 at 22:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.