ArDrone SDK 1.8 added
[mardrone] / mardrone / ARDrone_SDK_Version_1_8_20110726 / ControlEngine / iPhone / Release / ARDroneTypes.h
1 /*
2  *  ARDroneTypes.h
3  *  ARDroneEngine
4  *
5  *  Created by Frédéric D'HAEYER on 21/05/10.
6  *  Copyright 2010 Parrot SA. All rights reserved.
7  *
8  */
9 #ifndef _ARDRONE_TYPES_H_
10 #define _ARDRONE_TYPES_H_
11 #include "ARDroneGeneratedTypes.h"
12
13 /**
14  * Define the command identifiers from drone to Game Engine
15  */
16 typedef enum {
17         ARDRONE_COMMAND_RUN, 
18         ARDRONE_COMMAND_PAUSE, 
19         ARDRONE_COMMAND_FIRE,
20 } ARDRONE_COMMAND_OUT;
21
22 /**
23  * Define the command identifiers from Game Engine to drone
24  */
25 typedef enum {
26         ARDRONE_COMMAND_ISCLIENT,                       // Command to set if the multiplayer is client
27         ARDRONE_COMMAND_DRONE_ANIM,                     // Command to set a drone animation
28         ARDRONE_COMMAND_DRONE_LED_ANIM,     // Command to set a drone led animation
29         ARDRONE_COMMAND_SET_CONFIG,                     // Command to set a drone configuration key
30         ARDRONE_COMMAND_ENABLE_COMBINED_YAW,// Command to enable / disable combined yaw command. 
31         ARDRONE_COMMAND_VIDEO_CHANNEL,          // Command to set the channel of video                                                          -- DEPRECATED
32         ARDRONE_COMMAND_CAMERA_DETECTION,       // Command to set camera type for detection.                                            -- DEPRECATED
33         ARDRONE_COMMAND_ENEMY_SET_PARAM,        // Command to set enemy parameter for detection (color and hull).       -- DEPRECATED
34         ARDRONE_COMMAND_SET_FLY_MODE,           // Command to change flying mode                                                                        -- DEPRECATED
35 } ARDRONE_COMMAND_IN;
36
37 typedef void (*command_in_configuration_callback)(int result);
38
39 typedef struct
40 {
41         ARDRONE_COMMAND_IN command;
42         command_in_configuration_callback callback;
43         void *parameter;
44 } ARDRONE_COMMAND_IN_WITH_PARAM;
45
46 typedef enum {
47         ARDRONE_FLYING_STATE_LANDED = 0,
48         ARDRONE_FLYING_STATE_FLYING,
49         ARDRONE_FLYING_STATE_TAKING_OFF,
50         ARDRONE_FLYING_STATE_LANDING,
51 } ARDRONE_FLYING_STATE;
52
53 typedef struct
54 {
55         ARDRONE_ENEMY_COLOR color;
56         int outdoor_shell;                      // 1 if enemy has outdoor shell, else 0 
57 } ARDRONE_ENEMY_PARAM;
58
59 typedef struct
60 {
61         ARDRONE_LED_ANIMATION led_anim;
62         float frequency;
63         unsigned int duration;
64 } ARDRONE_LED_ANIMATION_PARAM;
65
66 typedef struct
67 {
68         ARDRONE_ANIMATION drone_anim;
69         int timeout;
70 } ARDRONE_ANIMATION_PARAM;
71
72 /* Comments are used for autogeneration
73  * Do not modify these !
74  */
75 // MATCH_TYPES : int : int32_t bool_t
76 // MATCH_TYPES : unsigned int : uint32_t
77 // MATCH_TYPES : float : float32_t
78 // MATCH_TYPES : double : float64_t
79 /* End of autogeneration comments */
80
81 typedef struct
82 {
83         ARDRONE_CONFIG_KEYS config_key;
84         void *pvalue;
85 } ARDRONE_CONFIG_PARAM;
86
87 /**
88  * Define what a 3D vector is
89  */
90 typedef struct
91 {
92         float x;
93         float y;
94         float z;
95 }
96 ARDroneVector3D;
97
98 /**
99  * Define a structure to collect drone's navigation data
100  */
101 typedef struct
102 {
103         /**
104          * Translation speed of the drone, in meters per second
105          */
106         ARDroneVector3D linearVelocity;
107         
108         /**
109          * Rotation speed of the drone, in degré
110          */
111         ARDroneVector3D angularPosition;
112         
113         /**
114          * Navdata video num frames to synchronized Navdata with video
115          */
116         int navVideoNumFrames;
117         
118         /**
119          * Video num frames to synchronized Navdata with video
120          */
121         int videoNumFrames;
122         
123         /**
124          * Value indicates drone flying state (see ARDRONE_FLYING_STATE enum) 
125          */
126         ARDRONE_FLYING_STATE flyingState;
127         
128         /**
129          * int indicates drone is in emergency state  (1 if is in emergency, 0 else)
130          */
131         int emergencyState;
132         
133         /**
134          * Camera detection type
135          */
136         ARDRONE_CAMERA_DETECTION_TYPE detection_type;
137         
138         /**
139          * Number of finish lines detected
140          */
141         unsigned int finishLineCount;
142         
143         /**
144          * Number of double taps detected
145          */
146         unsigned int doubleTapCount;
147     
148     /**
149      * Tells the application that the ardrone engine is done with initial configuration so the application can send their own configs
150      * (1 if application can send config, 0 otherwise)
151      */
152     int isInit;
153 }
154 ARDroneNavigationData;
155
156 /**
157  * Define a structure to exchange an enemy data
158  */
159 typedef struct
160 {
161         /**
162          * Position of the enemy (between -1.0 and 1.0)
163          */
164         ARDroneVector3D position;
165         
166         /**
167          * Size of the enemy (between 0.0 and 2.0)
168          */
169         float height, width;
170         
171         /**
172          * Angle of the enemy (between -90.0° and 90.0°)
173          */
174         float orientation_angle;
175 }
176 ARDroneEnemyData;
177
178 /**
179  * Define a structure to exchange camera parameters compute by detection
180  */
181 typedef struct
182 {
183         /**
184          * Rotation matrix of camera
185          */
186         float rotation[3][3];
187         
188         /**
189          * Translation matrix of camera
190          */
191         float translation[3];
192         
193         /**
194          * Index of tag detected
195          */
196         int tag_index;
197
198 ARDroneDetectionCamera;
199
200 /**
201  * Define a structure to exchange camera parameters compute by drone
202  */
203 typedef struct
204 {
205         /**
206          * Rotation matrix of camera
207          */
208         float rotation[3][3];
209         
210         /**
211          * Translation matrix of camera
212          */
213         float translation[3];
214
215 ARDroneCamera;
216
217 /**
218  * Define a structure to exchange all enemies data
219  */
220 typedef struct
221 {
222         /**
223          * Number of enemies
224          */
225         unsigned int count;
226         
227         /**
228          * Pointer to an array that contains the data structure of each enemy
229          */
230         ARDroneEnemyData data[ARDRONE_MAX_ENEMIES];
231 }
232 ARDroneEnemiesData;
233
234 #endif // _ARDRONE_TYPES_H_