X-Git-Url: http://git.maemo.org/git/?p=mardrone;a=blobdiff_plain;f=mardrone%2FARDrone_SDK_Version_1_8_20110726%2FExamples%2FLinux%2Fsdk_demo%2FSources%2FNavdata%2Fnavdata.c;fp=mardrone%2FARDrone_SDK_Version_1_8_20110726%2FExamples%2FLinux%2Fsdk_demo%2FSources%2FNavdata%2Fnavdata.c;h=e1f1692c4783c1bb6784a4c3c450aeeacb11e512;hp=0000000000000000000000000000000000000000;hb=9ec9bc13b75d30bc45535c54a652934debfcea92;hpb=ae0a3c2dc0898400aca0dd6b439c5db8044db7b2 diff --git a/mardrone/ARDrone_SDK_Version_1_8_20110726/Examples/Linux/sdk_demo/Sources/Navdata/navdata.c b/mardrone/ARDrone_SDK_Version_1_8_20110726/Examples/Linux/sdk_demo/Sources/Navdata/navdata.c new file mode 100644 index 0000000..e1f1692 --- /dev/null +++ b/mardrone/ARDrone_SDK_Version_1_8_20110726/Examples/Linux/sdk_demo/Sources/Navdata/navdata.c @@ -0,0 +1,40 @@ +#include + +#include +#include + +/* Initialization local variables before event loop */ +inline C_RESULT demo_navdata_client_init( void* data ) +{ + return C_OK; +} + +/* Receving navdata during the event loop */ +inline C_RESULT demo_navdata_client_process( const navdata_unpacked_t* const navdata ) +{ + const navdata_demo_t*nd = &navdata->navdata_demo; + + printf("=====================\nNavdata for flight demonstrations =====================\n\n"); + + printf("Control state : %i\n",nd->ctrl_state); + printf("Battery level : %i mV\n",nd->vbat_flying_percentage); + printf("Orientation : [Theta] %4.3f [Phi] %4.3f [Psi] %4.3f\n",nd->theta,nd->phi,nd->psi); + printf("Altitude : %i\n",nd->altitude); + printf("Speed : [vX] %4.3f [vY] %4.3f [vZPsi] %4.3f\n",nd->theta,nd->phi,nd->psi); + + printf("\033[8A"); + + return C_OK; +} + +/* Relinquish the local resources after the event loop exit */ +inline C_RESULT demo_navdata_client_release( void ) +{ + return C_OK; +} + +/* Registering to navdata client */ +BEGIN_NAVDATA_HANDLER_TABLE + NAVDATA_HANDLER_TABLE_ENTRY(demo_navdata_client_init, demo_navdata_client_process, demo_navdata_client_release, NULL) +END_NAVDATA_HANDLER_TABLE +