Ask Your Question
0

Model From World File Not Visible In Gazebo When Using Roslaunch

asked 2016-12-28 19:46:18 -0500

MikeC gravatar image

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,

Thanks!

WORLD FILE (works correctly when launched from Gazebo)

<?xml version="1.0" ?>
<sdf version="1.4">
  <world name="default">
    <include>
      <uri>model://ground_plane</uri>
    </include>
    <include>
      <uri>model://sun</uri>
    </include>

<!-- The collada model in the TestRobot_gazebo/models directory -->
    <model name="Test_House_Model">
      <pose>0 0 0 0 0 0</pose>
      <static>true</static>
      <link name="Test_House_Model_link">
        <visual name="Test_House_Model_visual">
          <geometry>
            <mesh><uri>model://models/Test_House_Model.dae</uri></mesh>
          </geometry>
        </visual>
      </link>
    </model>   
  </world>
</sdf>

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

<launch>
    <!-- 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 ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-12-29 06:07:13 -0500

gvdhoorn gravatar image

updated 2016-12-29 06:07:29 -0500

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.

edit flag offensive delete link more

Comments

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.)

THANK YOU! THANK YOU! THANK YOU!

MikeC

MikeC gravatar imageMikeC ( 2016-12-29 10:34:52 -0500 )edit

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.

gvdhoorn gravatar imagegvdhoorn ( 2016-12-29 10:51:35 -0500 )edit

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!

MikeC gravatar imageMikeC ( 2016-12-30 09:57:47 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-12-28 19:46:18 -0500

Seen: 1,324 times

Last updated: Dec 28 '16