ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

what are environment hooks in catkin

asked 2017-02-03 17:34:57 -0600

blakejwc gravatar image

I've been trying to understand what the file does and how it changes my shell environment such that catkin builds correctly.

Simply to describe my motivation for understanding, there are times when I get into a dirty build state (genjava and rosjava freaking out about something), and I have to blow away build, devel directories, and maven repos and build from scratch. However if I naively call catkin_make, rosjava and genjava start breaking all over the place because I no longer have a setup.bash file to source other than the ros/indigo/setup.bash. So I end up in this weird place where my first build command has to be ROS_PACKAGE_PATH=/path/to/src:$ROS_PACKAGE_PATH catkin_make. Then I can source the proper setup.bash file, call catkin_make, and everything builds fine again.

I'd like to understand more about the env hooks because my hope is I can just prefix catkin_make with all the env variables to get an arbitrary set of troubled packages (i.e. rosjava and genjava) happy and have a single command to solve my problems.

edit retag flag offensive close merge delete


Have you seen It does describe what an environment hook is, but it doesn't go into the technical mechanism which makes them work.

William gravatar image William  ( 2017-02-03 18:11:40 -0600 )edit

I could only find mention of "env hooks" in the Quickstart and Workspace Mechanisms sections. They don't really describe what an "env hooks" are, just their existence and somehow helping define packages in a workspace.

blakejwc gravatar image blakejwc  ( 2017-02-06 11:03:45 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-02-06 11:22:10 -0600

Dirk Thomas gravatar image

Environment hooks are shell scripts provided by a ROS package. Whenever you source the setup file in a workspace those environment hooks are also being sourced. They are being used to set / extend environment variables. E.g. the ros package has an environment hook which set the environment variable ROSDISTRO_NAME (see ) and ROS_PACKAGE_PATH (see ).

edit flag offensive delete link more



What is the @(), @{}@, and @[if/else]@ syntax?

blakejwc gravatar image blakejwc  ( 2017-02-07 11:23:36 -0600 )edit

Files ending in .em are using the EmPy template engine, see

Dirk Thomas gravatar image Dirk Thomas  ( 2017-02-07 11:39:49 -0600 )edit

oh wow! This is intense, and it explains a lot of what I am seeing. Thank you!

blakejwc gravatar image blakejwc  ( 2017-02-07 14:10:26 -0600 )edit

Is there an overview of what variables are defined by Catkin within EmPy templating? EDIT: I created a follow up question for that.

bluenote gravatar image bluenote  ( 2019-01-16 05:41:13 -0600 )edit
Dirk Thomas gravatar image Dirk Thomas  ( 2019-01-16 10:06:18 -0600 )edit

Question Tools



Asked: 2017-02-03 17:34:57 -0600

Seen: 1,854 times

Last updated: Feb 06 '17