首先我们要知道,自己安装的Ubuntu的版本就是镜像文件版本,不同的Ubuntu对应的ROS的版本也不同。所以才有“没法定位软件包”的问题
ROS有Melodic、Lunar、Kinetic不同的种类对应着不同的ubuntu版本,
Melodic 主要对应:Ubuntu Artful (17.10), Bionic (18.04 LTS) 以及Debian Stretch
Kinetic 主要对应:Ubuntu Wily (15.10) and Ubuntu Xenial (16.04 LTS),
在安装的过程中要根据自己的ubuntu系统版本选择对应的ROS类型进行安装。
那么才会有不同的安装步骤
sudo apt-get install ros-melodic-desktop-full
sudo apt-get install ros-lunar-desktop-full
sudo apt-get install ros-kinetic-desktop-full
这样就可以安装完毕好ros的不同版本,记住之前如果有安装过其他ros版本记住要把环境变量要修改掉(简单点就是注释掉)否则会ROS_DISTRO was set to ‘noetic’ before. Please make sure that the environment does not mix paths from different distributions
gedit ~/.bashrc #正确编辑.bashrc文件
source ~/.bashrc #使其生效
要打开home下的bashrc文件,然后在最后修改(或添加)
然后就可以进行下一步了,turtlebot安装。
从未安装过的就可以看一看官网的文件turtlebot安装步骤https://www.ncnynl.com/archives/201811/2787.html
如果是安装过的人可以使用一下我的步骤安装
sudo apt-get install ros-kinetic-turtlebot*
roslaunch turtlebot_gazebo turtlebot_world.launch
运行一下仿真环境看有没有报错,没有报错的那么恭喜你很幸运,有报错的就接着看我下面的操作吧。
错误:*Invalid tag: environment variable ‘TURTLEBOT_GAZEBO_WORLD_FILE’ is not set. Arg xml is arg default=”$(env TURTLEBOT_GAZEBO_WORLD_FILE)” name=”world_file”The traceback for the exception was written to the log file.
解决方法就是:重新配置环境
先初始化rosdep然后去配置环境变量
sudo rosdep init
rosdep update
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
(有问题的就看这边的如果第一步都有问题那就用下面几个步骤
sudo pip install rosdepc
如果没有pip那就用下面的代码
sudo pip3 install rosdepc
pip和pip3都没有的话,那就使用下面的代码
sudo apt-get install python3-pip
sudo pip install rosdepc
使用这两个代码来下载rosdepc
然后就下一步吧
sudo rosdepc init
rosdepc update
)
没有问题的话就再次运行一下仿真环境的那段代码吧
roslaunch turtlebot_gazebo turtlebot_world.launch
如果成功运行,那么恭喜你安装成功了,但是如果安装成功但是有闪退的人就可以接着看下面的解决步骤
有三种方法可以解决不同的问题,看你这边是哪种了:
https://blog.csdn.net/u011304078/article/details/102584462
https://www.cnblogs.com/rjjhyj/p/12268181.html
https://blog.csdn.net/qq_44775361/article/details/117945525
然后你可以看到你想看到的运行界面了