[スポーン サービスに失敗しました。終了します] ROS2 が実行中の Turtlebot3_gazebo ルーチン stack_error

デバッグ環境

Ubuntu20.04-銀河
ガゼボ11

エラー内容

ROS2で実行

ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py

ガゼボを開くと、アイコンが直接スタックし、ワールドが表示されず、ターミナルは次のエラーを報告します。

[spawn_entity.py-4] [エラー] [1666579919.180097092] [spawn_entity]: サービス %s/spawn_entity は利用できません。Gazebo は GazeboRosFactory から始まりましたか?
[spawn_entity.py-4] [エラー] [1666579919.182394989] [spawn_entity]: スポーン サービスが失敗しました。退出中。
[エラー] [spawn_entity.py-4]: プロセスが終了しました [pid 3040、終了コード 1、cmd '/opt/ros/gaoptic/lib/gazebo_ros/spawn_entity.py -entity waffle -file /opt/ros/gaoptic/ share/turtlebot3_gazebo/models/turtlebot3_waffle/model.sdf -x -2.0 -y -0.5 -z 0.01 --ros-args']。

[spawn_entity.py-4] [ERROR] [1666579919.180097092] [spawn_entity]: Service %s/spawn_entity unavailable. Was Gazebo started with GazeboRosFactory?
[spawn_entity.py-4] [ERROR] [1666579919.182394989] [spawn_entity]: Spawn service failed. Exiting.
[ERROR] [spawn_entity.py-4]: process has died [pid 3040, exit code 1, cmd '/opt/ros/galactic/lib/gazebo_ros/spawn_entity.py -entity waffle -file /opt/ros/galactic/share/turtlebot3_gazebo/models/turtlebot3_waffle/model.sdf -x -2.0 -y -0.5 -z 0.01 --ros-args'].

ここに画像の説明を挿入
ここに画像の説明を挿入

解決

モデルのパスを追加し、次のコマンドを入力します。 import
GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/opt/ros/gaoptic/share/turtlebot3_gazebo/modelsターミナル
. このコマンドを毎回入力することを避けたい場合は、コマンドを~/.bashrc の最後の行。

 export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/opt/ros/galactic/share/turtlebot3_gazebo/models

ここに画像の説明を挿入

おすすめ

転載: blog.csdn.net/Feizhai2/article/details/127491482
おすすめ