[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.视频记录

同时,我还将个人安装过程录制成了视频,请点击这里查看。

相关文章
相关标签/搜索