本文主要記錄了PX4
環境在Ubuntu 18.04
下的搭建過程,因爲我在安裝PX4環境以前已經先安裝了ROS Melodic
,而安裝ROS
的時候同時安裝了gazebo
,所以沒法肯定後面出現的問題是否因爲先安裝了ROS
。html
本文分爲如下幾個部分:python
- 使用官方推薦的安裝腳本進行安裝
- 解決安裝過程當中出現的問題
- 下載PX4源碼
- 視頻記錄
請注意:linux
如下安裝過程所有在手機熱點下完成,若是你是校園網用戶而且下載速度過慢,請嘗試使用手機熱點。git
1. 使用官方推薦的安裝腳本進行安裝
打開PX4_Ubuntu安裝頁面,而後按照官方推薦的使用腳本進行安裝,選擇安裝腳本ubuntu.sh
。github
1. 下載ubuntu.sh和requirements.txt
wget https://raw.githubusercontent.com/PX4/Firmware/master/Tools/setup/ubuntu.sh wget https://raw.githubusercontent.com/PX4/Firmware/master/Tools/setup/requirements.txt
2. 運行ubuntu.sh
source ubuntu.sh
3. 等待安裝完成
安裝完成後,會在終端提示重啓電腦。ubuntu
安裝完成後,你能夠經過檢查gcc
版原本檢查是否成功安裝Nuttx
windows
$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.
2. 解決安裝過程當中出現的問題
1.python包安裝過慢
安裝過程當中,在安裝python
的依賴時,因爲直接從國外的pip
源進行獲取,致使速度太慢。瀏覽器
打開下載的ubuntu.sh
,找到下面幾行:bash
# 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
將其修改成ide
# 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
2.交叉編譯器gcc下載過慢
能夠直接打開ubuntu.sh
,在其中找到該編譯器的下載地址,並將該地址
複製到瀏覽器進行下載,下載完成後,要參照着ubuntu.sh
手動運行命令完成安裝。
3.下載PX4源碼
導航到你的home
目錄下,運行命令
git clone https://github.com/PX4/Firmware.git
下載過程比較緩慢,等待下載完成之後,運行命令
運行命令
git submodule update --init --recursive
4.gazebo仿真
打開終端到Firmware
文件夾,運行命令
make px4_sitl gazebo_iris
4.視頻記錄
同時,我還將個人安裝過程錄製成了視頻,請點擊這裏查看。