0
$\begingroup$

I have an issue spawning my URDF model in gazebo. It works fine in rviz but when I launch it in gazebo the model shows up in model parameters but I don't get any visuals.

Screenshot

My theory is that since gazebo converts URDF to SDF when spawning, the path pointing to the model changes in from.

In my code (URDF):

 <visual>
  <origin
    xyz="0 0 0"
    rpy="0 0 0" />
  <geometry>
    <mesh
      filename="package://diff_drive/meshes/visual/casterWheelLeft.STL" />
  </geometry>
  <material
    name="">
    <color
      rgba="0.752941176470588 0 0 1" />
  </material>
</visual>

In Gazebo:

Gazebo

This is my full code: github.com/drec0xy/diff_drive

I'm using ROS2 Humble and Gazebo 11.

To reproduce the error add the package in a colcon work space and build using colcon, run the launch file: launch.py

$\endgroup$
0

2 Answers 2

2
$\begingroup$

If you replace all the mesh filenames from:

filename="package://diff_drive/meshes/visual/casterWheelLeft.STL"

to

filename="file://$(find diff_drive)/meshes/visual/casterWheelLeft.STL"

and also remove the following line from the launch file:

os.environ['GAZEBO_MODEL_PATH'] = os.path.join(get_package_share_directory(package_name),'meshes','visual')

I think gazebo was just not able to load the mesh files, since you can see the center of masses, inertias, wireframes, but only the model was not visible (you can see those using the view option in gazebo GUI).

Additionally, raise the spawning z-coordinate.

$\endgroup$
1
  • $\begingroup$ Thank y'all very much for taking time to look at my issue I really appreciate. $\endgroup$
    – drec0xy
    Jan 5 at 21:26
0
$\begingroup$

I could solve the issue by adding this line to package.xml

<export>
<build_type>ament_python</build_type>
<gazebo_ros gazebo_model_path = "/home/drec0xy/willa_bot/install/diff_drive/share/"/> <!--line added-->
$\endgroup$

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.