# setting custom variables on catkin workspace environment

I am developing a package for the ROS, in fact it is a package of resources / models for the Gazebo, and I need with the presence of this package in the Workspace of Catking, to be automatically set the variable GAZEBO_MODEL_PATH for this package.

I could intervene in the file ~/catkin_mygazebo_ws/devel/setup.sh, adding the path to variable.

but first I would like to know if there is any way to do it by another more specialized route to Catkin.

Thankful.

Let's assume you need to add the path to new gazebo templates when developing your packages, so create a directory called env_hooks in your template package folder.
Enter the directory and create a configuration file with the extension specified for each shell (.bash, .zsh, tcsh). This file can have any name, in the case I will use models_env. , change <shell_string> to the extension representing the shell, each file must be the required variables configuration according to the shell.
Now edit the CMakeLists.txt file and add the following directive to the end:
catkin_add_env_hooks (models_env SHELLS bash tcsh zsh DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} / env-hooks)  For example, for the Bash shell, I edited my models_env.bash file and put: #! /bin/bash echo "*******" echo "Preparing specific variables for the gazebo_model package" echo "*******" _CATKIN_ENV_HOOKS_PATH = $$(catkin locate arr_gazebo_models) export GAZEBO_MODEL_PATH = "$$ {_ CATKIN_ENV_HOOKS_PATH} / models:$ {GAZEBO_MODEL_PATH}"