Closed mbuijs closed 3 years ago
I am not sure what makes this difference between eloquent and foxy, but same approach with https://github.com/ros2/ros2cli/pull/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?
https://github.com/ros2/ros2cli/commit/7bea45f0e7d5e75cff0e57da79ba00d73a8330e2
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...
Bug report
Required Info:
Steps to reproduce issue
Make sure the setup.bash is sources. Then try to publish a message using
ros2 topic pub
:Expected behavior
A complete template of the contents of the specified message appears:
This is what happens when using
eloquent
(verified using the mentioned docker image). Infoxy
this does not happen, neither in docker, nor in a local terminal where the installed apt packages are available. Same applies for therolling
docker image.Actual behavior
No completion suggestion appear. When done without the double quote, the following happens:
Trying to use this format results in a
yaml.scanner.ScannerError
exception:Additional information