3 * @author aurelien.morelle@parrot.com & sylvain.gaeremynck@parrot.com
7 #include <ATcodec/ATcodec_api.h>
9 #include <ardrone_tool/ardrone_tool.h>
10 #include <ardrone_tool/Control/ardrone_control.h>
11 #include <ardrone_tool/Navdata/ardrone_navdata_client.h>
12 #include <ardrone_tool/Com/config_com.h>
14 #include <common/mobile_config.h>
15 //#include <UI/gamepad.h>
16 //#include <UI/wiimote.h>
18 #include <ihm/ihm_stages_o_gtk.h>
19 #include <navdata_client/navdata_client.h>
21 #ifdef USE_ARDRONE_VICON
22 #include <libViconDataStreamSDK/vicon.h>
23 #endif // USE_ARDRONE_VICON
26 #include <libPolaris/polaris.h>
27 #endif // PC_USE_POLARIS
29 #ifdef USE_TABLE_PILOTAGE
30 #include "libTestBenchs/novadem.h"
31 #endif // USE_TABLE_PILOTAGE
34 PROTO_THREAD_ROUTINE(raw_capture, params);
36 PROTO_THREAD_ROUTINE(remote_console, params);
38 static mobile_config_t cfg;
40 static int32_t exit_ihm_program = 1;
42 extern Controller_info *default_control;
43 extern GList *devices;
45 C_RESULT ardrone_tool_init_custom(int argc, char **argv)
47 gtk_init(&argc, &argv);
49 /// Init specific code for application
50 ardrone_navdata_handler_table[NAVDATA_IHM_PROCESS_INDEX].data = &cfg;
53 //ardrone_tool_input_add( &gamepad );
54 /*ardrone_tool_input_add( &radioGP );
55 ardrone_tool_input_add( &ps3pad );
56 ardrone_tool_input_add( &joystick );
57 ardrone_tool_input_add( &wiimote_device );*/
61 printf("Default control : %s (0x%08x, %s)\n", default_control->name, default_control->serial, default_control->filename);
62 ardrone_tool_input_add( &control_device );
63 cfg.default_control = default_control;
64 cfg.devices = devices;
66 #ifdef USE_ARDRONE_VICON
67 START_THREAD( vicon, &cfg);
68 #endif // USE_ARDRONE_VICON
70 START_THREAD(ihm, &cfg);
72 START_THREAD(raw_capture, &cfg);
74 START_THREAD(remote_console, &cfg);
75 START_THREAD(ihm_stages_vision, &cfg);
77 START_THREAD( polaris, &cfg );
78 #endif // PC_USE_POLARIS
79 #ifdef USE_TABLE_PILOTAGE
80 START_THREAD( novadem, (void*)("/dev/ttyUSB0") );
81 #endif // USE_TABLE_PILOTAGE
86 C_RESULT ardrone_tool_shutdown_custom()
88 #ifdef USE_TABLE_PILOTAGE
89 JOIN_THREAD( novadem );
90 #endif // USE_TABLE_PILOTAGE
92 JOIN_THREAD( polaris );
93 #endif // PC_USE_POLARIS
94 #ifdef USE_ARDRONE_VICON
96 #endif // USE_ARDRONE_VICON
98 JOIN_THREAD(ihm_stages_vision);
100 JOIN_THREAD(raw_capture);
102 JOIN_THREAD(remote_console);
104 /*ardrone_tool_input_remove( &gamepad );
105 ardrone_tool_input_remove( &radioGP );
106 ardrone_tool_input_remove( &ps3pad );
107 ardrone_tool_input_remove( &wiimote_device );*/
108 ardrone_tool_input_remove( &control_device );
113 C_RESULT signal_exit()
115 exit_ihm_program = 0;
122 bool_t ardrone_tool_exit()
124 return exit_ihm_program == 0;
128 THREAD_TABLE_ENTRY( ihm, 20 )
130 THREAD_TABLE_ENTRY( raw_capture, 20 )
132 THREAD_TABLE_ENTRY( remote_console, 20 )
133 THREAD_TABLE_ENTRY( ihm_stages_vision, 20 )
134 THREAD_TABLE_ENTRY( navdata_update, 20 )
135 THREAD_TABLE_ENTRY( ATcodec_Commands_Client, 20 )
136 THREAD_TABLE_ENTRY( ardrone_control, 20 )
137 #ifdef PC_USE_POLARIS
138 THREAD_TABLE_ENTRY( polaris, 20 )
139 #endif // PC_USE_POLARIS
140 #ifdef USE_ARDRONE_VICON
141 THREAD_TABLE_ENTRY( vicon, 20 )
142 #endif // USE_ARDRONE_VICON
143 #ifdef USE_TABLE_PILOTAGE
144 THREAD_TABLE_ENTRY( novadem, 20 )
145 #endif // USE_TABLE_PILOTAGE