Robotics StackExchange | Archived questions

Using <env> tags to parameterize included launch files

According to this roslaunch wiki page:

NOTE: Values set using the tag will not be seen by $(env ...), so the tag cannot be used to parametrize launch files.

However, this is exactly what I need to do. I have been given a launch file which reads environment variables using $(optenv). I need to create another launch file to include this launch file with some specific environment variables set, and some other nodes I want to run. I would very much like for users of my launch file to just be able to run it, instead of me having to instruct them how to source a separate file before running it.

So, if the tag won't do it, is there another way to set environment variables from a launch file such that included launch files will see them?

Asked by mariachiband49 on 2021-07-21 15:17:49 UTC

Comments

Answers

According to what I read at http://wiki.ros.org/roslaunch/XML/include, what you want to do is already supported. I interpret this to mean that an "included" file is not considered the same file. As always, you need to do a test to see if it actually works as described.

Asked by Mike Scheutzow on 2021-07-22 17:11:43 UTC

Comments

I have already tested using the <env> tag and confirmed that it does not work. Environment variables set using <env> seem to be visible to nodes that are launched by the included launch file. However, they aren't visible to $(env ...) substitutions used in the included launch file, which is what I need.

Asked by mariachiband49 on 2021-07-26 14:39:30 UTC