Ask Your Question
1

Setting machine-dependent args in launch files?

asked 2016-03-30 18:06:35 -0500

sr71 gravatar image

Is there any way to set arguments in launch files as a function of machine name/HOSTNAME?

Specifically, I would like to run the same launch file on multiple machines, but with 1 of the args changing based on machine name. I am aware there are (currently) no arg comparators in roslaunch (only if/unless statements), and have investigated the <machine> tag, but was not successful in getting this to work.

Thanks ahead

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2016-03-30 21:19:03 -0500

ahendrix gravatar image

You can read environment variables from a launch file using $(env VAR). You could use this to read the HOSTNAME variable if that is useful, or you could set a custom environment variable on a per-host basis and use that.

A more complete example would be:

<arg name="host" value="$(env HOSTNAME)"/>
edit flag offensive delete link more

Comments

Was hoping to avoid that and have everything included in .launch files, but agreed that works.

sr71 gravatar imagesr71 ( 2016-03-31 16:00:51 -0500 )edit

There are clever ways to use includes, if you have unique hostnames. For example <include file="$(find my_package)/hosts/$(arg host).launch"/>

ahendrix gravatar imageahendrix ( 2016-03-31 16:15:32 -0500 )edit

Your Answer

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

Add Answer

Question Tools

2 followers

Stats

Asked: 2016-03-30 18:06:35 -0500

Seen: 149 times

Last updated: Mar 30 '16