from uart1.h in NaviCtrl code (please take a look at SVN for latest version of header files)

Navigation Data structures

The MikroKopter will send these data after getting the abbo command 'O' with interval and max bytes per second.

The MK will send differnt data sets. Data that did not change will be sent slower than sets that with changed data content.

The different data sets can be identified by the index.

Max Bytes per second

This value is used when starting the abbo.

It is used to keep the used bandwith to a specified (max) level according to the maximum data throughput of the communication interface.

A useful value could be 1024 for a good wireless transmission and 200 for a slow transmission like GSM-Modems etc.

Implementations of the data structure

   1 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   2 //+ New protocol
   3 //+ start abbo communication with: 'O' + Interval 1byte [10ms] + MaxBytesPerSecond (2Bytes)
   4 //+ i.e. 'O'+10+1024
   5 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   6 
   7 typedef struct // Index:10 (15 Bytes need 27 ASCII-characters)
   8 {
   9         u8 Index;                       // Index to identify this data set
  10         s32 ActualLongitude;    // 
  11         s32 ActualLatitude;             // 
  12         s16 Altimeter_5cm;              // hight -> devide by 20 to get meters & multiply with 5 to get cm
  13         u8 GroundSpeed;                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
  14         u8 OSDStatusFlags;              // see main.h for definitions OSD_FLAG_xxx
  15         u8 CamCtrlChar;                 // Status from a connected CamCtrl unit: 'R' = REC  'c' = Ready  '!' = Error  ...etc
  16 u8 reserve1;                     
  17 } __attribute__((packed)) NaviData_Tiny_t;
  18 extern NaviData_Tiny_t NaviData_Tiny;
  19 
  20 #define START_PAYLOAD_DATA  13  // 
  21 
  22 typedef struct  // Index:11 (24 Bytes need 39 ASCII-characters)
  23 {
  24         u8 Index;                       // Index to identify this data set
  25         s32 ActualLongitude;    // 
  26         s32 ActualLatitude;             // 
  27         s16 Altimeter_5cm;              // hight -> devide by 20 to get meters & multiply with 5 to get cm 
  28         u8 GroundSpeed;                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
  29         u8 OSDStatusFlags;              // see main.h for definitions OSD_FLAG_xxx
  30         u8 OSDStatusFlags2;             // see main.h for definitions OSD_FLAG2_xxx
  31         u8  NCFlags;                    // Flags from NC
  32 u8 ReserveFlags;
  33         u8  Errorcode;                  // 0 --> okay  see http://wiki.mikrokopter.de/ErrorCodes
  34         u8 SpeakHoTT;                   // voice output SPEAK_xxx (see spi_slave.h)
  35         u8 VarioCharacter;              // display as ascii character ('+' = 'climb' etc)
  36         u8 GPS_ModeCharacter;   // display as ascii character ('H' = 'Home' etc)
  37         u8 BL_MinOfMaxPWM;              // status byte of the BL-Ctrls
  38 } __attribute__((packed)) NaviData_Flags_t;
  39 extern NaviData_Flags_t NaviData_Flags;
  40 
  41 typedef struct  // Index:12  (27 Bytes need 43 ASCII-characters)
  42 {
  43         u8 Index;                       // Index to identify this data set
  44         s32 ActualLongitude;    // 
  45         s32 ActualLatitude;             // 
  46         s16 Altimeter_5cm;              // hight -> devide by 20 to get meters & multiply with 5 to get cm
  47         u8 GroundSpeed;                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
  48         u8 OSDStatusFlags;              // see main.h for definitions OSD_FLAG_xxx
  49         s32 TargetLongitude;    // 
  50         s32 TargetLatitude;             // 
  51         s16 TargetAltitude;     // hight according to air pressure
  52         u8  RC_Quality;                 // RC_Quality
  53 } __attribute__((packed)) NaviData_Target_t;
  54 extern NaviData_Target_t NaviData_Target;
  55 
  56 typedef struct  // Index:13  (30 Bytes need 47 ASCII-characters)
  57 {                                          
  58         u8 Index;                       // Index to identify this data set
  59         s32 ActualLongitude;    // 
  60         s32 ActualLatitude;             // 
  61         s16 Altimeter_5cm;              // hight -> devide by 20 to get meters & multiply with 5 to get cm
  62         u8 GroundSpeed;                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
  63         u8 OSDStatusFlags;              // see main.h for definitions OSD_FLAG_xxx
  64         s32 HomeLongitude;              // 
  65         s32 HomeLatitude;               // 
  66         s16 HomeAltitude;               // hight according to air pressure
  67         u16 WP_OperatingRadius; // current WP operation radius around the Home Position in m
  68         u8 LipoCellCount;
  69         u8 DescendRange;                // in [10m]
  70         u8 ManualFlyingRange;   // in [10m]
  71 u8 reserve1;
  72 u8 reserve2;
  73 } __attribute__((packed)) NaviData_Home_t;
  74 extern NaviData_Home_t NaviData_Home;
  75 
  76 typedef struct   // Index:14    (24 Bytes need 39 ASCII-characters)
  77 {
  78         u8 Index;                       // Index to identify this data set
  79         s32 ActualLongitude;    // 
  80         s32 ActualLatitude;             // 
  81         s16 Altimeter_5cm;              // hight -> devide by 20 to get meters & multiply with 5 to get cm
  82         u8 GroundSpeed;                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
  83         u8 OSDStatusFlags;              // see main.h for definitions OSD_FLAG_xxx
  84         u16 FlyingTime;                 // in seconds
  85         u16 DistanceToHome;             // [10cm] (100 = 10m)
  86         u8  HeadingToHome;              // in 2° (100 = 200°)
  87         u16 DistanceToTarget;   // [10cm] (100 = 10m)   
  88         u8  HeadingToTarget;    // in 2° (100 = 200°)
  89         s8  AngleNick;                  // current Nick angle in 1°
  90         s8  AngleRoll;                  // current Rick angle in 1°
  91         u8  SatsInUse;                  // number of satellites used for position solution
  92 } __attribute__((packed)) NaviData_Deviation_t;
  93 extern NaviData_Deviation_t NaviData_Deviation;
  94 
  95 typedef struct // Index:15 (18 Bytes need 31 ASCII-characters)
  96 {
  97         u8 Index;                       // Index to identify this data set
  98         s32 ActualLongitude;    // 
  99         s32 ActualLatitude;             // 
 100         s16 Altimeter_5cm;              // hight -> devide by 20 to get meters & multiply with 5 to get cm
 101         u8  GroundSpeed;                // speed over ground in 10cm/s (2D) (255 = 91km/h)
 102         u8 OSDStatusFlags;              // see main.h for definitions OSD_FLAG_xxx
 103         u8  WaypointIndex;              // index of current waypoints running from 0 to WaypointNumber-1
 104         u8  WaypointNumber;             // number of stored waypoints
 105         u8  TargetHoldTime;             // time in s to stay at the given target, counts down to 0 if target has been reached
 106         u8 WP_Eventchannel;             // the current value of the event channel
 107 u8 reserve;
 108 } __attribute__((packed)) NaviData_WP_t;
 109 extern NaviData_WP_t NaviData_WP;
 110 
 111 typedef struct // Index:16  (27 Bytes need 43 ASCII-characters)
 112 {
 113         u8 Index;                       // Index to identify this data set
 114         s32 ActualLongitude;    // 
 115         s32 ActualLatitude;             // 
 116         s16 Altimeter_5cm;              // hight -> devide by 20 to get meters & multiply with 5 to get cm
 117         u8 GroundSpeed;                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
 118         u8 OSDStatusFlags;              // see main.h for definitions OSD_FLAG_xxx
 119         u16 UBat;                               // Battery Voltage in 0.1 Volts
 120         u16 Current;                    // actual current in 0.1A steps
 121         u16 UsedCapacity;               // used capacity in mAh
 122         s8  Variometer;                 // climb(+) and sink(-) rate
 123         u8  Heading;                    // Current moving direction in 2° (100 = 200°)
 124         u8      CompassHeading;         // current compass value in 2°
 125         u8  Gas;                                // current gas (thrust)
 126         u16 ShutterCounter;             // counts every time a Out1 was activated
 127         s16 SetpointAltitude;   // setpoint for altitude
 128 } __attribute__((packed)) NaviData_Volatile_t;
 129 extern NaviData_Volatile_t NaviData_Volatile;
 130 
 131 
 132 typedef struct  // Index:17  (21 Bytes need 35 ASCII-characters)
 133 {
 134         u8 Index;                       // Index to identify this data set
 135         s32 ActualLongitude;    // 
 136         s32 ActualLatitude;             // 
 137         s16 Altimeter_5cm;              // hight -> devide by 20 to get meters & multiply with 5 to get cm
 138         u8 GroundSpeed;                 // speed over ground in 10cm/s (2D) (255 = 91km/h)
 139         u8 OSDStatusFlags;              // see main.h for definitions OSD_FLAG_xxx
 140         s32 Longitude;                  // Failsafe-Position
 141         s32 Latitude;                   // Failsafe-Position
 142 } __attribute__((packed)) NaviData_FS_Pos_t;
 143 extern NaviData_FS_Pos_t NaviData_Failsafe;
 144 
 145 typedef struct // Index:18  (9 Bytes need 19 ASCII-characters)
 146 {
 147         u8 Index;                               // Index to identify this data set
 148         s32 Longitude;                  // Trigger Position
 149         s32 Latitude;                   // Trigger Position
 150 } __attribute__((packed)) NaviData_Out_t;
 151 extern NaviData_Out_t NaviData_Out1Trigger;

OSD flags definitions

   1 // xxx.OSDStatusFlags   (multiple data sets)    -> this is the definition in the OSD data structure 
   2 #define OSD_FLAG_CAREFREE               0x01
   3 #define OSD_FLAG_ALTITUDE_CONTROL       0x02
   4 #define OSD_FLAG_CALIBRATE              0x04
   5 #define OSD_FLAG_OUT1_ACTIVE            0x08
   6 #define OSD_FLAG_OUT2_ACTIVE            0x10
   7 #define OSD_FLAG_LOWBAT                 0x20
   8 #define OSD_FLAG_VARIO_TRIM_UP          0x40
   9 #define OSD_FLAG_VARIO_TRIM_DOWN        0x80
  10 
  11 // NaviData_Flags.OSDStatusFlags2 (Index:11)    -> this is the definition in the OSD data structure 
  12 #define OSD2_FLAG_MOTOR_RUN             0x01
  13 #define OSD2_FLAG_FLY                   0x02
  14 #define OSD2_FLAG_RC_FAILSAVE_ACTIVE    0x04
  15 #define OSD2_FLAG_START                 0x08
  16 #define OSD2_FLAG_EMERGENCY_LANDING     0x10
  17 #define OSD2_FLAG_WAIT_FOR_TAKEOFF      0x20   // Motor Running, but still on the ground
  18 #define OSD2_FLAG_AUTO_STARTING         0x40
  19 #define OSD2_FLAG_AUTO_LANDING          0x80
  20