ArDrone SDK 1.8 added
[mardrone] / mardrone / ARDrone_SDK_Version_1_8_20110726 / Examples / Linux / sdk_demo / Sources / Navdata / navdata.c
1 #include <ardrone_tool/Navdata/ardrone_navdata_client.h>
2
3 #include <Navdata/navdata.h>
4 #include <stdio.h>
5
6 /* Initialization local variables before event loop  */
7 inline C_RESULT demo_navdata_client_init( void* data )
8 {
9   return C_OK;
10 }
11
12 /* Receving navdata during the event loop */
13 inline C_RESULT demo_navdata_client_process( const navdata_unpacked_t* const navdata )
14 {
15         const navdata_demo_t*nd = &navdata->navdata_demo;
16
17         printf("=====================\nNavdata for flight demonstrations =====================\n\n");
18
19         printf("Control state : %i\n",nd->ctrl_state);
20         printf("Battery level : %i mV\n",nd->vbat_flying_percentage);
21         printf("Orientation   : [Theta] %4.3f  [Phi] %4.3f  [Psi] %4.3f\n",nd->theta,nd->phi,nd->psi);
22         printf("Altitude      : %i\n",nd->altitude);
23         printf("Speed         : [vX] %4.3f  [vY] %4.3f  [vZPsi] %4.3f\n",nd->theta,nd->phi,nd->psi);
24
25         printf("\033[8A");
26
27   return C_OK;
28 }
29
30 /* Relinquish the local resources after the event loop exit */
31 inline C_RESULT demo_navdata_client_release( void )
32 {
33   return C_OK;
34 }
35
36 /* Registering to navdata client */
37 BEGIN_NAVDATA_HANDLER_TABLE
38   NAVDATA_HANDLER_TABLE_ENTRY(demo_navdata_client_init, demo_navdata_client_process, demo_navdata_client_release, NULL)
39 END_NAVDATA_HANDLER_TABLE
40