在初次使用Turtlebot3仿真环境时,运行
ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
出现报错
[ERROR] [spawn_entity.py-4]: process has died [pid 8859, exit code 1, cmd
'/opt/ros/humble/lib/gazebo_ros/spawn_entity.py -entity waffle -file
/opt/ros/humble/share/turtlebot3_gazebo/models/turtlebot3_waffle/model.sdf -x -2.0 -y -0.5
-z 0.01 --ros-args'].
这是spawn_entity.py 脚本在尝试加载 turtlebot3_waffle 模型时出现错误
解决方法
在.bashrc文件中加入
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/opt/ros/galactic/share/turtlebot3_gazebo/models
这样,Gazebo应该能够正确找到 turtlebot3_gazebo 模型,并避免之前的问题。