[Pixhawk/PX4]開發環境搭建(Ubuntu 18.04)

本文主要記錄了PX4環境在Ubuntu 18.04下的搭建過程,因爲我在安裝PX4環境以前已經先安裝了ROS Melodic,而安裝ROS的時候同時安裝了gazebo,所以沒法肯定後面出現的問題是否因爲先安裝了ROSpython

本文分爲如下幾個部分:linux

  1. 使用官方推薦的安裝腳本進行安裝
  2. 解決安裝過程當中出現的問題
  3. 下載PX4源碼
  4. 視頻記錄

請注意git

如下安裝過程所有在手機熱點下完成,若是你是校園網用戶而且下載速度過慢,請嘗試使用手機熱點。github

1. 使用官方推薦的安裝腳本進行安裝

打開PX4_Ubuntu安裝頁面,而後按照官方推薦的使用腳本進行安裝,選擇安裝腳本ubuntu.shubuntu

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. 等待安裝完成

安裝完成後,會在終端提示重啓電腦。windows

ubuntu-sh.png

安裝完成後,你能夠經過檢查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. 解決安裝過程當中出現的問題

1.python包安裝過慢

安裝過程當中,在安裝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

2.交叉編譯器gcc下載過慢

能夠直接打開ubuntu.sh,在其中找到該編譯器的下載地址,並將該地址

https://armkeil.blob.core.win...

複製到瀏覽器進行下載,下載完成後,要參照着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

gazebo.png

4.視頻記錄

同時,我還將個人安裝過程錄製成了視頻,請點擊這裏查看。

相關文章
相關標籤/搜索