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

URDF robot model not loading correctly in Gazebo

asked 2021-11-17 08:06:32 -0500

ljaniec gravatar image


I tried to learn ROS2 Galactic and Navigation2 stack use through this repository:

Especially package nav2_simple_commander later, but I have problems already at the start.

When I prepare a setup as in the instructions:

## Create a workspace
mkdir -p colcon_ws/src
cd colcon_ws/src

## Get the demo code
git clone

## Get the dependencies not shipped with Galactic at June 8, 2021.
vcs import . < nav2_rosdevday_2021/deps.repos
cd ../

## Install dependencies which are shipped with Galactic at June 8, 2021.
rosdep install --from-path src --ignore-src -r -y

## Build the workspace
source /opt/ros/galactic/setup.bash
colcon build

I can start my simulation through:

source colcon_ws/install/setup.bash

ros2 launch nav2_rosdevday_2021 # launches simulation, rviz, nav2

source colcon_ws/install/setup.bash

python3 colcon_ws/src/nav2_rosdevday_2021/nav2_rosdevday_2021/scripts/

Gazebo starts, but the robot model isn't showing up (the LiDAR still shows though, like the robot is invisible) in the world. It is still on the world's model list too.

I tried to change the robot model from mp_400 to other from the same package (e.g. mpo_700, in the launcher file) but then there isn't even a LiDAR and Gazebo doesn't show it on the list of models in the world.

I have added in .bashrc this line:

export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/home/ljaniec/ros2_ws/install/aws_robomaker_small_warehouse_world/share/aws_robomaker_small_warehouse_world/worlds:/home/ljaniec/ros2_ws/install/aws_robomaker_small_warehouse_world/share/aws_robomaker_small_warehouse_world/models:/home/ljaniec/ros2_ws/install/neo_simulation2/share/neo_simulation2/robots:/home/ljaniec/ros2_ws/install/neo_simulation2/share/neo_simulation2/models:/opt/ros/galactic/share/turtlebot3_gazebo/models:/home/ljaniec/.gazebo/models

But it seems that the URDF model isn't working with Gazebo - it has no error, I checked it with gz sdf -p mp_400.urdf.

How could I solve this problem of invisible AMR in the Gazebo simulation? Why my attempt at changing the robot model failed even worse?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2022-04-25 12:12:15 -0500

shonigmann gravatar image

This is a bit of an old question, but I figured I'd add some feedback in case others come across this issue.

gz sdf -p mp_400.urdf would tell you if the URDF to SDF conversion has any issues (e.g. mismatched tags), but won't let you know if Gazebo server / client has everything it needs to actually load the resultant SDF file (e.g. it won't check to make sure the mesh URIs can be resolved to actual valid files).

The Gazebo client and server logs (~/.gazebo/clientXXXXX/default.log and ~/.gazebo/serverXXXXX/default.log) will usually indicate what the issue is a bit more clearly than what you'll see in the terminal. If the LIDAR is showing up but the robot body isn't, it is very likely that you will find error messages saying that the meshes from the mpo_XXX robot cannot be found. The exact error message should tell you where Gazebo is trying to look and will give a clearer idea of where the issue is. It is likely that package://neo_simulation2/robots/mp_400/meshes/ is not resolving to the correct path.

Another small note re the GAZEBO_MODEL_PATH - this is only used for SDF files with accompanying model.config files. Adding a path with only URDF files (e.g. /home/ljaniec/ros2_ws/install/neo_simulation2/share/neo_simulation2/robots) won't help Gazebo find things. In fact, you'll actually see errors in the server log saying that the model.config can't be found for each of the sub-folders in the path.

edit flag offensive delete link more


Thank you for your comments, I can accept this as an answer - that's probably what happened.

ljaniec gravatar image ljaniec  ( 2022-04-26 02:47:03 -0500 )edit

Question Tools

1 follower


Asked: 2021-11-17 08:06:32 -0500

Seen: 1,000 times

Last updated: Apr 25 '22