本文主要记录了PX4
环境在Ubuntu 18.04
下的搭建过程,因为我在安装PX4环境以前已经先安装了ROS Melodic
,而安装ROS
的时候同时安装了gazebo
,所以没法肯定后面出现的问题是否因为先安装了ROS
。python
本文分为如下几个部分:linux
请注意:git
如下安装过程所有在手机热点下完成,若是你是校园网用户而且下载速度过慢,请尝试使用手机热点。github
打开PX4_Ubuntu安装页面,而后按照官方推荐的使用脚本进行安装,选择安装脚本ubuntu.sh
。ubuntu
wget https://raw.githubusercontent.com/PX4/Firmware/master/Tools/setup/ubuntu.sh wget https://raw.githubusercontent.com/PX4/Firmware/master/Tools/setup/requirements.txt
source ubuntu.sh
安装完成后,会在终端提示重启电脑。windows
安装完成后,你能够经过检查gcc
版原本检查是否成功安装Nuttx
浏览器
$arm-none-eabi-gcc --version arm-none-eabi-gcc (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204] Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
安装过程当中,在安装python
的依赖时,因为直接从国外的pip
源进行获取,致使速度太慢。bash
打开下载的ubuntu.sh
,找到下面几行:ide
# Python3 dependencies echo echo "Installing PX4 Python3 dependencies" sudo python3 -m pip install --upgrade pip setuptools wheel sudo python3 -m pip install -r ${DIR}/requirements.txt # Python2 dependencies echo echo "Installing PX4 Python2 dependencies" sudo python2 -m pip install --upgrade pip setuptools wheel sudo python2 -m pip install -r ${DIR}/requirements.txt
将其修改成post
# Python3 dependencies echo echo "Installing PX4 Python3 dependencies" sudo python3 -m pip install --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple pip setuptools wheel sudo python3 -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r ${DIR}/requirements.txt # Python2 dependencies echo echo "Installing PX4 Python2 dependencies" sudo python2 -m pip install --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple pip setuptools wheel sudo python2 -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r ${DIR}/requirements.txt
在这以后,从新运行
source ubuntu.sh
能够直接打开ubuntu.sh
,在其中找到该编译器的下载地址,并将该地址
https://armkeil.blob.core.win...
复制到浏览器进行下载,下载完成后,要参照着ubuntu.sh
手动运行命令完成安装。
导航到你的home
目录下,运行命令
git clone https://github.com/PX4/Firmware.git
下载过程比较缓慢,等待下载完成之后,运行命令
运行命令
git submodule update --init --recursive
4.gazebo仿真
打开终端到Firmware
文件夹,运行命令
make px4_sitl gazebo_iris
同时,我还将个人安装过程录制成了视频,请点击这里查看。