Header Overview

Example

The LLP comes with the following serial data protocol. You can poll sensor data from the UAV, as well as send control commands to the UAV.

You can download a small example for Linux here: LL_Example.tar.gz

To extract and compile the code run the following commands in a terminal:

This will create two example programs. The first one, called poll_once, simply polls some data from the UAV once. The second one, called att_cmds, continuously sends attitude commands to the UAV. You have to turn on the motors via RC and then enable the serial interface. Afterwards, the motors will slightly increase/decrease thrust every  two seconds.

Data structures LLP

LL STATUS: Status information of the low level processor
IMU RAWDATA: Sensor raw-values
IMU CALCDATA: Calibrated sensor outputs and data fusion results
CTRL OUT: Controller outputs
RC Data: Data received by the R/C receiver
GPS Data: GPS data
GPS Data Advanced: GPS data + position and speed estimates after data fusion

There is a unique packet descriptor/ID for every structure. Here is a list of all packet descriptors used in the system:

All structures are sent as follows:

startstring: >*>
length of structure: unsigned short
packet descriptor: unsigned char
the actual data structure: "length of structure" bytes
crc16: unsigned short
stopstring: <#<

CRC16 algorithm

 

Example use:

Requesting (polling) data structures LLP

The user can select the desired data structures by sending the following string to the vehicle.

The following list shows the bits of the data structures which you can set in "packets":

0x0001 LL Status
0x0002 IMU RawData
0x0004 IMU CalcData
0x0008 RC Data
0x0010 CTRL Out
0x0080 GPS Data
0x0100 current way
0x0200 GPS Data Advanced
0x0800 CAM Data

Please note that you can set as many bits at a time as required in your application. The vehicle will then transmit all structures that were requested and wait for the next poll. Due to the limited bandwidth of almost all kinds of radio modems it is recommended that you only request (poll) the packets you need, e.g. if you are only interested in the computed pitch and roll angles you should only poll IMU CalcData and none of the other packets.

Example how to poll for IMU_CalcData: Send >*>p0x0001 to the serial port.

Please note, that the GPS data fusion only runs, while the GPS Mode is active. In Height and Manual Mode, the GPS data fusion is not running.

Available data structures

Command Input LLP

The serial command interface must be enabled by the switch on channel 5 of your R/C. Please use the AscTec AutoPilot Control software, to see which position of the switch enables the serial interface.

 

During operation through the serial command interface the R/C has to stay on all the time to enable a safety pilot to take over if the autonomous control is not working as desired. Please make sure that there is always a safety pilot ready to immediately disable the serial interface and to take manual control of the vehicle.

If you are using the AscTec SDK and have your own HL control code enabled, the commands sent to the LL serial 0 are neglected!

 

Attitude Control

The pitch/roll/yaw command values are converted to real values as follows (depending on flight mode, CTRL ctrl byte):

GPS Mode:
Thrust: -2m/s to +2m/s (climb/sink rate)
Yaw: -200°/s to +200°/s (-300°/s to +300°/s for the Hummingbird)
Pitch/Roll: -3m/s to +3m/s over ground

Height Mode:
Thrust: -2m/s to +2m/s (climb/sink rate)
Yaw: -200°/s to +200°/s (-300°/s to +300°/s for the Hummingbird)
Pitch/Roll: -52° to +52° (approx. 15m/s, depending on environment)

Manual Mode:
Thrust: 0% to 100% thrust
Yaw: -200°/s to +200°/s (-300°/s to +300°/s for the Hummingbird)
Pitch/Roll: -52° to +52° (approx. 15m/s, depending on environment)

The checksum is calculated as follows right before the structure is sent:

The data should be sent to the vehicle with a minimum rate of 10 Hz over the XBee link as follows:

  1. send the startstring: >*>di

  2. directly followed by the data structure: UART_send( &CTRL_Input, sizeof(CTRL_Input));

If data is sent with significantly less than 10 Hz or if the transmission stops completely the system will switch back to manual control over the R/C.

Waypoint Navigation

Data structures

Waypoint data structure and definitions

Sending the waypoint structure

The following string must be sent to the vehicle, directly followed by the actual waypoint structure:

 

waypoint command

You will receive an acknowledge if a command or a waypoint was received correctly:

Acknowledgement

Other waypoint commands

  • >*>wg "Goto waypoint"
  • >*>wl "Launch / Set Home
  • >*>we "End flight => land at current position"
  • >*>wh "Come home"
Sending the launch command when the vehicle is hovering with the switch on the R/C in "GPS + Height control" sets the home position.