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

Using <env> tags to parameterize included launch files

asked 2021-07-21 15:17:49 -0500

mariachiband49 gravatar image

According to this roslaunch wiki page:

NOTE: Values set using the <env> tag will not be seen by $(env ...), so the <env> 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 <env> 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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-07-22 17:11:43 -0500

Mike Scheutzow gravatar image

According to what I read at http://wiki.ros.org/roslaunch/XML/inc..., 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.

edit flag offensive delete link more

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.

mariachiband49 gravatar image mariachiband49  ( 2021-07-26 14:39:30 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2021-07-21 15:17:49 -0500

Seen: 515 times

Last updated: Jul 22 '21