ArduPilot源码学习--(一)--MAC下编译ArduPilot源码

最近大半个月都在搞ardupilot的东东,我的测试机是一台250的穿越机,Pixhawk 2.4.8的飞控(比较耐炸,机器刚到那天,测试时,由于GPS有问题,从大概6楼掉下来,四个桨叶的螺丝全掉了,桨叶也掉了两个,把所有东西找回来重新安装上,还是可以飞:))。

开始了我的ArduPilot之旅。。。。

我用的是一台MAC来做编译,使用eclipse开发环境,ArduPilot官网有使用MAC进行源码下载和编译教程,地址为:http://ardupilot.org/dev/docs/building-px4-with-make-on-mac.html

按步就班就可以了,只是这个命令时,下载好慢啊。。好像是从国外站点直接下载的。我下了两天。。

git submodule update --init --recursive
过程中,我遇到好些问题:

1、git源码时,像modules文件夹里的nuttx等全是空的,必需要用上面的命令下载。我尝试过直接到对应的github上下载zip包,解压放里面,编译通不过。大概提示是文件夹已经存在。

2、下载这些模块时,网络慢,经常会断,但是早上下载的话,会快些。。

make命令提示:

CubardeMacBook-Air:arducopter cubar$ make


 ArduPilot Building

 ==================


 The following web page has detailed information on building the code

     http://dev.ardupilot.org/wiki/building-the-code/


 Before building a target you need to be in the target vehicle type directory

 e.g. ArduPlane, ArduCopter, APMrover2, AntennaTracker


 Most targets support a "-upload" extension to upload the firmware

 to a connected board.  e.g. "make px4-v2-upload"


 Some targets support a "-debug" extension to enable a debug build

 (with debug symbols, and without optimisation)


 Note that the px4 builds are NOT parallel safe, NO -j flag


 Targets

 -------


  px4-v1 - the PX4v1 board

  px4-v2 - the Pixhawk

  px4-v3 - the Pixhawk with 2M flash

  px4-v4 - the XRacer

  pxf - the Beagle Bone Black (BBB) + PXF cape combination

  navio - the RaspberryPi + NavIO cape combination

  linux - a generic Linux build

  vrbrain - the VRBrain boards

  sitl - the SITL Software In The Loop simulation

  bbbmini - the Beagle Bone Black mini

  bebop - the Parrot Bebop

  raspilot - the RaspberryPi + pilot cape combination

  erleboard - the ErleBoard legacy design

  minlure - the drone lure for MinnowBoard and others

  qflight - qualcomm flight board

  erlebrain2 - the Erle-Brain 2 board

  bhat - the RaspberryPi + BH HAT combination

  pxfmini - the RaspberryPi Zero + PXFmini cape combination

  navio2 - the RaspberryPi + NavIO2 cape combination

CubardeMacBook-Air:arducopter cubar$ 


编译成功的提示:

Pruning ROMFS files.

ROMFS:   romfs.img

OBJ:     romfs.o

CC:      romfs.o.c

CC:      romfs.o.c

LINK:    /Users/cubar/src/ardupilot/modules/PX4Firmware/Build/px4fmu-v2_APM.build/firmware.elf

BIN:     /Users/cubar/src/ardupilot/modules/PX4Firmware/Build/px4fmu-v2_APM.build/firmware.bin

%% Generating /Users/cubar/src/ardupilot/modules/PX4Firmware/Build/px4fmu-v2_APM.build/firmware.px4

%% Copying /Users/cubar/src/ardupilot/modules/PX4Firmware/Images/px4fmu-v2_APM.px4

   text   data    bss     dec    hex filename

1025164   2840  57224 1085228108f2c /Users/cubar/src/ardupilot/modules/PX4Firmware/Build/px4fmu-v2_APM.build/firmware.elf

PX4 ArduCopter Firmware is in ArduCopter-v2.px4

CubardeMacBook-Air:arducopter cubar$ 

问题来了,MAC下好像只有QGroundControl,没有MP。QC有点蛋疼的是不能越界修改参数,也不能查看日志(只能下载,下载后是一个bin文件,暂时没找到MAC下查看bin文件的软件,有个File Spy,能看到日志内容,但是不支持换行。。),因此,编译好后用U盘复制到WIN下面烧到PIX里。

接下来就是各项校准。最后试飞。。。成功。。。

 
  

你可能感兴趣的:(ArduPilot,C++,无人机,ArduPilot)