Autocompletion for ros2 topic pub and ros2 service call does not work

asked 2021-01-21 01:15:25 -0500

updated 2021-02-17 02:16:27 -0500

gvdhoorn gravatar image

Autocompletion for ros2 topic pub and ros2 service call (and presumably ros2 action send_goal also) does not work properly.

$ ros2 topic pub /turtle1/cmd_vel [tab] -> 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\

$ ros2 service call /turtle1/set_pen turtlesim/srv/SetPen [tab] -> r:\ 0\^Jg:\ 0\^Jb:\ 0\^Jwidth:\ 0\^J\'off\':\ 0\
edit retag flag offensive close merge delete

Comments

Ah, yes. I too am quite annoyed by this. If you're wanting to know how to type this, it would be like this: ros2 topic pub /turtle1/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}}"

As for why this doesn't happen when you tab complete, however, that's likely quite a bit more involved.

allenh1 gravatar image allenh1  ( 2021-01-21 18:19:18 -0500 )edit

Is this fixed? Because I'm currently struggling with this problem. Pretty annoying to manually try to perform the call with correct syntax.

ahopsu gravatar image ahopsu  ( 2021-08-19 10:05:11 -0500 )edit

It seems to work when you have typed the first quation mark " and at least the first letter of the first field. Instead of doing this as in the original problem:

ros2 topic pub /turtle1/cmd_vel [tab]

Do this:

ros2 topic pub /turtle1/cmd_vel "l [tab]

It should now show the message in this format:

"linear: {x: 0.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 0.0}"

Notice, that there is not starting { and ending } wave brackets, at least it works without those

ahopsu gravatar image ahopsu  ( 2021-08-19 10:21:41 -0500 )edit