Skip to content
This repository was archived by the owner on May 31, 2025. It is now read-only.

Add $(shell ...) substitution (fix #102). - #341

Closed
RainCT wants to merge 2 commits into
ros:hydro-develfrom
RainCT:hydro-devel
Closed

RainCT wants to merge 2 commits into
ros:hydro-develfrom
RainCT:hydro-devel

Conversation

@RainCT

@RainCT RainCT commented Jan 23, 2014

Copy link
Copy Markdown

This is an updated version of the patch by raywilhe in #102.

@po1

po1 commented Feb 18, 2014

Copy link
Copy Markdown

Are there practical use cases for this? I know the <arg> tag is far from perfect, but you could very well use it to pass the output of a shell command to launch arguments.
It looks to me that it would add more complexity to launch files, and thus increase the loading time.
Also, I am afraid that this would lead to more incompatibilities between platforms if people started to use this feature extensively.

@RainCT

RainCT commented Feb 18, 2014

Copy link
Copy Markdown
Author

I'm sure there are, although I'm not too interested in it, what I really want is supporting eg. string comparisons in ifs (may submit a patch for that sometime). That would allow us to combine many duplicate launch files where only little details change (eg. depending on the robot).

@dirk-thomas dirk-thomas added this to the untargeted milestone Feb 26, 2014
@dirk-thomas

Copy link
Copy Markdown
Member

The shell substitution this PR adds is conceptionally problematic since it encourages platform specific code in launch files. Since you already mentioned that you actually don't need that "power" for your use case a more specific solution should be developed. Depending on how severe the change / extension to roslaunch should be it might be worth to go through a community review via the REP process (http://www.ros.org/reps/rep-0000.html).

@RainCT

RainCT commented Mar 13, 2014

Copy link
Copy Markdown
Author

Well, launch files are platform specific.

One problem we have here is that we have a copy of all launch files for each robot/model, because there are mostly subtle differences between them; this is not at all optimal, since there's a lot of duplication and files can get out of sync.

This could be avoided if roslaunch implemented: a) string comparison, and b) integer comparisons (<, >, =). Since those could be combined with "env" it would let us unify most launch files.

Would this (string and integer comparisons) require a REP or should I just submit a patch?

@dirk-thomas

Copy link
Copy Markdown
Member

Launch files are not by design platform specific. And actually a lot of launch files are definitely not.

Current launch files only support simple conditions (see http://wiki.ros.org/roslaunch/XML#if_and_unless_attributes). If you would like to work on a pull request which adds the proposed comparisons that would be great and imo does not require a REP. It might be good to discuss the way you want to realize it before diving into the code to avoid work in the "wrong" direction.

Please also consider providing the corresponding documentation for the wiki page once it the pull request is done.

@RainCT

RainCT commented Mar 24, 2014

Copy link
Copy Markdown
Author

Hi Dirk,

Thanks for your response. My idea was adding substitutions, for instance: "$(streq a b)", "$(eq a b)", "$(lt a b)" and "$(le a b)" (or maybe "$(cmp a OP b)" with OP \in {<,>,<=,>=,==}).

This would require support for substitution nesting, which I've implemented here: RainCT@779e83f (I'll open a pull request for this once I've tested it a bit).

@RainCT RainCT mentioned this pull request Mar 31, 2014
@dirk-thomas

Copy link
Copy Markdown
Member

This is replaced by #382 and a to-be-written pull request adding the comparison functions. Therefore closing this ticket.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants