linux运行ardupilot,在linux使用make编译ArduPilot for Pixhawk/PX4 ArduPilot 编译环境搭建

Building ArduPilot for Pixhawk/PX4 on Linux with Make

使用Make编译 ArduPilot for Pixhawk 2, Pixhawk and PX4 在linux上.

Note: 编译 Pixhawk 2 and Pixhawk使用 (make px4-v2). 编译 PX4 使用 make px4-v1.

Quick start

系统ubuntu16.04

Setup

安装 git:

sudo apt-get -qq -y install git

安装 arm-none-eabi-gcc编译器

%E5%A4%96%E9%93%BE%E7%BD%91%E5%9D%80%E5%B7%B2%E5%B1%8F%E8%94%BD

安装gawk,cmake

apt-get install gawk cmake

克隆源码到本地:

git clone 外链网址已屏蔽ardupilot.git

运行ubuntu安装脚本:

ardupilot/Tools/scripts/install-prereqs-ubuntu.sh -y

Reload the path (log-out and log-in to make permanent):

. ~/.profile

Build 编译

以下是编译不同机型 Pixhawk2/Pixhawk 的命令. 编译PX4使用make px4-v2 而不是make px4-v1

To build for PX4 replace make px4-v2 with make px4-v1.

Build for Copter:

cd ardupilot/ArduCopter

make px4-v2

编译过程中出现的问题:

%E5%A4%96%E9%93%BE%E7%BD%91%E5%9D%80%E5%B7%B2%E5%B1%8F%E8%94%BD

在github上的matrix目录名已经变化,所以找不到,手动git clone下载即可

%E5%A4%96%E9%93%BE%E7%BD%91%E5%9D%80%E5%B7%B2%E5%B1%8F%E8%94%BD

之后又出现的问题是:

少python-empy,pip,catkin-pkg,直接使用apt-get install 安装即可

%E5%A4%96%E9%93%BE%E7%BD%91%E5%9D%80%E5%B7%B2%E5%B1%8F%E8%94%BD

按照提示少哪个就安装哪个

又出现问题:genromfs没有找到

直接apt-get install genromfs

%E5%A4%96%E9%93%BE%E7%BD%91%E5%9D%80%E5%B7%B2%E5%B1%8F%E8%94%BD

最后编译成功,生成px4固件文件

%E5%A4%96%E9%93%BE%E7%BD%91%E5%9D%80%E5%B7%B2%E5%B1%8F%E8%94%BD

Build for Plane:

cd ardupilot/ArduPlane

make px4-v2

Build for Rover:

cd ardupilot/APMrover2

make px4-v2

Build for Antenna Tracker:

cd ardupilot/AntennaTracker

make px4-v2

Building

One you have the 3 git trees and compiler setup you do the build in your vehicle directory. For example, if building Plane then do this:

cd ardupilot/ArduPlane

make px4

That will build two files ArduPlane-v1.px4 and ArduPlane-v2.px4. The v1 file is for PX4v1, the v2 file is for PX4v2 (the Pixhawk).

你可以只编译一个使用 “make px4-v1” or “make px4-v2”.

The first time you build it will take quite a long time as it builds the px4 archives. Subsequent builds will be faster (especially if you setup ccache correctly).

Loading firmware

To load the firmware onto the board use

make px4-v1-upload

or

make px4-v2-upload

After it says “waiting for bootloader” plugin your PX4 on USB.

If upload consistently fails in the erase step then check if you are running ‘modemmanager’ which can take control of the PX4 USB port. Removing modemmanager can help.

Cleaning

If there have been updates to the PX4NuttX or PX4Firmware git submodules you may need to do a full clean build. To do that use:

make px4-clean

that will remove the PX4NuttX archives so you can do a build from scratch

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值