6 #include <gdk/gdkkeysyms.h>
8 #include <ardrone_api.h>
9 #include <VP_Api/vp_api_thread_helper.h>
10 #include <VP_Os/vp_os_signal.h>
12 #include <ardrone_tool/Control/ardrone_control.h>
13 #include <ardrone_tool/Control/ardrone_control_configuration.h>
15 // shared data allocation management
16 #ifdef KIHM_ALLOC_SHARED_DATA // defined only in ihm.c
19 #define KIHM_EXTERN extern
23 /* general declarations */
24 /* -------------------- */
25 extern int32_t ihm_val_idx;
26 KIHM_EXTERN int ihm_freeze_curves;
27 KIHM_EXTERN double ihm_psi;
28 KIHM_EXTERN double ihm_dir;
31 #define KIHM_PI 3.14159
32 #define KIHM_ZERO_F 0.0
33 #define KIHM_MIL_F 1000.0
36 #define MAX_STR_CTRL_STATE 256
40 KIHM_GC_RED, KIHM_GC_GREEN, KIHM_GC_BLUE, KIHM_GC_LIGHTRED, KIHM_GC_LIGHTBLUE, KIHM_GC_GREY, KIHM_GC_LIGHTGREY, KIHM_GC_DASHLINE, KIHM_GC_BLACK, KIHM_GC_WHITE, KIHM_NB_GC
42 KIHM_EXTERN GdkGC *ihm_GC[KIHM_NB_GC];
46 /* declarations for attitude display */
47 /* --------------------------------- */
55 KIHM_EXTERN GtkWidget *ihm_DA_att[KIHM_NB_DA_ATT];
56 KIHM_EXTERN PangoLayout *ihm_PL_DApsi, *ihm_PL_DAtheta, *ihm_PL_DAphi, *ihm_PL_DAdir;
60 ARDRONE_CONTROL_STATE,
65 /* declarations for altitude display */
66 /* --------------------------------- */
75 /* declarations for fix point display */
76 /* ---------------------------------- */
83 /* declarations for cocarde control display */
84 /* ---------------------------------------- */
92 /* declarations for control gains */
93 /* ------------------------------ */
97 #define NB_GAINS (NB_GAINS_W + NB_GAINS_EA)
98 #define NB_ALL_GAINS (NB_GAINS + NB_GAINS_ALT + NB_GAINS_FP + NB_GAINS_ROUNDEL)
100 /* Stephane : number of samples to display in detection history */
101 #define NB_DETECTION_SAMPLES 30
104 /* declarations for window size */
105 /* ---------------------------- */
106 #define KIHM_DAREA_ANGLE_X_SIZE 230
107 #define KIHM_DAREA_ANGLE_Y_SIZE 100
108 #define KIHM_DAREA_CURVE_X_SIZE 700
109 #define KIHM_DAREA_CURVE_Y_SIZE 170
110 #define KIHM_DAREA_CURVE_Y_OFFSET 8 // = half the height of a graduation label
112 #define KIHM_N_PT2PLOT KIHM_DAREA_CURVE_X_SIZE
114 #define KIHM_BORDER 10
115 /* #define KIHM_WX 3*KIHM_DAREA_ANGLE_X_SIZE+2*KIHM_BORDER+50 */
116 /* #define KIHM_WY KIHM_DAREA_ANGLE_Y_SIZE+2*KIHM_DAREA_CURVE_Y_SIZE+2*KIHM_BORDER */
119 #define GYRO_WIN_TITLE "Angular rates (gyrometers measures) in deg/s"
120 #define ACC_WIN_TITLE "Accelerations (accelerometers measures) in g"
121 #define THETA_WIN_TITLE "Theta (pitch) in deg"
122 #define PHI_WIN_TITLE "Phi (roll) in deg"
123 #define IMOT_WIN_TITLE "Imot in ADC LSB"
124 #define VBAT_WIN_TITLE "Vbat in V"
125 #define PWM_WIN_TITLE "PWM (0 < ratio < 255)"
126 #define CURRENT_WIN_TITLE "Motors currents in mA"
127 #define VX_WIN_TITLE "VX : speed in mm/s"
128 #define VY_WIN_TITLE "VY : speed in mm/s"
129 #define VZ_WIN_TITLE "VZ : speed in mm/s"
130 #define ALTITUDE_WIN_TITLE "Altitude : Reference and measure in mm"
132 #define NOT_DEF_VAL 0xdeadbeaf
133 #define HOVER_VAL 0xdecafef
136 extern GtkWidget *entry_PID[NB_ALL_GAINS], *entry_MiscVar[NB_MISC_VARS];
139 /* declarations for curves */
140 /* ----------------------- */
156 /* dock status of a curve */
157 /* -----------------------*/
167 typedef struct _SIHM_ScaleAttributes
169 double phys_range, phys_orig, phys_min, phys_max, phys_step;
170 int y_orig, y_min, y_max;
172 char grad_format[10];
173 GtkWidget *vBox_Grad;
175 SIHM_ScaleAttributes;
177 typedef struct _SIHM_CurveAttributes
179 char title[128], ctrl_lbl[32];
186 SIHM_ScaleAttributes *tSA;
188 GtkWidget *top, *DA, **lblVal, **label_Legend;
190 GtkWidget *PrivateWin, *PrivateVBox;
193 SIHM_CurveAttributes;
195 typedef struct _ihm_time {
204 KIHM_EXTERN SIHM_CurveAttributes ihm_CA[KIHM_NB_CURVES];
206 /* declarations for references */
207 /* --------------------------- */
208 extern int tab_r[4]; // Pitch, roll, yaw, gaz references
209 KIHM_EXTERN GtkWidget *ihm_label_RCref;
212 KIHM_EXTERN GtkWidget *nbDetectedTags_label;
213 KIHM_EXTERN GtkWidget *activeDetection_label;
215 extern char label_mykonos_state_value[32];
216 extern char label_ctrl_state_value[MAX_STR_CTRL_STATE];
217 extern char label_detection_state_value[32];
219 extern int32_t ihm_start;
221 void ihm_set_start_button_state( int32_t start );
223 void ihm_initCurves(GtkWidget *widget, int curve);
224 void ihm_destroyCurves(void);
226 void ihm_update_time( void );
227 void ihm_init_time( void );
229 PROTO_THREAD_ROUTINE(ihm , data);
231 extern vp_os_mutex_t ihm_lock;
232 extern int ihm_is_initialized;