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

what are environment hooks in catkin

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

blakejwc gravatar image

I've been trying to understand what the setup.sh 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

Comments

Have you seen https://catkin-tools.readthedocs.io/e... 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 -0500 )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 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
5

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

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 https://github.com/ros/ros/blob/bf3e4... ) and ROS_PACKAGE_PATH (see https://github.com/ros/ros/blob/bf3e4... ).

edit flag offensive delete link more

Comments

1

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

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

Files ending in .em are using the EmPy template engine, see http://www.alcyone.com/pyos/empy/

Dirk Thomas gravatar image Dirk Thomas  ( 2017-02-07 11:39:49 -0500 )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 -0500 )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 -0500 )edit
Dirk Thomas gravatar image Dirk Thomas  ( 2019-01-16 10:06:18 -0500 )edit

Question Tools

3 followers

Stats

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

Seen: 1,967 times

Last updated: Feb 06 '17