Rosanswers logo

Hi all, I'm having what appears to be a problem among several users: using roslaunch to open a world file in Gazebo. Like others who have asked, I've carefully gone through several tutorials, including "Using roslaunch to start Gazebo, world files and URDF models".

In general everything works normally. I'm using OS X (El Capitan) with ROS Jade and Gazebo version 8.

Carefully following the tutorial listed above, I've created the packages and directory structure that is needed. I have a "TestRobot_ws" workspace that contains the packages "TestRobot_description" (with the directories "meshes" and "urdf") and TestRobot_gazebo" (with the directories "launch", "models" and "worlds"). The appropriate files are in each directory.

In a terminal I "source /opt/ros/jade/setup.bash". Then I cd into the TestRobot_ws directory and "source devel/setup.bash". Because the collada model for my world file is in the TestRobot_gazebo/models directory, I "export GAZEBO_MODEL_PATH=~/devel/TestRobot_ws/src/TestRobot_gazebo/models:$GAZEBO_MODEL_PATH".

If I cd into the TestRobot_gazebo directory and "gazebo worlds/TestRobot.world", gazebo will start my world file and display its collada file.

If I "roslaunch TestRobot_gazebo TestRobot.launch", Gazebo will start. My robot model is correctly spawned into Gazebo, but my world file is NOT correctly displayed. The collada model is not visible. However, if I look at the left pane of the Gazebo UI, in the "models" section of the "worlds" tab my collada model is listed (along with it's link), as well as the ground object and my spawned robot model.

I've spent several days trying many suggestions and tutorials. Nothing so far has worked. I'm wondering if it is a pathing issue. If I "echo $GAZEBO_MODEL_PATH" it returns ~devel/TestRobot_ws/src/TestRobot_gazebo/models: (which is correct). "ROSPACK LIST" returns TestRobot_description and TestRobot_gazebo, so it sees the packages.

In short: Gazebo will correctly launch and display the collada model in the world file. But using ROSLAUNCH and the launch file does not display the collada file (although it is listed in the "models" section of the "worlds" tab in the Gazebo UI left panel).

Thoughts/ideas/suggestions??? There is probably a simple answer, but I cannot figure it out. Below is the code for my WORLD file and LAUNCH file.

Any help would be GREATLY appreciated,


WORLD FILE (works correctly when launched from Gazebo)

<?xml version="1.0" ?>
<sdf version="1.4">
  <world name="default">

<!-- The collada model in the TestRobot_gazebo/models directory -->
    <model name="Test_House_Model">
      <pose>0 0 0 0 0 0</pose>
      <link name="Test_House_Model_link">
        <visual name="Test_House_Model_visual">

LAUNCH FILE (does not display the collada model when called from ROSLAUNCH, but does spawn the robot)

    <!-- launch an empty Gazebo world -->
    <include file="$(find gazebo_ros)/launch/empty_world.launch">

       <!-- insert the modified world with the collada model -->
        <arg name="world_name" value="$(find TestRobot_gazebo)/worlds/TestRobot.world"/> 

    <!-- Spawn a robot into Gazebo -->
    <node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-file $(find TestRobot_description)/urdf/TestRobot.urdf -urdf -model TestRobot" />


Originally posted by MikeC on ROS Answers with karma: 3 on 2016-12-28

Post score: 0


1 Answer 1


Rosanswers logo

Just something to check: ~devel/TestRobot_ws/src/TestRobot_gazebo/models is not a valid path (missing a /). Also: does $GAZEBO_MODEL_PATH really contain the ~? I would expect that to be resolved by the shell (ie: bash) to /home/$USER (or whatever the OSX equivalent is). Try $HOME.

Originally posted by gvdhoorn with karma: 86574 on 2016-12-29

This answer was ACCEPTED on the original site

Post score: 0

Original comments

Comment by MikeC on 2016-12-29:
Hi gvdhoorn, It now works.

Here is the solution: Taking your advice, I inserted **$HOME** into the path. So it becomes: export GAZEBO_MODEL_PATH=$HOME/devel/TestRobot_ws/src/TestRobot_gazebo/models:$GAZEBO_MODEL_PATH. (A trailing "/" does not matter.)



Comment by gvdhoorn on 2016-12-29:
Not the "trailing '/'" matters, but the one between ~ and devel/TestRobot_ws/... It could be that things would've worked even with ~, if you'd inserted the / at that point.

But good to hear you got things to work.

Comment by MikeC on 2016-12-30:
Gvdhoorn, once again, you are correct. I tried it using "~/devel/..." and it also works. Sometimes we are so far into the forest that we cannot see the trees. Thank you again!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.