ros-simulation/gazebo_ros_pkgs — pull request #124 by jonbinney (2013-10-03 00:40:17+00:00)
Title: Env hook so that ROS packages can export gazebo model paths

I've been trying to find a clean way for ROS packages which contain gazebo models to have the right directory added to GAZEBO_MODEL_PATH. (It's possible there's an obvious way to do this that I'm missing). I think this solution is pretty reasonable though. The end result is that ROS packages can just specify their gazebo models directory in their package.xml, and when the user sources devel/setup.sh, the right directories will be added to GAZEBO_MODEL_PATH.

How this works:

Any ROS package which has gazebo models does two things: it depends on gazebo_ros, and it puts the following in its package.xml:
```xml

```

To take advantage of this, i've added a catkin_env_hook in the gazebo_ros CMakeLists.txt which tells catkin that when sourcing devel/setup.sh, it should also source gazebo_ros/env-hooks/setup_gazebo_env.sh. That then calls the make_models_path python script, which looks at all packages which depend on gazebo_ros, pulls out the appropriate export tags, and creates the GAZEBO_MODEL_PATH.

I realize that this may seem a bit complicated, but I haven't found any good alternative, and it enables a very nice workflow. ROS users can create packages that contain gazebo models, specify it in a clean way in their package.xml, and then when they source the standard catkin setup script, the gazebo environment variables will be set appropriately.

@davetcoleman, does this sound useful to you? I'm open to other suggestions about how to do this.