LoginSignup

Why not login to Qiita and try out its useful features?

We'll deliver articles that match you.

You can read useful information later.

1
0

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するエイリアスを設定している方は&&で併記すると良いと思います。

1
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

Comments

No comments

Let's comment your feelings that are more than good

1
0

Login to continue?

Login or Sign up with social account

Login or Sign up with your email address