-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[launch_frontend] FindPackage substitution not concatenated with surrounding text #337
Comments
I couldn't reproduce the error. @jacobperron Can you confirm if you still can reproduce the error? Thanks! |
Still happens for me, here's what the launch output is for me:
versus what I expect it to be:
It's a subtle difference: [INFO] [launch]: All log files can be found below /home/jacob/.ros/log/2019-09-19-13-10-17-642777-warner-8629
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [echo-1]: process started with pid [8645]
- [echo-1] /home/jacob/ws/latest_ws/install/rclcpp/share/rclcpp /sub/path/foo
+ [echo-1] /home/jacob/ws/latest_ws/install/rclcpp/share/rclcpp/sub/path/foo
[INFO] [echo-1]: process has finished cleanly [pid 8645] |
@jacobperron this is quite strange. I have updated and rebuilt and I still cannot reproduce it.
Can you test it? |
@jacobperron could you take a look to ros2/launch_ros#76? |
I'm surprised you can't reproduce. It also happens with other substitutions, e.g.
I've starting digging into the code, and it looks like the issue stems from interaction between the parser and
is broken into a list of three substitutions
Then, the command list is naturally separated by spaces, so we end up with
instead of the desired
I believe the issue needs to be resolved in the parser, since there doesn't seem to be a way to distinguish the following two cases in
versus
|
What do you think about changing the grammar to keep together any text containing a substitution? See this commit that adds proposed tests: def test_space_next_to_substitutions():
# substitutions should concatenate with surrounding text that are not whitespace
subst = parse_substitution('$(test foo)_bar_ _bar_$(test baz)')
assert len(subst) == 2
assert subst[0].perform(None) == 'foo_bar_'
assert subst[1].perform(None) == '_bar_baz'
subst = parse_substitution('$(test foo) _bar_ _bar_ $(test baz)')
assert len(subst) == 4
assert subst[0].perform(None) == 'foo'
assert subst[0].perform(None) == '_bar_'
assert subst[0].perform(None) == '_bar_'
assert subst[1].perform(None) == 'baz' I guess we'd have adapt substitutions to also account for neighboring text, or introduce a new substitution type that handles this case. Thoughts? |
@jacobperron wow I read this bad twice, sorry. |
Transferring to https://github.com/ros2/launch. |
Has this moved since sep? Is there branch with some WIP related to this issue? This is still effecting launch users, limiting the use of substitutions. |
@ruffsl Yes, I agree. I will try to iterate on this ASAP. |
Bug report
Required Info:
Steps to reproduce issue
Create a launch file with the following content and launch it.
Expected behavior
I would expect to see output like the following:
Actual behavior
The substituted string for the share directory and the subsequent text,
/sub/path/foo
, are separated with a space:Additional information
There's the same behavior with
find-pkg-prefix
as well.I've noticed that if we do the substitution in an
<arg>
tag, then it works as expected.I'm not sure if tags other than
<executable>
are exhibiting the same bug.Workaround
First do the substitution in an
<arg>
tag, for example:I'm not sure where to look to resolve this issue. It's possible it should be fixed in
launch
(notlaunch_ros
).Maybe someone can point me in the right direction.
The text was updated successfully, but these errors were encountered: