本文主要記錄了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
同時,我還將個人安裝過程錄製成了視頻,請點擊這裏查看。