0
$\begingroup$

I am trying to use gz harmonic with ros2 humble, and I am stuck on rviz2 part. Gazebo and ros_gz_bridge are working well, and I am able to visualize the topics in rviz2 but not the model meshes. I am unable to use the sdf file (especially with the model mesh) to visualize in the rviz2. I am trying to do something similar like this

But meshes is not showing up in the rviz2, and instead, it gives the following error

[rviz2-3] [WARN] [1713168099.058171328] [sdformat_urdf]: SDFormat link [imu_link] has a <sensor>, but URDF does not support this
[rviz2-3] [WARN] [1713168099.058197635] [sdformat_urdf]: SDFormat link [camera_link] has a <sensor>, but URDF does not support this
[rviz2-3] [ERROR] [1713168099.084138711] [rviz2]: Error retrieving file [model://robot/meshes/base.stl]: Protocol "model" not supported or disabled in libcurl

Any idea how to modify the sdf file such that it can be used as a single file for gazebo and rviz2?

$\endgroup$

1 Answer 1

0
$\begingroup$

Yes, I had the same thing! Use the package keyword instead of model and redefine your relative path including the package. So

package://your_description_package/robot/meshes/base.stl

instead of

model://robot/meshes/base.stl

Then add or replace the items in your environment hooks with

prepend-non-duplicate;GZ_SIM_RESOURCE_PATH;@CMAKE_INSTALL_PREFIX@/share
$\endgroup$
3
  • $\begingroup$ In that case, it fails to load in gazebo [Err] [SystemPaths.cc:425] Unable to find file with URI [package://description_package/robot/meshes/base.stl] $\endgroup$
    – aarsht7
    Commented Apr 15 at 14:33
  • $\begingroup$ See my updated answer. You have to configure GZ_SIM_RESOURCE_PATH with not only your robot/meshes but with your entire package share directory. This may introduce some clutter for gazebo to find, but this way both rviz and gz will find all the necessary resources. $\endgroup$
    – Nyquist
    Commented Apr 15 at 15:19
  • $\begingroup$ Ah sorry, I made a mistake in the path. I ate away one entire folder. the path for me is following package://description_package/models/robot/meshes/base.stl. for me, GZ_SIM_RESOURCE_PATH is already added in the CMakeLists so it will be updated while building the package. But thanks for pointing it out. Might help someone else. $\endgroup$
    – aarsht7
    Commented Apr 15 at 15:25

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.