1
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?

Nav2導入トラブルシューティング

Posted at

Nav2導入

ROS2公式、Nav2公式のドキュメントに沿って、Nav2のシミュレーションが実行できる以下の環境を作りました。

  • 環境:Ubuntu 22.04, ROS2 Humble
  • インストールしたROSパッケージ
    • nav2関連
      • ros-humble-navigation2
      • ros-humble-nav2-bringup
    • turtlebot3関連
      • ros-humble-turtlebot3*

ROS2公式:https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debs.html
Nav2公式:https://docs.nav2.org/getting_started/index.html

そして、環境内で以下のコマンドを打つことでシミュレーションが実行できるはずでした。

ros2 launch nav2_bringup tb3_simulation_launch.py headless:=False

しかし、Docker、ローカル環境の両方を試しましたが、同じトラブルが発生しました。

トラブル

Gazeboが立ち上がらない!!!

そもそもGazeboが起動しない場合

現象

gazeboと打っても何も出ずにターミナルが沈黙したり、以下のようなエラーが出て落ちたりした

[gzclient -2] gzclient: /usr/include/boost/smart_ptr/shared_ptr.hpp:734: typename boost::d
etail::sp_member_access::type boost::shared_ptr::operator->() const [with T = gazebo::
rendering::Camera; typename boost::detail::sp_member_access::type = gazebo::rendering::Ca
mera*]: Assertion `px != 0' failed.
[gzclient -2] Aborted (core dumped)

解決法

以下を実行!

source /usr/share/gazebo/setup.sh

参考:https://demura.net/robot/ros2/21778.html
ありがとうございます😭😭

Gazeboは立ち上がるが表示に時間がかかる場合

現象

Gazeboのオープニング画面が出たまま沈黙

解決法

使用するGazeboのモデルをダウンロードしている状態です。しばらく待てば解決します。(インターネット速度に依存しますが、早ければ数十秒、遅いと3分程度)

あるいは、Nav2シミュレーションのコマンドを打つ前に、ダウンロードを済ませておくのも手です。
gazeboと打ってプレーンの状態で起動し、InsertタブからNav2デモで使用するTurtlebot3 (Waffle)とTurtlebot3 Worldをドラッグ&ドロップで表示させると、ダウンロード完了を目視で確認できます。
なお、以下のコマンドを打たないと、gazeboが参照するパスにTurtlebotのモデルが追加されません。なので、Insertタブに上記のモデルが表示されない場合は、以下のコマンドを打ってください。

export TURTLEBOT3_MODEL=waffle
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/opt/ros/humble/share/turtlebot3_gazebo/models

Nav2がエラーを吐く!

現象

無事にGazeboが起動したのも虚しく、以下のようなエラーを吐きます。

[component_container_isolated-6] [INFO] [1755510215.526643301] [global_costmap.global_costmap]: Timed out waiting for transform from base_link to map to become available, tf error: Invalid frame ID "map" passed to canTransform argument target_frame - frame does not exist
[component_container_isolated-6] [INFO] [1755510215.772499772] [amcl]: Message Filter dropping message: frame 'base_scan' at time 0.376 for reason 'the timestamp on the message is earlier than all the data in the transform cache'
[component_container_isolated-6] [INFO] [1755510216.026717654] [global_costmap.global_costmap]: Timed out waiting for transform from base_link to map to become available, tf error: Invalid frame ID "map" passed to canTransform argument target_frame - frame does not exist
[component_container_isolated-6] [INFO] [1755510216.526801391] [global_costmap.global_costmap]: Timed out waiting for transform from base_link to map to become available, tf error: Invalid frame ID "map" passed to canTransform argument target_frame - frame does not exist
[component_container_isolated-6] [WARN] [1755510216.651463424] [amcl]: AMCL cannot publish a pose or update the transform. Please set the initial pose...

map frameが存在しないというTF周りのエラーが発生します。

解決法

よく見れば書いてありますが、initial poseを設定していないとAMCLがmap->odomのtfを発行しない仕様になっています。なので、initial poseをRViz2の2D Pose Estimateパネルで指定すると解決します!

自分はここまでやってようやくNav2デモのシミュレーションが実行できました。
参考になれば幸いです。

余談①:Nav2のDocker環境公開

上記のトラブルにハマらない、Nav2のデモを簡単に実行できるDocker環境を作成いたしました!
ご自由にご使用ください!

余談②:Nav2公式のDocker環境について

試行錯誤の中で、Nav2公式のDocker環境も試してみました。(2025/8/18)

しかし、こちらのビルド済みDocker imageにはturtlebot3関連のパッケージは入っておらず、そのままではNav2のシミュレーションを実行することは難しいようでした。
そこで、turtlebot3関連のパッケージをインストールしようとすると、GPGキーが古くてインストールができず、一筋縄には行きませんでした、、、
そういう状況だったという備忘録を残しておきます。

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
1
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?