Building APM
Since I expect I will have to make some changes to the code, I will now try to build APM fro source code. Working repository for Navio APM port is on GitHub.
I decided to build APM directly on your Raspberry Pi since it does not require to setup a cross-compiling environment and Raspberry Pi has enough computing power to make this step fast enough
Download the APM’s port for Navio:
git clone https://github.com/emlid/ardupilot.git
Switch to the 'navio' branch:
git checkout navio
Navigate to the autopilot’s directory, for example rover, run configuration and build it:
cd ardupilot/ArduCopter make configure make navio-heli
I'm not sure the heli configuration fits my needs, but I will try a build with this configuration, then I will change the makefile. Many other frames are supported. To build for other frame types replace heli with one of the following options:
quad tri hexa y6 octa octa-quad heli single obc nologging
Executable file will be placed in /tmp/APMcopter.build directory. Copy the binary from tmp directory to your home folder:
cp /tmp/APMcopter.build/APMcopter.elf /home/pi/APMcopter.elf
Running APM
To run APM use the following (change APMrover2.elf to ArduCopter.elf or ArduPlane.elf if needed):
sudo ./APMcopter.elf -A udp:192.168.1.2:14550
Where 192.168.1.2 is the IP address of the device with the Ground Control Station – your laptop, smartphone etc.
Arguments specify serial ports (TCP or UDP can be used instead of serial ports) :
- -A is for telemetry
- -B is for external GPS
- -C is for secondary telemetry
If you would like to transfer secondary telemetry over the UART port on Navio you can specify it like this:
sudo ./APMcopter.elf -A udp:192.168.1.2:14550 -C /dev/ttyAMA0
Autostarting APM on boot
To automatically start APM on boot add the following (change -A and -C options to suit your setup) to /etc/rc.local file on your Raspberry Pi:
sudo /home/pi/APMcopter.elf -A udp:192.168.1.2:14550 -C /dev/ttyAMA0 > /home/pi/startup_log &