Gazebo | Ignition | Community
Ask Your Question
0

gazebo does not load simple model

asked 2018-08-11 04:11:31 -0500

Subodh Malgonde gravatar image

updated 2018-08-12 03:53:50 -0500

I created a simple .world file:

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

        <include>
            <uri>model://ground_plane</uri>
        </include>
    </world>
</sdf>

My launch file also adds a robot to this world. It launches fine in gazebo, I can see the gray ground plane with grid markings on it and also my robot. image description

Next I created a simple building layout (some walls created using Gazebo's building editor). I saved the building model and added these lines to my .world file:

<include>
    <uri>model://car_description/models/tunnel</uri>
    <pose>25 20.2 0 0 0 0</pose>
</include>

When I launch the file again, this time it takes ages to launch. I see a 'Preparing your world ...' screen for a long time (~10 mins): image description

and then I see this dark screen:

image description

Other solutions which I have tried and did not work for me are:

  1. Adding the following code to the package's package.xml

    <export>
       <gazebo_ros gazebo_model_path="${prefix}/models"/>
       <gazebo_ros gazebo_media_path="${prefix}/models"/>
    </export>
    
  2. Adding the environment variable GAZEBO_MODEL_PATHto my .bashrc file:

    export GAZEBO_MODEL_PATH=/home/my_user/my_catkin_ws/src/
    

There are no errors thrown in the terminal. What am I doing wrong?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

answered 2018-08-12 02:52:21 -0500

Subodh Malgonde gravatar image

I placed the model files in the ~/.gazebo/models directory and changed the code in the .world file to:

<include>
    <uri>model://tunnel</uri>
    <pose>25 20.2 0 0 0 0</pose>
</include>

Its working fine now. However I still don't know how to provide a reference to models which are not in the ~/.gazeo/models directory.

edit flag offensive delete link more

Comments

What is the output of "echo $GAZEBO_MODEL_PATH"?

Raskkii gravatar imageRaskkii ( 2018-08-13 04:49:48 -0500 )edit

This environment variable is not set by ROS. So the output is blank. After I set it in `.bashrc`, I get the output. However it did not fix my problem.

Subodh Malgonde gravatar imageSubodh Malgonde ( 2018-08-23 03:05:09 -0500 )edit

Try changing the command set in .bashrc slightly: export GAZEBO_MODEL_PATH=${GAZEBO_MODEL_PATH}:/home/my_user/my_catkin_ws/src/ The difference here is that this adds your custom path to the existing model path (which should be ~/.gazebo/models) and doesn't overwrite it, allowing both paths to be used.

Raskkii gravatar imageRaskkii ( 2018-08-23 03:55:29 -0500 )edit
0

answered 2020-04-11 22:43:09 -0500

JacobLi gravatar image

Just as @Raskkii‘sanswer, we should not overwrite the default path, but still I try thoes following to get it done:

try:

whereis gazebo

then you will get one is in /usr/share/gazebo

gedit /usr/share/gazebo/setup.sh

copy those environment variable you need, such as

export GAZEBO_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/gazebo-7/plugins:${GAZEBO_PLUGIN_PATH}
export GAZEBO_MODEL_PATH=/usr/share/gazebo-7/models:${GAZEBO_MODEL_PATH}

and then add some path way you want to add in ~/.bashrc, separate with : , such as

export GAZEBO_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/gazebo-7/plugins:${GAZEBO_PLUGIN_PATH}:/home/ljx/gazebo_plugin_tutorial/build
export GAZEBO_MODEL_PATH=/usr/share/gazebo-7/models:${GAZEBO_MODEL_PATH}:/home/ljx/gazebo_plugin_tutorial/models
edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2018-08-11 03:37:25 -0500

Seen: 8,753 times

Last updated: Apr 11 '20