はじめに
RaspberryPi3+Navio2でArducopterのexampleをubuntuでクロスコンパイルする方法の自分用メモ。半年くらい前もやったけど一瞬で忘れるので。PCの環境はubuntu16.04LTSです。
環境構築
まず、Ardupilotをクローンして環境変数を設定する。
git clone https://github.com/ArduPilot/ardupilot.git
cd ardupilot
git submodule update --init --recursive
export PATH=/opt/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin:$PATH
次にwafを使いやすいようにコマンドにして、ボードをNavio2に設定する。
alias waf="$PWD/modules/waf/waf-light"
waf configure --board=navio2
更に、適当な/librares
内にあるexampleを指定してコンパイルする。
waf build --target examples/INS_generic
で/build/navio2/example
内に実行ファイルができるのでこれをsshでraspberrypiに転送。
rsync -avz $ARDUPILOT/build/navio2/examples/INS_generic pi@192.168.13.6:/home/pi/
最後にraspberrypiにssh接続で入って実行する。
参考
https://docs.emlid.com/navio2/common/ardupilot/building-from-sources/
http://ardupilot.org/dev/docs/learning-ardupilot-the-example-sketches.html