Flying Android Project Interface Board Firmware

From GT RoboJackets

Jump to: navigation, search

Contents

Overview

The interface board translates serial commands issued by the smartphone to servo commands and arbitrates between the autopilot and safety pilot.

State Diagram

Safety Features

Serial Protocol

The phone communicates to the interface board via its serial port.

  • The baud rate is 9600
  • There are eight data bits, no parity bit, and one stop bit.
  • The format of the message is $COMMAND $VALUE $CHECKSUM.

The available commands are below

  • 0X00 - 0B00000000 - Servo 1 position
  • 0X01 - 0B00000001 - Servo 2 position
  • 0X02 - 0B00000010 - Servo 3 position
  • 0X03 - 0B00000011 - Servo 4 position
  • 0X04 - 0B00000100 - Read in value
  • 0X05 - 0B00000101 - Send 5 byte position packet
  • 0x06 - 0B00000110 - Read 5 byte position packet

0X00 - Servo 1 Position

f$VALUE from 0-255 (0X00 to 0XFF) sets the angle of the first servo. This command is echoed to the sender to confirm its receipt.

The value is a unitless number which describes an amount of permitted angle (permitted angle hard coded into the firmware). For example, if the permitted angle is from 20-80 degrees, the value 0x3A is 33 degrees.

0X01 - Servo 2 Position

$VALUE from 0-255 (0X00 to 0XFF) sets the angle of the second servo. This command is echoed to the sender to confirm its receipt.

The value is a unitless number which describes an amount of permitted angle (permitted angle hard coded into the firmware). For example, if the permitted angle is from 20-80 degrees, the value 0x3A is 33 degrees.

0X02 - Servo 3 Position

$VALUE from 0-255 (0X00 to 0XFF) sets the angle of the third servo. This command is echoed to the sender to confirm its receipt.

The value is a unitless number which describes an amount of permitted angle (permitted angle hard coded into the firmware). For example, if the permitted angle is from 20-80 degrees, the value 0x3A is 33 degrees.

0X03 - Servo 4 Position

$VALUE from 0-255 (0X00 to 0XFF) sets the angle of the fourth servo. This command is echoed to the sender to confirm its receipt.

The value is a unitless number which describes an amount of permitted angle (permitted angle hard coded into the firmware). For example, if the permitted angle is from 20-80 degrees, the value 0x3A is 33 degrees.

0X04 - Read in Value

Allows the operator to read in values. Has different behavior if in auto or manual mode. If in manual mode, the PWM value commanded by the safety pilot is returned. If in auto mode, the PWM value commanded by the autopilot is returned.

  • 0X00 - 0B00000000 - Servo 1 value
  • 0X01 - 0B00000001 - Servo 2 value
  • 0X02 - 0B00000010 - Servo 3 value
  • 0X03 - 0B00000011 - Servo 4 value

0X05 - Fast Write Packet

Allows the operator to issue commands controlling the rudder, elevator, and throttle in one packet. The format of the message is
0X05 $SERVO1 $SERVO2 $SERVO3 $CHECKSUM.

0X06 - Fast Read Packet

Allows the operator to read commands controlling the rudder, elevator, and throttle in one packet. The format of the message is
0X06 $0X** $0X** $0X** $CHECKSUM.

Checksum

Until something better is implemented, the checksum is hardcoded to be 0XAA.

Error Codes

If prodded incorrectly, the system can produce any of the following error codes which are transmitted in a packet of format 0XFF $ERROR $CHECKSUM.

  • 0XFF - 0B11111111 - General error
  • 0XFE - 0B11111110 - Safety pilot error
  • 0XFD - 0B11111101 - Checksum error

0XFF - General Error

Generic error

0XFE - Safety Pilot Error

Issued when the aircraft is in safety pilot mode and a non permitted command is issued. Non permitted commands in safety pilot mode include servo commands.

0XFD - Checksum Error

The transmitted checksum does not match the anticipated checksum.

Personal tools