Running ArduCopter on OcPoC™ Zynq Mini

Before You Begin

First make sure you have done the following.

  1. SD Card inserted into your OcPoC™ Zynq Mini
  2. Connect battery power to your OcPoC™ Zynq Mini - see "Powering your OcPoC Board" [Note: this is not necessary for bench testing with OcPoC as the USB connection will supply 5V to the board]
  3. Connect a MicroUSB cable to the 'USB1' port on your OcPoC™ Zynq Mini, then connect to your computer via USB.

Connecting to your OcPoC™ for the first time

Once you have a USB to Micro-USB connected from your PC to the specified USB UART(USB1) and at least 5 volts DC supplied to the board. Open a terminal on your PC and execute the following command

Note: See FAQ: OcPoC™ Zynq Mini for connecting to OcPoC from Windows

sudo gtkterm
Ctrl + Shift + S

A 'Configuration' window will pop up. Under the 'Port:' dropdown box select the USB port your OcPoc Zynq Mini is connected to(usually the last on list). On the 'Baud Rate:' drop down select the option '115200' and click the 'ok' button.

751

At this point we recommend reboot your board so that you may see the boot-up process. Simply disconnect then reconnect the board power.

You should now see the boot process scrolling across your GTK Terminal

745

GTKTerm if you reboot

743

Once boot is completed

Simply provide 'root' as the login in credentials.

root

Now we will execute the auto pilot. Depending on how you will connect to your Ground Station(GS) software you will pass a different argument. The most common method is to use wireless telemetry.

./arducopter -C /dev/ttyPS1 -B /dev/ttyS3
./arducopter -A /dev/ttyPS0 -B /dev/ttyS3

To enable other peripherals, use the following startup options:

Peripheral Device/FunctionStartup Argument
Telemetry via micro-USB-A /dev/ttyPS0
Wireless Telemetry-C /dev/ttyPS1
GPS/Compass-B /dev/ttyS3
uLanding-E /dev/ttyS6
uSharp-F /dev/ttyS0

(Optional) Enabling ArduCopter Auto Execution

If you would like ArduPilot to start automatically during the boot up process of the OcPoC™, without connecting via USB and logging in over gtkterm, you will first need to create a blank text file named 'ardupilot' in the SD card's 'rootFs/etc/init.d/' directory. With the SD card connected to your PC, execute the following commands:

cd /media/<user_name>/rootFs/etc/init.d/
sudo touch ardupilot

Open the 'ardupilot' file in your preferred editor (be sure to open as a super user, i.e. 'sudo gedit ardupilot'), and copy the following text into the file:
Note: This text is specifically for the Ubuntu rootFs setup for OcPoC™, and will run ArduCopter. If you're running ArduPlane, set 'ARDUPILOT' equal to 'arduplane' as opposed to 'arducopter'. You can also add any other peripheral options in the 'STARTCMD' variable (i.e. you could change to STARTCMD="/root/$ARDUPILOT -C /dev/ttyPS1 -B /dev/ttyS5 -F /dev/ttyS0").

#!/bin/sh
### BEGIN INIT INFO
# Provides:          ArduCopter
# Required-Start:    
# Required-Stop:    
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: ArduCopter Autopilot Daemon
# Description:       starts ArduCopter Autopilot
### END INIT INFO

PIDFILE=/var/run/ardupilot.pid
ARDUPILOT="arducopter"
STARTCMD="/root/$ARDUPILOT -C /dev/ttyPS1 -B /dev/ttyS3"


start(){
        if [ -f $PIDFILE ] && pgrep $ARDUPILOT; then
                echo 'Service already running' >&2
                return 1
        fi
        echo 'Starting service…' >&2
        local CMD="$STARTCMD &"
        su -c "$CMD" root > "$PIDFILE"
        echo 'Service started' >&2
}
stop(){
	if [ ! -f $PIDFILE ] || ! pgrep $ARDUPILOT; then
                echo 'Service not running' >&2
                return 1
        fi
        echo 'Stopping service…' >&2
        pkill $ARDUPILOT && rm -f "$PIDFILE"
        echo 'Service stopped' >&2
}

# Actions
case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    restart)
        stop
        start
        ;;
esac
exit 0

Save and close the 'ardupilot' file, and make sure it is executable with the following command:

sudo chmod 755 ardupilot

Next, with the SD card back in the OcPoC™, power on the board and login via gtkterm, then run the following command:

update-rc.d ardupilot defaults
reboot

Now during the normal bootup process of the OcPoC™, ardupilot will automatically start without the need to connect via USB. You can also now run the following commands from the OcPoC™ terminal:

/etc/init.d/ardupilot stop
/etc/init.d/ardupilot start
/etc/init.d/ardupilot restart