本文主要記錄了PX4
環(huán)境在Ubuntu 18.04
下的搭建過程封断,由于我在安裝PX4環(huán)境之前已經(jīng)先安裝了ROS Melodic
,而安裝ROS
的時候同時安裝了gazebo
叮雳,因此無法確定后面出現(xiàn)的問題是否由于先安裝了ROS
览爵。
本文分為以下幾個部分:
- 使用官方推薦的安裝腳本進行安裝
- 解決安裝過程中出現(xiàn)的問題
- 下載PX4源碼
- 視頻記錄
請注意:
以下安裝過程全部在手機熱點下完成,如果你是校園網(wǎng)用戶并且下載速度過慢圆裕,請嘗試使用手機熱點。
1. 使用官方推薦的安裝腳本進行安裝
打開PX4_Ubuntu安裝頁面荆几,然后按照官方推薦的使用腳本進行安裝吓妆,選擇安裝腳本ubuntu.sh
。
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. 等待安裝完成
安裝完成后吨铸,會在終端提示重啟電腦行拢。
安裝完成后,你可以通過檢查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.
2. 解決安裝過程中出現(xiàn)的問題
1.python包安裝過慢
安裝過程中诞吱,在安裝python
的依賴時舟奠,由于直接從國外的pip
源進行獲取竭缝,導(dǎo)致速度太慢。
打開下載的ubuntu.sh
沼瘫,找到下面幾行:
# 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
將其修改為
# 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
,在其中找到該編譯器的下載地址耿戚,并將該地址
復(fù)制到瀏覽器進行下載湿故,下載完成后,要參照著ubuntu.sh
手動運行命令完成安裝膜蛔。
3.下載PX4源碼
導(dǎo)航到你的home
目錄下坛猪,運行命令
git clone https://github.com/PX4/Firmware.git
下載過程比較緩慢,等待下載完成以后皂股,運行命令
運行命令
git submodule update --init --recursive
4.gazebo仿真
打開終端到Firmware
文件夾墅茉,運行命令
make px4_sitl gazebo_iris
4.視頻記錄
同時,我還將我的安裝過程錄制成了視頻屑墨,請點擊這里查看躁锁。