Paparazzi UAS  v5.2.2_stable-0-gd6b9f29
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
at_com.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2013 Freek van Tienen
3  *
4  * This file is part of paparazzi.
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 
28 
29 #ifndef BOARDS_ARDRONE_AT_COM_H
30 #define BOARDS_ARDRONE_AT_COM_H
31 
32 #define NAVDATA_HEADER (0x55667788)
33 
34 //Define the AT_REF bits
35 typedef enum {
36  REF_TAKEOFF = 1U << 9,
37  REF_EMERGENCY = 1U << 8,
38  REF_DEFAULT = 0x11540000
39 } AT_REFS;
40 
41 //Define control states
42 typedef enum {
54 } CTRL_STATES;
55 
56 //Define the AR.Drone states
57 typedef enum {
58  ARDRONE_FLY_MASK = 1U << 0,
59  ARDRONE_VIDEO_MASK = 1U << 1,
60  ARDRONE_VISION_MASK = 1U << 2,
65  ARDRONE_CAMERA_MASK = 1U << 7,
67  ARDRONE_USB_MASK = 1U << 9,
70  ARDRONE_MOTORS_MASK = 1U << 12,
71  ARDRONE_COM_LOST_MASK = 1U << 13,
73  ARDRONE_VBAT_LOW = 1U << 15,
74  ARDRONE_USER_EL = 1U << 16,
75  ARDRONE_TIMER_ELAPSED = 1U << 17,
78  ARDRONE_WIND_MASK = 1U << 20,
80  ARDRONE_CUTOUT_MASK = 1U << 22,
85  ARDRONE_ACQ_THREAD_ON = 1U << 27,
91 
92 //Navdata option packet without data
93 typedef struct _navdata_option_t {
97 } __attribute__ ((packed)) navdata_option_t;
98 
99 //Main navdata packet
100 typedef struct _navdata_t {
105 
106  navdata_option_t options[1];
107 } __attribute__ ((packed)) navdata_t;
108 
109 //Navdata checksum packet
110 typedef struct _navdata_cks_t {
114 } __attribute__ ((packed)) navdata_cks_t;
115 
116 //Navdata demo option
117 typedef struct _navdata_demo_t {
122  float theta;
123  float phi;
124  float psi;
126  float vx;
127  float vy;
128  float vz;
129  uint32_t num_frames; // Not used -> To integrate in video stage.
130  // Camera parameters compute by detection
131  struct FloatMat33 detection_camera_rot;
132  struct FloatVect3 detection_camera_trans;
135  // Camera parameters compute by drone
136  struct FloatMat33 drone_camera_rot;
137  struct FloatVect3 drone_camera_trans;
138 } __attribute__ ((packed)) navdata_demo_t;
139 
140 //Navdata physical measures option
141 typedef struct _navdata_phys_measures_t {
144 
145  float accs_temp;
147  struct FloatVect3 phys_accs;
148  struct FloatVect3 phys_gyros;
149  uint32_t alim3V3; // 3.3volt alim [LSB]
150  uint32_t vrefEpson; // ref volt Epson gyro [LSB]
151  uint32_t vrefIDG; // ref volt IDG gyro [LSB]
152 } __attribute__ ((packed)) navdata_phys_measures_t;
153 
154 //Navdata gps packet
155 typedef double float64_t; //TODO: Fix this nicely, but this is only used here
156 typedef float float32_t; //TODO: Fix this nicely, but this is only used here
157 typedef struct _navdata_gps_t {
160  float64_t lat;
161  float64_t lon;
162  float64_t elevation;
163  float64_t hdop;
165  uint8_t unk_0[8];
166  float64_t lat0;
167  float64_t lon0;
168  float64_t lat_fuse;
169  float64_t lon_fuse;
171  uint8_t unk_1[40];
172  float64_t vdop;
173  float64_t pdop;
174  float32_t speed;
176  float32_t degree;
177  float32_t degree_mag;
178  uint8_t unk_2[16];
179  struct{
182  }channels[12];
184  uint8_t unk_3[108];
185  float64_t gps_time;
189  uint8_t unk_4[24];
190  float64_t ned_vel_c0;
191  float64_t ned_vel_c1;
192  float64_t ned_vel_c2;
193  float64_t pos_accur_c0;
194  float64_t pos_accur_c1;
195  float64_t pos_accur_c2;
196  float32_t speed_acur;
197  float32_t time_acur;
198  uint8_t unk_5[72];
199  float32_t temprature;
200  float32_t pressure;
201 } __attribute__ ((packed)) navdata_gps_t;
202 
203 //External functions
204 extern void init_at_com(void);
205 extern int at_com_recieve_navdata(unsigned char* buffer);
206 extern void at_com_send_config(char* key, char* value);
207 extern void at_com_send_ftrim(void);
208 extern void at_com_send_ref(int bits);
209 extern void at_com_send_pcmd(int mode, float thrust, float roll, float pitch, float yaw);
210 extern void at_com_send_calib(int device);
211 
212 #endif /* BOARDS_ARDRONE_AT_COM_H */
uint16_t size
Definition: at_com.h:112
unsigned short uint16_t
Definition: types.h:16
AT_REFS
Definition: at_com.h:35
uint16_t tag
Definition: at_com.h:118
uint16_t tag
Definition: at_com.h:94
uint16_t value
Definition: adc_arch.c:585
uint32_t ctrl_state
Definition: at_com.h:120
int32_t data_available
Definition: at_com.h:164
float theta
Definition: at_com.h:122
float64_t elevation
Definition: at_com.h:162
uint16_t size
Definition: at_com.h:119
float64_t lon0
Definition: at_com.h:167
uint16_t size
Definition: at_com.h:159
float32_t time_acur
Definition: at_com.h:197
float32_t speed_acur
Definition: at_com.h:196
float float32_t
Definition: at_com.h:156
uint32_t vbat_flying_percentage
Definition: at_com.h:121
uint16_t size
Definition: at_com.h:95
float64_t gps_time
Definition: at_com.h:185
int at_com_recieve_navdata(unsigned char *buffer)
Definition: at_com.c:136
uint32_t cks
Definition: at_com.h:113
float64_t lat0
Definition: at_com.h:166
float32_t degree_mag
Definition: at_com.h:177
uint32_t vision_defined
Definition: at_com.h:104
unsigned char buffer[4096]
Definition: ahrs_ardrone2.c:47
float64_t lat
Definition: at_com.h:160
uint16_t week
Definition: at_com.h:186
void at_com_send_config(char *key, char *value)
Definition: at_com.c:153
uint8_t num_sattelites
Definition: at_com.h:188
void at_com_send_pcmd(int mode, float thrust, float roll, float pitch, float yaw)
Definition: at_com.c:177
float32_t degree
Definition: at_com.h:176
float64_t ned_vel_c0
Definition: at_com.h:190
uint8_t sat
Definition: at_com.h:180
float64_t lon_fuse
Definition: at_com.h:169
Paparazzi floating point algebra.
uint32_t detection_tag_index
Definition: at_com.h:133
uint8_t gps_fix
Definition: at_com.h:187
void at_com_send_ref(int bits)
Definition: at_com.c:170
uint32_t last_frame_timestamp
Definition: at_com.h:175
uint32_t ardrone_state
Definition: at_com.h:102
unsigned long uint32_t
Definition: types.h:18
uint32_t gps_state
Definition: at_com.h:170
void at_com_send_calib(int device)
Definition: at_com.c:194
float64_t lon
Definition: at_com.h:161
uint32_t header
Definition: at_com.h:101
float64_t pos_accur_c0
Definition: at_com.h:193
signed long int32_t
Definition: types.h:19
float64_t lat_fuse
Definition: at_com.h:168
float64_t pos_accur_c1
Definition: at_com.h:194
uint16_t tag
Definition: at_com.h:158
unsigned char uint8_t
Definition: types.h:14
float32_t pressure
Definition: at_com.h:200
float64_t ned_vel_c2
Definition: at_com.h:192
float64_t hdop
Definition: at_com.h:163
float32_t temprature
Definition: at_com.h:199
uint8_t data[1]
Definition: at_com.h:96
void at_com_send_ftrim(void)
Definition: at_com.c:163
uint32_t sequence
Definition: at_com.h:103
uint32_t detection_camera_type
Definition: at_com.h:134
float32_t speed
Definition: at_com.h:174
float64_t pos_accur_c2
Definition: at_com.h:195
double float64_t
Definition: at_com.h:155
void init_at_com(void)
Definition: at_com.c:55
float64_t ned_vel_c1
Definition: at_com.h:191
float64_t vdop
Definition: at_com.h:172
uint8_t cn0
Definition: at_com.h:181
int32_t gps_plugged
Definition: at_com.h:183
float64_t pdop
Definition: at_com.h:173
int32_t altitude
Definition: at_com.h:125
uint32_t num_frames
Definition: at_com.h:129
ARDRONE_STATES
Definition: at_com.h:57
CTRL_STATES
Definition: at_com.h:42
uint16_t tag
Definition: at_com.h:111