12
$\begingroup$

I'm starting out with Gazebo (1.5) at the moment and am following a tutorial off the internet. In order to get Gazebo to find the model, the author advocates manually exporting the GAZEBO_MODEL_PATH environment variable via

export GAZEBO_MODEL_PATH=[...]/models:$GAZEBO_MODEL_PATH 

But that will only work for the current terminal. So I wanted to change the environment variable permanently.

The Gazebo User Guide claims that GAZEBO_MODEL_PATH, along with all the other environment variables, is set by /usr/share/gazebo-1.5/setup.sh but my (virgin) Gazebo install doesn't list it:

export GAZEBO_MASTER_URI=http://localhost:11345 export GAZEBO_MODEL_DATABASE_URI=http://gazebosim.org/models export GAZEBO_RESOURCE_PATH=/usr/share/gazebo-1.5:/usr/share/gazebo_models export GAZEBO_PLUGIN_PATH=/usr/lib/gazebo-1.5/plugins export LD_LIBRARY_PATH=/usr/lib/gazebo-1.5/plugins:${LD_LIBRARY_PATH} export OGRE_RESOURCE_PATH=/usr/lib/i386-linux-gnu/OGRE-1.7.4 # This line is needed while we're relying on ROS's urdfdom library export LD_LIBRARY_PATH=/opt/ros/fuerte/lib:${LD_LIBRARY_PATH} 

But when I start Gazebo, GAZEBO_MODEL_PATH is already set to $HOME/.gazebo/models, so it must be set somewhere. I guess I could probably simply add GAZEBO_MODEL_PATH to the setup.sh script, but since it is set somewhere, I'd still like to know where and whether it is better practice to set it in there.

$\endgroup$
1
  • 1
    $\begingroup$ The answer by @Armin Meisterhirn should be marked as an answer IMO. Btw, Gazebo has its own QA forum answers.gazebosim.org $\endgroup$ Commented Jan 13, 2015 at 7:53

3 Answers 3

10
$\begingroup$

This is more of a Linux than a Gazebo problem. You can just add this line

export GAZEBO_MODEL_PATH=[...]/models:$GAZEBO_MODEL_PATH 

to your ~/.bashrc file.

$\endgroup$
4
$\begingroup$

You asked two questions.

  1. Where does Gazebo set the default model path
  2. Where should I set the value

The second question is perfectly right answered by @Armin Meisterhirn. Best practice is to set the variable in the .bashrc file.

The first question, I asked myself as well when starting working with gazebo.

In case of the pure Gazebo (no roslaunch, no plugins) the answer is as simple as that:

In the source code. Gazebo always sets an additional path which is the default value.

Look here.

Line 84:

this->modelPaths.push_back(home + "/.gazebo/models"); 

As a result, you always have a default path, whatever you do (except you change the source code).

$\endgroup$
0
$\begingroup$

In my case, just setting Gazebo path did not solved the issue. Running roscore, in a separate terminal, solved my problem.

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.