前言:
对于开发者而言问的最多的问题就是,编译环境问题,各自工具链安装不上。操作系统对于库的版本依赖比较严格,还有一些网络问题,为了节省大家的时间,帮助大家提高效率,Z410工程师专门制作了稳定可用的镜像,免费提供给大家使用。
获取本期教程文档及相关软件镜像安装包:查看评论区
此开发环境集成了如下工具链:
sudo apt-get update操作系统:Ubuntu18.04
软件:ArduPilot集成开发环境、ArduPilot SITL(2D软件在环仿真)、Gazebo9(3D软件在环仿真)、OpenCV3、QGroundControl、Dronekit等。
对于一般的ArduPilot初学者研究,这个开发环境镜像基本都可以满足,尤其是那些刚刚入手ArduPilot开发的同学。
仿真镜像特点:
本次仿真镜像是基于VMware WorkStation16制作的,用户只需根据阿木实验室提供的下载链接下载对应文件,并参照安装手册安装即可。本次镜像内置ArduPilot Copter-4.1.0源码及其完整子模块,并集成了编译源码需要的交叉编译链,用户可直接对源码进行编译并上传到飞控;此外镜像还集成了ArduPilot SITL(2D软件在环仿真)、Gazebo9(3D软件在环仿真)、OpenCV3、QGroundControl、Dronekit等,参考Z410开发配套课程《ArduPilot飞控开发入门》和《树莓派机器视觉入门》,可直接在本次镜像中完成对应例程的开发。
演示效果:
视频加载中...
建议电脑配置:
处理器:I5 7代及以上GPU:GTX 1050及以上RAM:8G及以上硬盘:100G以上空闲空间考虑到有的同学电脑配置不是很高,我们提供的镜像为了能3D仿真所以会占用较多的系统资源,假如电脑配置不高的学生用我们镜像会比较卡,为此我们特意提供了另外一个教程,您可以参照教程自己制作一个没有3D仿真的镜像,话不多说,接下来就进入正题吧。
第一步:虚拟机VMware WorkStation 16软件安装与破解
“VMware WorkStation 16”安装包百度网盘链接:
https://pan.baidu.com/s/1mtPhlO4RyvawLJtDZcJAag
提取码:m63p
(1)下载“VMware Workstation Pro 16”到计算机任意硬盘目录下,双击打开文件夹“VMware Workstation Pro 16”,可看到文件“VMware-workstation-full-16.0.0-16894299.exe”与“VMware Workstation Pro 16许可证密钥.txt”。双击“VMware-workstation-full-16.0.0-16894299.exe”。出现如下界面,点击“下一步”

(2)勾选“我接受许可协议中的条款(A)”,点击“下一步”

(3)自定义软件安装目录,点击“确定”

(4)保留默认,点击“下一步”

(5)取消“启动时检查产品更新(C)”和“加入VMware客户体验提升计划(J)”,点击“下一步”

(6)勾选“桌面(D)”和“开始菜单程序文件夹(S)”,点击“下一步”

(7)点击“安装”

(8)安装过程如下

(9)安装完成之后出现如下界面,点击“许可证(L)”

(10)打开“VMware Workstation Pro 16许可证秘钥.txt”,复制任意一行秘钥到许可证秘钥框里,点击“确定”,即可完成破解。

第二步:虚拟机镜像使用方法
虚拟机镜像百度网盘链接:
https://pan.baidu.com/s/1_FrR0lHPauOhDsomQeYCGg
提取码:wr1k
1、根据阿木实验室提供的下载链接下载虚拟机镜像“AMOVLAB-Z410(UBUNTU18).zip”,并把“AMOVLAB-Z410(UBUNTU18).zip”解压到大于90G的硬盘里。
2、打开刚刚安装好的VMware WorkStation16虚拟机按以下步骤操作




(注意:密码为:amovlab(小写)
仿真镜像安装完成。
如果您的电脑配置不是很高,您可以参照以下教程自己制作一个没有3D仿真的镜像:
第一步:同上安装和破解VMware WorkStation 16;
第二步:基于VMware WorkStation 16软件下的Ubuntu18.05操作系统部署。
“Ubuntu18.05”安装包百度网盘链接:
https://pan.baidu.com/s/1COfpI17CKMrFlPmTSwDUWQ
提取码:yu88
(1)双击电脑桌面“VMware Workstation Pro 16”,点击“创建新的虚拟机”

(2)选中“自定义(高级)(C)”,点击“下一步”


(3)点击“下一步”

(4)选中“稍后安装操作系统(S)”,点击“下一步”

(5)选中“Lniux(L)”和“Ubuntu 64位”,点击“下一步”

(6) 创建“虚拟机名称(V)”以及虚拟机的位置。点击“下一步”

(7)配置处理器(注意:处理器核心数量依据自己电脑配置进行修改,过多的处理器核心数量可能会造成开启虚拟机后物理机卡顿),点击“下一步”

(8)给虚拟机分配内存(注意:内存大小依据物理机大小来定,虚拟机内存大小应小于物理机内存大小的一半),点击“下一步”

(9)选中“使用网络地址转换(NAT)(E)”,点击“下一步”

(10)选中“LSI Logic(L)”,点击“下一步”

(11)选中“SCSI(S)”,点击“下一步”

(12)选中“创建新虚拟磁盘(V)”,点击“下一步”

(13)指定最大磁盘大小为40G(注意:硬盘大小可根据自己的实际需求进行修改),选中“将虚拟磁盘存储为单个文件(O)”,点击“下一步”

(14)指定磁盘目录(建议与虚拟机系统信息放同一目录,方便查找与拷贝),点击“下一步”

(15)弹出“虚拟机”信息,确认无误后,点击“完成”

(16)鼠标左键单击“编辑虚拟机设置”

(17)选中下载好的“Ubuntu18.05”操作系统镜像,点击“确定”

(18)鼠标左键单击“开启此虚拟机”

(19)鼠标左键单击“Install Ubuntu”

(20)默认值,点击“Continue”

(21)选中“Minimal installation”和“Download updates while installing Ubuntu”,点击“Continue”

(22)选中“Erase disk and install Ubuntu”,点击“Install Now”

(23)点击“Continue”

(24)选择时区为“Shanghai”,点击“Continue”

(25)设置username、password,选中“Log in automatically”,点击“Continue”

(26)进入安装界面,安装速度与网速有关

(27)安装完成后会提示需要重启,点击“Restart Now”

(28)重启时会报错,未能正常进入系统(原因:medium还挂载操作系统镜像,需要取消)。

(29)选中“使用物理驱动器(P)”即可取消操作系统镜像文件挂载,点击“确定”

(30)重新启动虚拟机,弹出如下对话框,点击“否(N)”,即可正常进入操作系统。

(31)安装VMware Tool,点击VMware Workstation菜单栏“虚拟机->安装VMware Tools”,这时系统会提示,是否需要升级到“Ubuntu 20.04”,点击“Don’t Upgrade”(注意:切记不可升级操作系统,会造成仿真系统安装python2依赖报错)

(32)双击桌面“VMware Tools”,把文件里面的“VMwareTools”压缩包拖动到桌面。

(33)键盘组合键“CTRL+ALT+T”组合键打开Terminal,输入指令“tar –zxvf VMwareTools-10.3.22-15902021.1.tar.gz”解压缩。解压缩完毕之后,输入指令“ls”,此时当前目录会出现一个“vmware-tools-distrib”的文件夹


(34)输入指令“cd vmware-tools-distrib”,运行“sudo ./vmware-install.pl”,此时会提示输入超级用户密码,输入之前设置的密码即可。之后按照提示默认安装即可。

至此,Ubuntu18.05操作系统的安装部署完毕。
Ubuntu Ardupilot开发环境及仿真环境搭建
注意:开发环境及仿真环境的搭建过程中需要在github等其他网站下载数据,因此搭建过程是否顺利取决于网络环境,笔者在搭建环境的过程中使用了科学上网工具,整个过程非常顺利且耗时较短,对Linux操作系统不熟悉或者还没掌握科学上网方法的用户,可直接使用由阿木实验室制作好的虚拟机镜像包,里面已经安装好所需的所有工具。
一、ArduPilot开发环境搭建
1、修改Ubuntu操作系统的软件源。
sudo mv /etc/ apt/sources.list /etc/ apt/sources.list_backup(备份原生软件源)sudo gedit /etc/ apt/sources.list复制以下内容覆盖sources.list原有内容并保存:
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiversesudo apt-get update

3、下载源码

4、切换到稳定版进行开发(注意:默认的master版本可能存在诸多BUG,需要切换到稳定的版本进行开发)


5、拉取子模块

6、运行自动化脚本安装飞控开发环境(注意:安装过程异常大多数情况下都是由网络环境引起)



7、验证Ardupilot开发环境是否正常



二、Gazebo及插件安装
1、Gazebo安装
sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -sudo apt updatesudo apt install gazebo9 libgazebo9-devgazebo --verbose

2、Gazebo插件安装
cd ~git clone https://github.com/khancyr/ardupilot_gazebocd ardupilot_gazebomkdir buildcd buildcmake ..make -j4sudo make installecho 'source /usr/share/gazebo/setup.sh' >> ~/.bashrcecho 'export GAZEBO_MODEL_PATH=~/ardupilot_gazebo/models' >> ~/.bashrcecho 'export GAZEBO_RESOURCE_PATH=~/ardupilot_gazebo/worlds:${GAZEBO_RESOURCE_PATH}' >> ~/.bashrcsource ~/.bashrc3、开启仿真
Terminal(1):
gazebo --verbose worlds/iris_arducopter_runway.worldTerminal(2):
cd ~/Workspace/ardupilot/ArduCopter../Tools/autotest/sim_vehicle.py -f gazebo-iris --console --map

注意:
(1)启动Gazebo时会出现以下报错:

解决办法,将如下文件代码注释:



(1)打开Gazebo时一直无法打开图形界面。
解决办法:断开网络,等Gazebo启动之后再打开网络即可。
4、Dronekit安装。

5、地面站软件QGroundConrol安装
(1)“Ubuntu18.04 QGroundControl”百度网盘链接
链接:
https://pan.baidu.com/s/1OYnm8pz_TzXPVaMWdsymzA
提取码:yfm9

阿木实验室致力于为机器人研发提供开源软硬件工具和课程服务,让研发更高效!
- End -
技术发展的日新月异,阿木实验室将紧跟技术的脚步,不断把机器人行业最新的技术和硬件推荐给大家。看到经过我们培训的学员在技术上突飞猛进,是我们培训最大的价值。如果你在机器人行业,就请关注我们的公众号,我们将持续发布机器人行业最有价值的信息和技术。