“ros2 启动turtlebot3_gazebo turtlebot3_world.launch.py​​”导致未找到包

问题描述

这些是使用的命令:

$ source /opt/ros/foxy/setup.bash
ROS_disTRO was set to 'noetic' before. Please make sure that the environment does not mix paths from different distributions.
$ export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:~/turtlebot3_ws/src/turtlebot3_simulations/turtlebot3_gazebo/models
$ export TURTLEBOT3_MODEL=burger
$ ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
Package 'turtlebot3_gazebo' not found: "package 'turtlebot3_gazebo' not found,searching: ['/opt/ros/foxy']"

解决方法

路径中是否有可能缺少子目录?

export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:~/turtlebot3_ws/src/turtlebot3/turtlebot3_simulations/turtlebot3_gazebo/models

或者,如果您不需要工作区,您可以使用以下内容:

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