安装ros机器人系统和无人机环境配置常见问题总结

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档


Ubuntu16.04安装ros:http://wiki.ros.org/cn/kinetic/Installation/Ubuntu
Ubuntu18.04安装ros:https://blog.csdn.net/qq_44830040/article/details/106049992
(此处为Ubuntu16.04)

一、安装ROS

安装步骤:

1、添加 sources.list(设置你的电脑可以从 packages.ros.org 接收软件.)此处用的国内镜像源。

sudo sh -c ‘. /etc/lsb-release && echo “deb http://mirrors.ustc.edu.cn/ros/ubuntu/ lsb_release -cs main” > /etc/apt/sources.list.d/ros-latest.list’

2、添加 keys公钥

sudo apt-key adv --keyserver ‘hkp://keyserver.ubuntu.com:80’ --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

3、确保你的Debian软件包索引是最新的:

sudo apt-get update

4、安装桌面完整版 : 包含ROS、rqt、rviz、机器人通用库、2D/3D 模拟器、导航以及2D/3D感知

sudo apt-get install ros-kinetic-desktop-full

5、初始化 rosdep(在开始使用ROS之前你还需要初始化rosdep。rosdep可以方便在你需要编译某些源码的时候为其安装一些系统依赖,同时也是某些ROS核心功能组件所必需用到的工具。)

sudo rosdep init
rosdep update

错误1:

ERROR: error loading sources list: (‘The read operation timed out’,)

很有可能是网络原因,运行超时,反复执行几次就好。

错误2:

ERROR: cannot download default sources list from: https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
Website may be down.

报错原因:是GitHub的raw.githubusercontent.com无法连接,需要解决GitHub的raw.githubusercontent.com无法连接问题,通过IPAddress.com首页,输入raw.githubusercontent.com查询到真实IP地址,修改hosts Ubuntu:
解决办法:

sudo vi /etc/hosts

在文件末尾添加:

199.232.28.133 raw.githubusercontent.com

在这里插入图片描述然后再次执行sudo rosdep init就可以了。
6、环境配置

vecho “source /opt/ros/kinetic/setup.bash” >> ~/.bashrc source
~/.bashrc

7、构建工厂依赖

sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential

至此已经在Ubuntu1604的系统中完整安装ROS Kinetic

错误1:

build-essential 已经是最新版 (12.1ubuntu2)。 有一些软件包无法被安装。如果您用的是 unstable
发行版,这也许是 因为系统无法达到您要求的状态造成的。该版本中可能会有一些您需要的软件
包尚未被创建或是它们已被从新到(Incoming)目录移出。 下列信息可能会对解决问题有所帮助:

下列软件包有未满足的依赖关系: python-rosinstall : 依赖: python-vcstools (>= 0.1.38)
但是它将不会被安装
依赖: subversion 但无法安装它
依赖: mercurial 但无法安装它
依赖: git-core 但无法安装它
依赖: bzr 但无法安装它 python-wstool : 依赖: python-vcstools (>= 0.1.38) 但是它将不会被安装
依赖: subversion 但无法安装它
依赖: mercurial 但无法安装它
依赖: git-core 但无法安装它
依赖: bzr 但无法安装它 E: 无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系。

先更新一下,再执行就好了。

sudo apt-get update

  1. 小乌龟验证

第一个终端运行如下命令:

1.roscore

打开第二个终端,也可以利用 Ctrl+Shift+T 快捷键打开一个新的终端,运行如下命令,这时你会看见一只静止的小海龟

2.rosrun turtlesim turtlesim_node

如果希望小海龟能够移动,打开第三个终端,利用Ctrl+Shift+T快捷键再打开一个新的终端,启动turtlesim的键盘控制节点turtle_teleop_key,运行如下命令:

3.rosrun turtlesim turtle_teleop_key

在这里插入图片描述

二、无人机环境配置

ubuntu系统使用ros控制

程序开发网站:https://github.com/AutonomyLab/bebop_autonomy
编译过程:https://bebop-autonomy.readthedocs.io/en/latest/installation.html#compiling-from-source

前提条件:

ROS Indigo,Jade或Kinetic(仅在Ubuntu上测试)
Ubuntu的软件包:build-esstential,python-rosdep,python-catkin-tools
基本了解构建ROS软件包

sudo apt-get install build-essential python-rosdep python-catkin-tools

要从源代码进行编译,您需要在新的或现有的catkin工作空间中克隆源代码,用于rosdep安装依赖项,最后使用catkin编译工作空间。以下命令在新创建的catkin工作空间中演示此过程。

从0.6版Parrot ARSDK开始,bebop_autonomy的主要基础依赖 项不再内置内联。取而代之的是,在下面的步骤中,将它的稍微打补丁和类别化的版本parrot_arsdk作为依赖项获取。与以前的版本相比,这大大减少了软件包的编译时间(例如,从现代计算机上的约15分钟减少到不到一分钟)。如果要从源代码重新编译,则需要先清理工作区:$ catkin clean [-y]
然后以此执行以下命令:

#Create and initialize the workspace
$ mkdir -p ~/bebop_ws/src && cd ~/bebop_ws
$ catkin init
$ git clone https://github.com/AutonomyLab/bebop_autonomy.git src/bebop_autonomy
#Update rosdep database and install dependencies (including parrot_arsdk)
$ rosdep update
$ rosdep install --from-paths src -i
#Build the workspace
$ catkin build

运行成功如下:
在这里插入图片描述

更多安装

构建ROS软件包:

sudo apt-get install build-essential python-rosdep python-catkin-tools

找不到python-catkin-tools包:

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu `lsb_release -sc` main" > /etc/apt/sources.list.d/ros-latest.list'
wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
 
sudo apt-get update
sudo apt-get install python-catkin-tools

问题1

如果出现如下问题:

E: 无法获得锁 /var/lib/dpkg/lock-frontend - open (11: 资源暂时不可用)
E: 无法获取 dpkg 前端锁 (/var/lib/dpkg/lock-frontend),是否有其他进程正占用它?
在这里插入图片描述

解决办法,执行如下命令,删除 /var/lib/dpkg/lock-frontend - open

ls /var/lib/dpkg/lock-frontend
sudo rm -r -f /var/lib/dpkg/lock-frontend
sudo  rm  -r -f /var/lib/dpkg/lock

问题2:

避免后面出现sudo rosdep:找不到命令提示,这里需要执行如下命令

sudo apt install python-rosdep

猜你喜欢

转载自blog.csdn.net/weixin_46353422/article/details/109098285