GCS Communication Protocol

download GCS Communication Protocol

of 16

Transcript of GCS Communication Protocol

AutoPilot GCSCommunication Protocol Manual

www.UAVFlight.com

Table of ContentsWarranty, Liability, and Lawful Use ........................................................................................................ 1 GCS Communication Protocol................................................................................................................ 2 GCS Port Protocol .............................................................................................................................. 2 AutoPilot Telemetry Packet................................................................................................................. 3 Mode/State Parameter .................................................................................................................... 4 Mode Parameter Values.................................................................................................................. 4 State Parameter Values .................................................................................................................. 4 Beginning of Message (BOM) Detection and End of Message (EOM) Event .................................... 5 GCS Command Set ............................................................................................................................ 6 NOP................................................................................................................................................. 7 Fix Quality........................................................................................................................................ 7 Warning for Airspeed/Altitude.......................................................................................................... 8 Checksum........................................................................................................................................ 8 Link Timeout .................................................................................................................................... 9 Set Servo Commands ..................................................................................................................... 9 Mode Control....................................................................................................................................... 9 Mode Command Table.................................................................................................................... 9 Mode Control Decision Table ........................................................................................................ 10 Link Failure Behavior ........................................................................................................................ 10 AP50 GCS Port / Wireless Modem Connection diagram ................................................................. 11 GCS Adapter card ......................................................................................................................... 12 Change Notes ................................................................................................................................... 13 Support.............................................................................................................................................. 14 Manual Revision ...............................................................................................................................14

Warranty, Liability, and Lawful Use

UAV Flight Systems warrants its products against defects in material or workmanship for one (1) year from the original date of purchase. Failed products will be repaired or replaced, at UAV Flight Systems' discretion, during this period when returned undamaged and in original condition. UAV Flight Systems makes no warranty, representation or guarantee regarding the safety or suitability of its products for any given purpose; nor does UAV Flight Systems assume any liability arising from the use or application of any of its products and specifically disclaims any and all consequential and incidental damages. Purchasers and users assume all risk, responsibility and liability for use of these products, including any resulting loss or damage to persons or property. If the purchaser is not satisfied with any UAV Flight Systems product, it may be returned undamaged and in original condition within 30 days of purchase for a full refund (less shipping costs, and any taxes or fees imposed upon the user). Determination of condition is at the sole discretion of UAV Flight Systems. The purchaser or user assumes the responsibility for knowing and obeying all laws and regulations applicable in his/her jurisdiction, including any aviation and telecommunication regulations in the country of operation which may apply [e.g. by the Federal Aviation Administration (FAA) and the Federal Communications Commission (FCC) in the USA.]

GCS Communication Protocol

1

GCS Communication Protocol

This document covers GCS (Ground Control Station) communication protocol for UAV Flight Systems AutoPilots (currently AP50 only). All references to AutoPilot refer specifically to the AP50. The purpose of the manual is to document the GCS interface for the user that desires to develop a custom ground control station. It also gives technical users a more detailed understanding of the various control and monitoring capabilities of UAV Flight Systems AutoPilots. UAV Flight Systems offers a ground control station product called GroundPilot tm. More information can be found on our website ( www.uavflight.com ) Note: The AP50 AutoPilot uses the Metric System for distance and speed. All distance units are in meters, and speed units in kilometers per hour (kph, km/hr), unless otherwise noted

GCS Port ProtocolAn extensive remote command set is available through the dedicated GCS port on the AutoPilot. Commands sent through this port do not suspend navigation or mission tasks unless the link is locked for more than one second. All communications with the AutoPilot is in binary format. Commands listed in this manual are in hex. It is assumed that the user will perform the necessary conversion, either by base conversion, or via the appropriate programming language commands, or both. A message sent to the GCS port consists of the command followed by optional data, and ending with a byte checksum of all of the bytes of the message excluding the checksum byte. The AutoPilot will respond with the indicated response. For example the message 1, 25, 26 would set the desired speed to 25 km/hr and elicit a response of 1, 25, 26. Long data and integer data is sent and received MSB (Most Significant Byte) first. NOTE: Under no circumstances should the message sent from the GCS to the AutoPilot consist of a message packet greater than 8 bytes in length.

GCS Communication Protocol

2

AutoPilot Telemetry PacketThis binary data packet is sent by the AutoPilot to the GCS. Communications baud rate is selectable, and the default is 19.2k baud (see Link Baud Rate). The telemetry packet is sent once per second.

Parameter Time Mode/State Airspeed Ground speed Desired speed Altitude Desired altitude Track Desired track Roll Desired roll Turn rate DTR Pitch Desired pitch Waypoint LOP Heading Distance to WP Latitude Longitude Return heading Return distance Aileron Elevator Throttle Rudder Fix Quality Checksum

Size Byte Byte Integer Integer Integer Integer Integer Integer Integer Integer Integer Integer Integer Integer Integer Byte Integer Integer Integer Long Long Integer Integer Byte Byte Byte Byte Byte Byte

Units GPS seconds 0 - 4 / 1 - 6 (see Mode/State Parameter section) Kilometers per hour Kilometers per hour Kilometers per hour Meters Meters Degrees Degrees Degrees Degrees Degrees/second Degrees/second Degrees Degrees Next WP number Line of Position, degrees true Current heading, degrees true Meters/100, e.g. 12,345 m is expressed as 123 Milliarcseconds Milliarcseconds Degrees Meters/100, e.g. 12,345 m is expressed as 123

Count 1 2 3-4 5-6 7-8 9-10 11-12 13-14 15-16 17-18 19-20 21-22 23-24 25-26 27-28 29 30-31 32-33 34-35 36-39 40-43 44-45 46-47 48 49 50 51

Stat x x x x x

0 = no fix; 1 = 2D fix; 2 = 3D fix

52 53

- implemented and tested x not implemented, reads as zero (Note that the data items roll, desired roll, desired turn rate, pitch and desired pitch are not currently implemented.) There are a total of 54 bytes in this message: 1 byte message header (Command 3D, Telemetry see GCS Command Set table) 52 bytes of message data 1 byte checksum

GCS Communication Protocol

3

Mode/State ParameterThe Mode/State parameter returns two AutoPilot values that are combined into a single byte. The Mode is represented by the lower 4 bits of the byte, and the State is represented by the upper 4 bits of the byte. Parameter Bit number 7 State 6 5 4 3 Mode 2 1 0

Mode value = Mode/State reading AND 15 State value = Mode/State reading / 16

Mode Parameter ValuesSee Mode Control later in the manual.

State Parameter ValuesState 1 2 3 4 5 6 AP50 Accelerate Initial Climb Out Loiter Cruise Dash Land

GCS Communication Protocol

4

Beginning of Message (BOM) Detection and End of Message (EOM) EventBecause data is exchanged in binary format, there is no unique byte that may be used as a BOM or EOM indicator. The time interval between messages may be used to synchronize messages. The following algorithm works: IF serial port character event Put character into buffer Increment number of characters in buffer counter Start 30 ms EOM detect timer Start 3 second link fail detect timer IF EOM detect timer event IF number of character = expected number of characters Valid message(s) in buffer Handle messages Flush buffer ELSE Indicate bad packet Flush buffer IF link fail detector event Indicate link failure

Note: If the GCS sends a command to the AutoPilot which elicits a response, the response to the command will be sent, followed immediately by the AutoPilot Telemetry Packet. This means that there will be two messages in the input buffer.

GCS Communication Protocol

5

GCS Command SetAll commands consist of a command identification byte followed by Argument data (variable length from 1 to 5 bytes total), and a final checksum byte. Several commands are sent by the AutoPilot, and not by the GCS. See Notes list at the end of the table (next page).Cmd 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F Mnemonic Set DS Set DA Set DT Set DR Set DP Set DTR Set WPLAT Set WPLON Set LOP Set DM Set DWP Set ID Set WPS Set WPA Read ID Read batt1 Read batt2 Read AIN1 Read AIN2 Read WPLAT Read WPLON Read DLAT Read DLON Read Sats Read Fix Q Function Set desired speed Set desired altitude Set desired track Set desired roll Set desired pitch Set desired turn rate Set WP desired latitude Set WP desired longitude Set Line Of Position Set mode Set desired waypoint Set ID Set WP desired speed Set WP desired altitude Read ID Read batt1 voltage Read batt2 voltage Read A/D Input 1 Read A/D Input 2 Read latitude at WP Read longitude at WP Read desired latitude Read desired longitude Read number of satellites Read fix quality Argument integer integer integer integer integer integer byte, long byte, long integer byte byte long byte, integer byte, integer none none none none none WP (byte) WP (byte) none none none none Response [cmd, data (length), csum] 01, desired speed (integer), csum 02, desired altitude (integer), csum 03, desired track (integer), csum 04, desired roll (integer), csum 05, desired pitch (integer), csum 06, desired turn rate (integer), csum 07, WP, latitude (byte, long), csum 08, WP, longitude (byte, long), csum 09, desired LOP (integer), csum 0A, desired mode, csum 0B, desired WP, csum 0C, ID (long), csum 0D, WP, desired speed (byte,integer),csum 0E, WP, desired altitude (byte,integer),csum 10, ID (long), csum 11, batt1 voltage (integer), csum 12, batt2 voltage (integer), csum 13, AIN1, (integer), csum 14, AIN2, (integer), csum 15, WP lat (long), csum 16, WP lon (long), csum 17, latitude (long), csum 18, longitude (long), csum 1A, Satellites (byte), csum 1B, Quality (byte), csum Stat

x x x x x x x x x

Set S1 Set S2 Set S3 Set S4 Set S5 Set S6 Set S7 Set S8 Set S124 Set S78 Set C123

Set S1 position (Aileron) Set S2 position (Elevator) Set S3 position (Throttle) Set S4 position (Rudder) Set S5 position (Flaps) Set S6 position (Mission1) Set S7 position (Mission2) Set S8 position (Mission3) Set servos S1, 2, & 4 Set servos S7, 8 Set Control Lines 1, 2, 3

byte byte byte byte byte byte byte byte 3 bytes 2 bytes byte

21, New S1 (byte), csum 22, New S2 (byte), csum 23, New S3 (byte), csum 24, New S4 (byte), csum 25, New S5 (byte), csum 26, New S6 (byte), csum 27, New S7 (byte), csum 28, New S8 (byte), csum 29, New S1, S2, S4 (3 bytes), csum 2A, New S7, S8 (2 bytes), csum 2B, New C1, C2, C3 (byte), csum

x

NOTE: Command Set table continues on the next page

GCS Communication Protocol

6

Cmd 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F

Mnemonic Set LTO

Function Set link timeout

Argument byte

Response [cmd, data (length), csum] 30, New link timeout (byte), csum

Stat

Check GCS Telemetry Error NOP

Check if GCS enabled AutoPilot Telemetry packet Problem with message sent to AutoPilot No operation

none 1 = bad checksum 2 = bad type none

3C, support level (byte), csum 3D, 52-byte data packet, csum 3E, error type (byte), csum 3F, none, csum

x

Note 1: All messages, either to or from the AutoPilot, consist of a message type byte (cmd), zero or more bytes of data, and a one-byte additive checksum (csum in table). Note 2: An Integer is 2 bytes in length, long is 4 bytes in length Note 3: Commands 17, 18 (desired lat/lon) return lat/lon for current waypoint (the waypoint to which the AutoPilot is navigating) Note 4: Message types 3D and 3E are sent by the AutoPilot to the GCS, not to the AutoPilot by the GCS. If the either of these two messages were to be sent from the GCS, an error (bad type) message (3E, 2, 40) will be the response from the AutoPilot. Note 5: Commands 13, 14 (reading analog inputs) apply to the AP50 AutoPilot only. Status:

implemented and tested x implemented and not tested, or currently being tested

NOPMessage 3F, NOP, is intended to reset the failed link counter onboard the AutoPilot. The AutoPilot will monitor the time between messages from the GCS. If a preprogrammed time is exceeded, the AutoPilot will revert to UAV mode.

Fix QualityCommand 1B (Read fix quality) returns argument shown. Fix Quality No fix 2D fix 3D fix Argument 0 1 2

GCS Communication Protocol

7

Warning for Airspeed/AltitudeWaypoint speeds and altitudes stored in the Mission tables (either programmed from the Mission Menu of the AutoPilot, or set from the GCS with commands Set WPS and/or Set WPA), are disregarded if the GCS sends commands to set the desired speed (Set DS) or set the desired altitude (Set DA). If the GCS sends a Set DS (command 01) or a Set DA (command 02), the speed and altitude settings will be retained upon leaving a waypoint for the next flight leg. Any subsequent speed or altitude setting changes must be set with the Set DS and Set DA commands.

ChecksumCommands sent to the AutoPilot require a one byte checksum that is validated upon receipt of command before the command will be accepted. This byte is the sum or the byte remainder of the result of adding all of the preceding individual bytes of the message. Examples: The command to set desired altitude to 200 meters is: 2 (command) 200 (data); the checksum would be 202. The command to set the desired altitude to 300 meters is: 2 (command) 300 (integer data consisting of bytes 1 and 44); the checksum is 47.

Status The status column shows those messages that have been implemented, and whether they have been tested.

GCS Communication Protocol

8

Link TimeoutThe link timeout is a safety feature, designed to enable the AP50 to return to UAV mode (from RPV mode), if communication link is lost, or inactive, after a set length of time. The default timeout value is 99 seconds. Example: The operator switches to RPV mode to disable mission (waypoint) navigation, and to redirect the UAV in a northerly direction. If the communication link is lost, the UAV will continue to fly north, and the operator will have lost control unless the communication link is reestablished. With the link timeout feature, the AP50 will revert to UAV mode, and continue flying its programmed mission, once the preset link timeout has been reached.

Set Servo CommandsThe set servo commands take over control of the servos from the onboard AutoPilot, allowing a remote pilot to override the AutoPilot completely. This is similar to RC flight, but control is from the ground control station software on the computer, and via the GCS port. When controlling the flight surfaces (S1 through S5), it is recommended that the mode be set to RFRC first (see Mode Control section below). Control of the mission servos (S6-S8) is not affected by mode.

Mode ControlThe AutoPilot flight modes available are: RC RCRF RPVRF UAV direct RC transmitter control (PIC), AutoPilot stability augmentation disengaged GCS control of S1-S5 servos, AutoPilot stability augmentation disengaged semi-autonomous, AutoPilot stability augmentation engaged autonomous, navigation from stored commands, AutoPilot stability augmentation engaged

Mode Command TableCommand byte 0 2 3 4

Mode RC RCRF RPVRF UAV

The mode command byte and the mode status are the same, e.g. mode 0 indicates RC mode.

GCS Communication Protocol

9

Mode Control Decision TableTX On Off Off Off Off CH5 On X X X X Link Timeout X F F T F Set mode cmd = X None 2, 3 or 4 X 0 Mode 0 (RC) 4 2, 3 or 4 4 4 Link timeout forces UAV mode Cannot command RC modes Comment RC transmitter overrides any command

X = don't care (value is not a factor) RCRF (Mode 2) and RPVRF (Mode 3) will remain in effect until a new mode command is received over the link, or if the link timeout has been exceeded. The link timeout timer is reset upon receipt of each valid message.

Link Failure BehaviorIf the transmitted checksum and the received checksum do not match, the buffer will be emptied. An error message will be sent. The receive buffer is polled once every second. If a message type is unimplemented, the AutoPilot will respond with an error message. It is the responsibility of the GCS to resend a command if the received confirmation does not have the desired effect. The AutoPilot responds to all GCS commands. If the GCS does not receive a response from the AutoPilot, the GCS should assume that a link failure has occurred.

GCS Communication Protocol

10

AP50 GCS Port / Wireless Modem Connection diagramThe diagram below illustrates the connection of the AP50 GCS port (via the J1 header connector) to a MaxStream wireless modem module. Other brands of modems may be used with the AP50. This is simply a representative example of connecting a wireless modem. The AP50 GCS port is a TTL-level serial interface. The AP50 AutoPilot can supply up to 50mA via the GCS port. However, the XStream modules from MaxStream can draw up to 200mA of current, so a separate regulated power supply is required. A Comm Integration Board, providing modem mounting socket (MaxStream Xstream modules), connector to AP50 GCS, and onboard regulated power, will soon be available form UAV Flight Systems (contact us for part number and pricing.)

GCS port (J1 pins) 29 30 31

32

UAV Power (Main battery 6VDC nominal)

4Data In

3Data Out

Regulated Supply

11Gnd

(250mA output minimum) Gnd

10 XStream modulePower (+5VDC)

+5 VDC output

UAV Flight Systems Comm Integration Board

GCS Communication Protocol

11

GCS Adapter cardFor GCS software testing, it may be desirable to have a direct connection from the AP50 to the GCS computer. A GCS adapter card (p/n GCS-RT), designed to convert RS-232 to TTL, is available from UAV Flight Systems. This adapter (pictured below) connects the AP50 AutoPilot Serial Cable to the GCS connector on the AP50 Wiring Harness. Please contact us for pricing information.

GCS Communication Protocol

12

Change NotesYYMMDD 040927 Changes removed unimplemented commands 31-34, and associated references; removed RPVRC mode (Mode 1), and associated references; added GCS modem and GCS adapter information removed AP40 GCS support information; changed status of commands 0D, 0E, 1A updated mode/state information update on link baud rate added note 5 under GCS Command Set table added clarifications to AutoPilot Telemetry Packet information added commands 0D (Set WPS), and 0E (Set WPA); updated Warning on pg.5 data message length increased from 47 bytes to 54 bytes (see byte count 48 thru 53 for new features); deleted original commands 38, 39, 3A, 3B, 3C; new commands 2B, 3C, 3D, 3E; message checksum added added data type returned for commands 1A, 1B, removed set servo implemented indications, added altitude / speed change freeze (values remain in effect, see Warning on pg. 5). added explanation of checksum added fix quality and number of satellites commands added NOP command changed ID to a Long data type only, eliminated integer part changed all commands to explicit type added explicit message type to response to commands Removed read desired and actual values of those data contained in long data message. Command codes changed for unimplemented commands. Change set desired speed, altitude, roll, pitch, turn rate to integers, change messages to and from AutoPilot from byte+128 to integers Changed from feet and fps to meters and km/hour. Desired speed and desired altitude divisors changed from /10 and /100 to /2 and /20. Long data message desired speed and desired altitude byte values changed to integer values (which do not require division).

040624 040430 040324 040316 040305 040218 040109

031002

030701 030424 030331 030226 030214 030203 021113 021111 021101

GCS Communication Protocol

13

SupportPlease contact support at [email protected] for information on AutoPilot software versions and upgrades.

Manual Revision8 October 2004 UAV Flight Systems, Inc. 2004 All Rights Reserved

UAV Flight Systems, Inc.605 Parfet Street / Suite 201 Lakewood, Colorado 80215 USA www.UAVFlight.com 303.274.5400 tel 303.274.6160 fax

GCS Communication Protocol

14