# 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 Catkin to 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 a variable, but first I would like to know if there is any way to do it by another more specialized route to Catkin.

## bumped to the homepage by Community♦2 days ago

This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

• Adding a 'thanks' section to a question is not required, we all tend to be thankful for the people helping us, and expect other people to be thankful too, so saying it just adds noise to the question and distracts people from the problem posed. It may seem counter intuitive, but excessive politeness can itself be impolite, as giving people extra text to read, even if they ignore it, is disrespectful of their time. – Mark Booth Sep 13 at 10:50

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}"