Ask Your Question

How to reference environmental variables inside an upstart installed launch file?

asked 2015-03-25 16:28:55 -0500

brendan gravatar image

I have successfully managed to install a launch file but upon rebooting found that none of the environmental variables referenced in the launch file are found. Granted, the launch files are guilty of liberal usage of $(optenv VARIABLE default) and as such many things are taking the default value. This now makes sense because, as I understand it, services run with most of the environmental variables stripped away. However I'd really like to avoid simply hard code the information into the launch files because the robot's hardware configuration is saved in these variables and this one launch file has to be installed on several different types of units.

I saw that for normal linux services the work around is to source an additional file inside the service file but I even find where robot_upstart installs the newly created service, which I confusingly called ros as well. I didn't see it /etc/default or /etc/init.d . My best guess was to source the ".robotrc" in the devel/setup.bash and include it with --setup option?


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-12-08 00:26:59 -0500

130s gravatar image

updated 2017-12-08 00:28:26 -0500

Apologies if I take your intent wrong, but defining environmental variables upon upstart is discussed in clearpathrobotics/robot_upstart#44 (and not formally documented anywhere AFAICT). So as far as you successfully define env vars that way, you should be able to reference to them in your launch files in the way you mentioned.

CC @mikepurvis

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-03-25 16:28:55 -0500

Seen: 694 times

Last updated: Dec 08 '17