Gazebo | Ignition | Community
Ask Your Question

Differences in paths between gazebo and rosrun gazebo_ros gzserver

asked 2013-07-27 03:56:02 -0500

ynevatia gravatar image

updated 2013-07-30 04:50:21 -0500


I have my files in the following structure:

~/faster_dev/branches/yn/gazebo/models: model database, model.sdf files in subfolders

My environment variables are set up as follows:

GAZEBO_MODEL_PATH=:/home/yn/faster_dev/branches/yn/gazebo/models:/home/yn/faster_dev/trunk/gazebo/models GAZEBO_RESOURCE_PATH=/home/yn/local/share/gazebo-1.9:/home/yn/local/share/gazebo_models:/home/yn/faster_dev/branches/yn/gazebo/plugin:/home/yn/faster_dev/branches/yn/gazebo/models GAZEBO_MASTER_URI=http://localhost:11345 GAZEBO_PLUGIN_PATH=/home/yn/local/lib/gazebo-1.9/plugins:/home/yn/faster_dev/branches/yn/gazebo/plugin/build:/home/yn/faster_dev/trunk/gazebo/plugin/build GAZEBO_MODEL_DATABASE_URI=

When I run "gazebo" from any location the world is loaded with all textures and models found, howvere 'rosrun gazebo_ros gzserver" can only find the world file if I run the command from folder containing the file, and in this case a number of resources (png for heightmap and textures) cannot be found.

Is there any difference in the paths or environment variables used by gazebo and gazebo_ros?


edit retag flag offensive close merge delete


The problem lies with the scripts in _gazebo\_ros/scripts_. These call the _setup.sh_ from Gazebo, which was overwriting the environment variables I had set in my .bashrc with default values.

ynevatia gravatar imageynevatia ( 2013-07-30 06:48:20 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2013-07-30 06:54:47 -0500

ynevatia gravatar image

I finally figured out the problem: it lies with a conflict in the scripts in gazebo_ros/scripts and the way I setup the environment variables. the gazebo_ros scripts call the from Gazebo, which was overwriting the environment variables I had set in my .bashrc with default values. without changing how I saw the environment variables outside the execution.

By commenting out the relevant lines in gazebo_ros/scripts/gazebo and building it again (for safety), roslaunch gazebo_ros mars_world.launch works.

edit flag offensive delete link more

answered 2013-07-29 11:51:11 -0500

davetcoleman gravatar image

updated 2013-07-29 11:51:41 -0500

rosrun gazebo_ros gzserver will resolve ROS package names into their associated file system path, whereas simply gazebo will not. So it depends if your models are in SDF format or URDF format, and how the paths are set for your resources. I'm not sure the default non-ROS gazebo behavior, but I do know it can make a difference where you are running the command from in your terminal's pwd.

edit flag offensive delete link more


My models are as SDF files, referenced from a model database in /home/yn/faster_dev/branches/yn/gazebo/models. The world file is in /home/yn/faster_dev/branches/yn/gazebo/plugin. Both folders are in the GAZEBO_RESOURCE_PATH, and can be found when I run gzserver rosrun gazebo_ros gzserver fails to load the world file, which lead me to wonder if the use different environment variables.

ynevatia gravatar imageynevatia ( 2013-07-29 15:01:48 -0500 )edit

Can you your world file?

davetcoleman gravatar imagedavetcoleman ( 2013-07-29 15:06:36 -0500 )edit

GistGit doesnt seem to be able to find my files, so I've set up a github repo that you could use: - I've also added the output of rosrun gazeb_ros gazebo and the folder structure of the models directory.

ynevatia gravatar imageynevatia ( 2013-07-30 04:44:36 -0500 )edit

I also just noticed that the rosrun command only finds the file if it is in a local directory..

ynevatia gravatar imageynevatia ( 2013-07-30 04:45:07 -0500 )edit

You can also find the files at

ynevatia gravatar imageynevatia ( 2013-07-30 05:50:31 -0500 )edit

Hi Dave, I figured out what was the issue - the scripts in _gazebo\_ros_ call the gazebo _setup.sh_ which overwrites the environment variables (setup in the .bashrc) with default values. Removing this call from the scripts results in the models and world being loaded.

ynevatia gravatar imageynevatia ( 2013-07-30 06:46:43 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2013-07-27 03:56:02 -0500

Seen: 2,099 times

Last updated: Jul 30 '13