Autocompletion for message contents broken since foxy
mbuijs opened this issue · 12 comments
Bug report
Required Info:
- Operating System:
- Ubuntu 20.04 / docker
- Installation type:
- Apt packages / prebuilt docker image
- Version or commit hash:
- ros-foxy-ros2topic: 0.9.7-1focal.20200804.003710
- For the docker images:
$ docker image ls --no-trunc ros
REPOSITORY TAG IMAGE ID CREATED SIZE
ros rolling sha256:ab3c32fdab44aba3069366d90df5f212c1fb233fcd59bd04a16194f7e86aeef2 37 hours ago 722MB
ros foxy sha256:896c8acbfce8030f2550980f38c11d4a33e1e52500ebe7b4ddc3a6a95f85bc05 37 hours ago 722MB
ros eloquent sha256:e5483efb0d9505e6d4d84466d3a7bb78f48e625661abe2552c77eceddd3f8484 37 hours ago 829MB
- DDS implementation:
- Fast-RTPS
- Client library (if applicable):
- rclpy (?)
Steps to reproduce issue
Make sure the setup.bash is sources. Then try to publish a message using ros2 topic pub
:
$ . /opt/ros/${ROS_DISTRO}/setup.bash
$ ros2 topic pub /cli_demo geometry_msgs/msg/Pose "po<tab>
Expected behavior
A complete template of the contents of the specified message appears:
$ ros2 topic pub /cli_demo geometry_msgs/msg/Pose "position:
x: 0.0
y: 0.0
z: 0.0
orientation:
x: 0.0
y: 0.0
z: 0.0
w: 1.0"
This is what happens when using eloquent
(verified using the mentioned docker image).
In foxy
this does not happen, neither in docker, nor in a local terminal where the installed apt packages are available.
Same applies for the rolling
docker image.
Actual behavior
No completion suggestion appear. When done without the double quote, the following happens:
$ ros2 topic pub /cli_demo geometry_msgs/msg/Pose position:\
\ \ x:\ 0.0\
\ \ y:\ 0.0\
\ \ z:\ 0.0\
orientation:\
\ \ x:\ 0.0\
\ \ y:\ 0.0\
\ \ z:\ 0.0\
\ \ w:\ 1.0\
Trying to use this format results in a yaml.scanner.ScannerError
exception:
Traceback (most recent call last):
File "/opt/ros/rolling/bin/ros2", line 11, in <module>
load_entry_point('ros2cli==0.9.5', 'console_scripts', 'ros2')()
File "/opt/ros/rolling/lib/python3.8/site-packages/ros2cli/cli.py", line 67, in main
rc = extension.main(parser=parser, args=args)
File "/opt/ros/rolling/lib/python3.8/site-packages/ros2topic/command/topic.py", line 41, in main
return extension.main(args=args)
File "/opt/ros/rolling/lib/python3.8/site-packages/ros2topic/verb/pub.py", line 93, in main
return main(args)
File "/opt/ros/rolling/lib/python3.8/site-packages/ros2topic/verb/pub.py", line 103, in main
return publisher(
File "/opt/ros/rolling/lib/python3.8/site-packages/ros2topic/verb/pub.py", line 126, in publisher
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 13:
position: x: 0.0 y: 0.0 z: 0.0orientation ...
Additional information
I am not sure what makes this difference between eloquent and foxy, but same approach with #561 could solve the problem.
I met the same problem when running “ros2 node list“ or other ros2 commands.
At last I have to restart my machine。
This is now fixed on the master branch with #570, so I'm closing this out.
I am having the exact same issue with the master branch compiled from source
I am having the exact same issue with the master branch compiled from source
What's the hash of ros2cli
that you are using?
I am having the exact same issue with the master branch compiled from source
What's the hash of
ros2cli
that you are using?
Compiled from source, with rolling installed and ros-rolling-ros2cli
removed. Could the executable come from anywhere else ?
This is what I get if pressing tab after ros2 topic pub /cmd_vel geometry_msgs/msg/Twist
(including space):
$ ros2 topic pub /cmd_vel geometry_msgs/msg/Twist
-1
--keep-alive
linear:\^J\ \ x:\ 0.0\^J\ \ y:\ 0.0\^J\ \ z:\ 0.0\^Jangular:\^J\ \ x:\ 0.0\^J\ \ y:\ 0.0\^J\ \ z:\ 0.0\
-n
--node-name
--once
-p
--print
--qos-depth
--qos-durability
--qos-history
--qos-profile
--qos-reliability
-r
--rate
-t
--time
s
And this, if pressing tab after ros2 topic pub /cmd_vel geometry_msgs/msg/Twist l
, and then pressing enter
$ ros2 topic pub /cmd_vel geometry_msgs/msg/Twist linear:\
\ \ x:\ 0.0\
\ \ y:\ 0.0\
\ \ z:\ 0.0\
angular:\
\ \ x:\ 0.0\
\ \ y:\ 0.0\
\ \ z:\ 0.0\
1613745635.619423 [25] ros2: using network interface wlp2s0 (udp/10.0.0.25) selected arbitrarily from: wlp2s0, docker0
Traceback (most recent call last):
File "/home/gd/elodie2_ws/install/ros2cli/bin/ros2", line 11, in <module>
load_entry_point('ros2cli', 'console_scripts', 'ros2')()
File "/home/gd/elodie2_ws/build/ros2cli/ros2cli/cli.py", line 67, in main
rc = extension.main(parser=parser, args=args)
File "/home/gd/elodie2_ws/build/ros2topic/ros2topic/command/topic.py", line 41, in main
return extension.main(args=args)
File "/home/gd/elodie2_ws/build/ros2topic/ros2topic/verb/pub.py", line 97, in main
return main(args)
File "/home/gd/elodie2_ws/build/ros2topic/ros2topic/verb/pub.py", line 108, in main
return publisher(
File "/home/gd/elodie2_ws/build/ros2topic/ros2topic/verb/pub.py", line 136, in publisher
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 11:
linear: x: 0.0 y: 0.0 z: 0.0angular: x ...
^
Ah, you need to put it in quotes. Like this:
$ ros2 topic pub /cmd_vel geometry_msgs/msg/Twist "<TAB><TAB>
Just tried with quotes ros2 topic pub /cmd_vel geometry_msgs/msg/Twist "
:
$ ros2 topic pub /cmd_vel geometry_msgs/msg/Twist "
-1 --qos-durability
--keep-alive --qos-history
linear:^J x: 0.0^J y: 0.0^J z: 0.0^Jangular:^J x: 0.0^J y: 0.0^J z: 0.0 --qos-profile
-n --qos-reliability
--node-name -r
--once --rate
-p -t
--print --times
--qos-depth
But if putting quote + l, it works ros2 topic pub /cmd_vel geometry_msgs/msg/Twist "l
:
ros2 topic pub /cmd_vel geometry_msgs/msg/Twist "linear:
x: 0.0
y: 0.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: 0.0"
The bug seems to be fixed for bash but I still face the same problem with zsh.
Let's say I wrote ros2 topic pub /mavros/setpoint_position/local geometry_msgs/msg/PoseStamped "h
and hit tab, it would only complete the first field name, so the result would be ros2 topic pub /mavros/setpoint_position/local geometry_msgs/msg/PoseStamped "header:
. Hitting tab more wouldn't do anything more.
If I switch to bash, then I get the expected result, which is ros2 topic pub /mavros/setpoint_position/local geometry_msgs/msg/PoseStamped "header: stamp: sec: 0 nanosec: 0 frame_id: '' pose: position: x: 0.0 y: 0.0 z: 0.0 orientation: x: 0.0 y: 0.0 z: 0.0 w: 1.0"
My default shell is zsh and switching back to bash is doable but not preferable.
face today the same problem at Ubuntu 22.04.1 LTS and humble, fresh installed yesterday both :(
Just tried with quotes
ros2 topic pub /cmd_vel geometry_msgs/msg/Twist "
:$ ros2 topic pub /cmd_vel geometry_msgs/msg/Twist " -1 --qos-durability --keep-alive --qos-history linear:^J x: 0.0^J y: 0.0^J z: 0.0^Jangular:^J x: 0.0^J y: 0.0^J z: 0.0 --qos-profile -n --qos-reliability --node-name -r --once --rate -p -t --print --times --qos-depth
But if putting quote + l, it works
ros2 topic pub /cmd_vel geometry_msgs/msg/Twist "l
:ros2 topic pub /cmd_vel geometry_msgs/msg/Twist "linear: x: 0.0 y: 0.0 z: 0.0 angular: x: 0.0 y: 0.0 z: 0.0"
facing the same issue too. only am able to get the message auto complete when I do "l <TAB><TAB>
doing "<TAB><TAB>
does not work
strange though for ROS 1 I didn't need to put it in quotes, doing <TAB><TAB>
straight away brought up the autocomplete message with quotes added in
Still happening...