ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
You can reference the path to the mesh file in several ways.
This works with RVIZ and GAZEBO:
<mesh filename="file://$(find my_package)/meshes/mesh_file"/>
This work with RVIZ but not for GAZEBO:
<mesh filename="package://my_package/meshes/mesh_file"/>
For GAZEBO other way is including the path in the environment variable GAZEBO_MODEL_PATH. For that you can use the EXPORT command in the command line or include the following code to your launch file.
import os
from ament_index_python import get_package_prefix
pkg_share_path = os.pathsep + os.path.join(get_package_prefix(package_name), 'share')
if 'GAZEBO_MODEL_PATH' in os.environ:
os.environ['GAZEBO_MODEL_PATH'] += pkg_share_path
else:
os.environ['GAZEBO_MODEL_PATH'] = pkg_share_path
See this post I wrote for more information.