ros2 / ros2/launch

eval substitution errors

Open
#469 20 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement good first issue help wanted
Dominant language
Python
Stars
155
Forks
182
Avg merge
2d 14h
Merged PRs (30d)
6

Description

Bug report

Required Info:

  • Operating System:
    Ubuntu 20.04
  • Installation type:
    Binaries
  • Version or commit hash:
    foxy latest release
  • DDS implementation:
    Fast-RTPS
  • Client library (if applicable):
    N/A
Steps to reproduce issue

Create and launch a xml launch file like this

<launch>
  <let name="variable" value="val1"/>
  <node pkg="demo_nodes_cpp" exec="talker if="$(eval variable == 'val1')" output="screen" />
</launch>
Expected behavior

talker starts running

Actual behavior

I get this error: TypeError: eval substitution expects 1 argument

Additional information

It seems that spaces confuse the eval substitution. Even if I remove the spaces, launch fails with

launch.invalid_launch_file_error.InvalidLaunchFileError: Caught exception when trying to load file of format [xml]: No terminal defined for ''' at line 1 col 20

$(eval variable=='val1')
                 ^

Expecting: {'UNQUOTED_RSTRING', 'SPACE', 'RPAR', 'DOLLAR'}

which I guess means that it doesn't like the single quote character

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the XML launch example with the eval substitution, including spaces and single quotes, and inspect the launch substitution and XML parsing entry points involved. Done means the expression parses without the reported errors and the demo_nodes_cpp talker starts as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.