ros2 command line autocomplete interface

asked 2020-09-10 05:42:44 -0600

Georacer gravatar image

Hello everyone!

I'm going through the ROS2 tutorials and I've bumped against this in the topic and service pages. I'm trying to publish a message and use autocomplete to get a template of the .srv call. Good old ROS1 would create a valid cmd line field.

But in ros2 I get:

$ ros2 service call /spawn turtlesim/srv/Spawn x:\ 5.0\
y:\ 5.0\
theta:\ 0.0\
name:\ \'\'\ 
Traceback (most recent call last):
  File "/opt/ros/foxy/bin/ros2", line 11, in <module>
    load_entry_point('ros2cli==0.9.7', 'console_scripts', 'ros2')()
  File "/opt/ros/foxy/lib/python3.8/site-packages/ros2cli/cli.py", line 67, in main
    rc = extension.main(parser=parser, args=args)
  File "/opt/ros/foxy/lib/python3.8/site-packages/ros2service/command/service.py", line 41, in main
    return extension.main(args=args)
  File "/opt/ros/foxy/lib/python3.8/site-packages/ros2service/verb/call.py", line 58, in main
    return requester(
  File "/opt/ros/foxy/lib/python3.8/site-packages/ros2service/verb/call.py", line 77, in requester
    values_dictionary = yaml.safe_load(values)
  File "/usr/lib/python3/dist-packages/yaml/__init__.py", line 162, in safe_load
    return load(stream, SafeLoader)
  File "/usr/lib/python3/dist-packages/yaml/__init__.py", line 114, in load
    return loader.get_single_data()
  File "/usr/lib/python3/dist-packages/yaml/constructor.py", line 49, in get_single_data
    node = self.get_single_node()
  File "/usr/lib/python3/dist-packages/yaml/composer.py", line 36, in get_single_node
    document = self.compose_document()
  File "/usr/lib/python3/dist-packages/yaml/composer.py", line 55, in compose_document
    node = self.compose_node(None, None)
  File "/usr/lib/python3/dist-packages/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/usr/lib/python3/dist-packages/yaml/composer.py", line 127, in compose_mapping_node
    while not self.check_event(MappingEndEvent):
  File "/usr/lib/python3/dist-packages/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
  File "/usr/lib/python3/dist-packages/yaml/parser.py", line 428, in parse_block_mapping_key
    if self.check_token(KeyToken):
  File "/usr/lib/python3/dist-packages/yaml/scanner.py", line 116, in check_token
    self.fetch_more_tokens()
  File "/usr/lib/python3/dist-packages/yaml/scanner.py", line 223, in fetch_more_tokens
    return self.fetch_value()
  File "/usr/lib/python3/dist-packages/yaml/scanner.py", line 577, in fetch_value
    raise ScannerError(None, None,
yaml.scanner.ScannerError: mapping values are not allowed here
  in "<unicode string>", line 1, column 8:
    x: 5.0y: 5.0theta: 0.0name: '' 
           ^

In fact, the tutorials themselves suggest using JSON syntax, which the autocomplete doesn't provide.

Am I missing something here or it's a known omission?

Thanks!

edit retag flag offensive close merge delete

Comments

1

Unfortunately this is currently a known issue: https://github.com/ros2/ros2cli/issue...

Dirk Thomas gravatar image Dirk Thomas  ( 2020-09-10 10:30:55 -0600 )edit

Ah, okay. At least it's known and flagged. Make it an answer so I can mark close the question.

Georacer gravatar image Georacer  ( 2020-09-10 10:57:54 -0600 )edit