3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

ROS2をzshで使うとTab補完ができない件

Posted at

環境

OS:Ubuntu 22.04 LTS
ROS2 version: Humble
Shell:zsh(Z shell)

現象

ROSの頃からあったことなのか不明なのですが例えばros2まで打ってTabを連打しても今いるディレクトリのファイルが候補として出てきてしまう。

原因

No completion for 'ros2 run' in zsh
ということでROS Answersに載っていました。実はzsh環境で且つaptで入れた場合にのみ発生する(随分前からあるバグっぽいのになぜ…?)ようで、ローカルでコンパイルするとうまく行くようです。

解決方法

.zshrcに以下の内容を追加しましょう。

# argcomplete for ros2 & colcon
eval "$(register-python-argcomplete3 ros2)"
eval "$(register-python-argcomplete3 colcon)"

注意点

このevalですがsource /opt/ros/hogehoge/setup.zshするとリセットされます。なので必ず追加する際はそれより下に配置してください。またsourceするエイリアスを設定している方は&&で併記すると良いと思います。

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?