Ask Your Question
0

No completion for 'ros2 run' in zsh

asked 2022-01-10 11:20:25 -0500

Soap-Shampoo gravatar image

updated 2022-01-10 21:24:47 -0500

I've installed 'Ros2-Galactic' via apt and added thesource /opt/ros/galactic/setup.zshto my '.zshrc'. I found that there is no completion for 'ros2 run', 'ros2 pkg', and so on. (I mean no completion for the package_names , topic_names, etc) However the 'ros2' completion works just fine in bash. Later, I've also tried to install via binary package from https://github.com/ros2/ros2/releases. This time, the completion functioned in zsh after sourcing the 'setup.zsh' from the downloaded package. The 'setup.zsh' from this two installation methods are totally different which really confused me.

I'm now using the apt-installed ros2. Wanna know if there is any solution to bring completion for 'ros2' to zsh.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-01-11 10:26:44 -0500

Maxime gravatar image

This is a known bug. Someone found a workaround here. Basically you can run the following to re-enable the autocomplete.

# argcomplete for ros2 & colcon
eval "$(register-python-argcomplete3 ros2)"
eval "$(register-python-argcomplete3 colcon)"
edit flag offensive delete link more

Comments

Thanks!!! The autocompletion works after I adding the lines above right after source /opt/ros/galactic/setup.zsh to my .zshrc. Wonder if this issue still exists in the latest release of ros2-foxy?

Soap-Shampoo gravatar image Soap-Shampoo  ( 2022-01-11 11:11:03 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2022-01-10 11:20:25 -0500

Seen: 52 times

Last updated: Jan 11