模吧

 找回密码
 立即注册

QQ登录

只需一步,快速开始

手机号码,快捷登录

2420查看 | 11回复

Ubuntu下编译 ardupilot

[复制链接]
发表于 2015-11-11 18:18:03 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
本帖最后由 payne.pan 于 2015-11-11 20:46 编辑

几个月前下载 ardupolit  轻松就编译了apm2, 这次想编译 pixhawk缺遇到些问题,下面具体说说(环境pc机,ubuntu14.04):


根据官方文档 http://dev.ardupilot.com/wiki/building-the-code-onlinux/

先安装git ,  而后用 git clone下载源文件

1)下载源代码

sudo apt-get -qq -y install git
git clone https://github.com/diydrones/ardupilot.git

(如果不想clone整个库,到https://github.com/openpilot/OpenPilot下载zip文件有问题,因为编译过程中会调git命令取文件取不到,因为没有git库)


2) 而后安装toolchain (如:arduino-core,  gcc-avr avrdude avr-libc binutils-avr 等)

最简单就是运行下面脚本(提示不多,可能等很长时间)

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


不运行这个脚本,就要手动运行下面命令

sudo apt-get install gcc-avr avrdude avr-libc binutils-avr

sudo apt-get install python-serial python-wxgtk2.8 python-matplotlib python-opencv python-pexpect python-scipy
sudo apt-get gawk make git arduino-core g++


pixhawk 需要下载 arm toolchain

在ubuntu14.04不要用sudo apt-get install gcc-arm-none-eabi -y, 不但安装了错误的版本,而且缺少 c++ header

而应该运行 http://dev.px4.io/starting-installing-linux-boutique.html 提示的脚本(用wget 下载,再安装)


3)编译

使当前shell 环境变量生效

. ~/.profile


编译多轴
cd ardupilot/ArduCopter
make 

根据提示选择target

Targets
-------

  px4-v1 - the PX4v1 board
  px4-v2 - the Pixhawk
  pxf - the Beagle Bone Black (BBB) + PXF cape combination
  navio - the RaspberryPi + NavIO cape combination
  linux - a generic Linux build
  flymaple - the FlyMaple board

...


新版本的ArduCopter(3.x) 不支持缺省参数,而且取消了 apm1/apm2, 添加了树莓派的支持


比如编译 pixhawk

make px4-v2


ArduPlane  APMrover2 AntennaTracker 与此类似

最后看到下面提示,就成功编译生成文件

LINK:    /home/payne/ardupilot/ardupilot/modules/PX4Firmware/Build/px4fmu-v2_APM.build/firmware.elf

BIN:     /home/payne/ardupilot/ardupilot/modules/PX4Firmware/Build/px4fmu-v2_APM.build/firmware.bin
%% Generating /home/payne/ardupilot/ardupilot/modules/PX4Firmware/Build/px4fmu-v2_APM.build/firmware.px4
make[2]: Leaving directory `/home/payne/ardupilot/ardupilot/modules/PX4Firmware/Build/px4fmu-v2_APM.build'
%% Copying /home/payne/ardupilot/ardupilot/modules/PX4Firmware/Images/px4fmu-v2_APM.px4
make[1]: Leaving directory `/home/payne/ardupilot/ardupilot'
   text    data     bss     dec     hex filename
901640    2812   62352  966804   ec094 /home/payne/ardupilot/ardupilot/modules/PX4Firmware/Build/px4fmu-v2_APM.build/firmware.elf
PX4 ArduCopter Firmware is in ArduCopter-v2.px4



最后用 make px4-v2-upload 上传


其他问题:

我想到ArduPlane去编apm2 ( Copter取消了对apm2的支持,Plane应该没有取消吧)

但提示

ArduPlane$ make apm2
../mk/targets.mk:13: *** apm2 is deprecated on master branch; use master-AVR


那么就先运行

git checkout master-AVR

再编就可以了

make apm2

得到

%% ArduPlane.elf
Firmware is in ArduPlane.elf
%% ArduPlane.eep
%% ArduPlane.hex



发表于 2015-11-11 18:33:13 | 显示全部楼层
看不懂不知道是做什么的
发表于 2015-11-11 18:52:11 | 显示全部楼层
不懂帮顶
 楼主| 发表于 2015-11-11 20:48:01 | 显示全部楼层
无机翼的飞机8 发表于 2015-11-11 18:33
看不懂不知道是做什么的

就是生成 apm, pixhawk的固件
发表于 2015-11-11 21:21:46 | 显示全部楼层
我也不懂,以后学习
发表于 2015-11-11 23:29:07 | 显示全部楼层
Ubuntu下编译 ardupilot DIY,多轴,APM,ardupilot,ubuntu 作者:huchuang886 2321
发表于 2015-11-12 02:53:09 | 显示全部楼层
嗯。我也编译了。差不多一样的环境。
还编译了地面站APM2,我还给github项目提交过代码。未来大家的电脑/无人机里也许有运行我写的一些代码。
发表于 2015-11-12 06:30:19 | 显示全部楼层
哦就是升级成固件的
发表于 2015-11-12 07:35:29 | 显示全部楼层
这是标准的技术贴,得顶!
发表于 2015-11-12 08:33:28 | 显示全部楼层
标记下,以后可能用到到。
发表于 2015-11-12 22:46:43 | 显示全部楼层
看的一塌糊涂啊,一看就是高人,高人能不能弄个能说话的手机地面站呢,不用翻墙的。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

站长推荐上一条 /1 下一条

QQ|关于模吧|APP下载|广告报价|手机版|企业会员|商城入驻|联系我们|模吧 ( 黔ICP备2022002348号-1 )

© 2013-2020 Moz8.com 模吧,玩出精彩!