ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

GAZEBO doesn't find mesh file in URDF.

asked 2022-02-26 09:04:47 -0500

joseecm gravatar image

In ROS2 I have created a python package called "mars_robot" which simply includes the URDF model of a robot and a "launch" file to start the simulation in Gazebo. This URDF model uses mesh files that are included with code lines like the following:

<mesh filename="package://meshes/base_link.stl" scale="0.001 0.001 0.001"/>

The URDF file is in a folder named "urdf" and mesh files are in a folder named "meshes" . Both are inside the package folders structure. Once I compile the package and asure that urdf an mesh files are in the corresponding folders of the package inside the "install" workspace folder I try to run the launch file but Gazebo is not able to load the mesh files because it doestn't find them. However, if in the lines of code where the mesh files are referenced I replace "package://" with "$(find mars_robot)/" then it works.

<mesh filename="$(find mars_robot)/meshes/base_link.stl" scale="0.001 0.001 0.001"/>

Why the code doesn't work using "package://"?

Thanks in advance for your help.

edit retag flag offensive close merge delete


What ROS2 version are you using?

andrestoga gravatar image andrestoga  ( 2022-11-28 13:55:53 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2023-02-13 01:18:54 -0500

I found that GAZEBO_MODEL_PATH should include the path that locates mars_robot. You need to add "export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:(path to mars_robot)" in ~/.bashrc file and source ~/.bashrc .

edit flag offensive delete link more

Question Tools



Asked: 2022-02-26 09:04:47 -0500

Seen: 1,830 times

Last updated: Feb 26 '22