Esempio n. 1
0
int main ( int argc, char** argv, char** envv ) {

	int i ;
	ARDrone* bob ;
	NavData  data ;

	bob = ARDrone_new( "192.168.1.1" ) ;

	ARDrone_connect( bob ) ;
		
	ARDrone_trim ( bob ) ;
	
	sleep(5) ;

	for ( i=0; i<15; i++ ) {

		sleep(1) ;
		ARDrone_get_navdata( bob, &data ) ;
		printf( "state %d - bat %d \n", data.state, data.bat ) ;
	}

	ARDrone_free( bob ) ;


	return 0 ;

}
Esempio n. 2
0
/* test gps
version du 29/11/13 BJ
test de navdata.state
//00 |  FLY MASK : (0) ardrone is landed, (1) ardrone is flying
//01 |  VIDEO MASK : (0) video disable, (1) video enable
//02 |  VISION MASK : (0) vision disable, (1) vision enable
//03 |  CONTROL ALGO : (0) euler angles control, (1) angular speed control
//04 |  ALTITUDE CONTROL ALGO : (0) altitude control inactive (1) altitude control active
//05 |  USER feedback : Start button state
//06 |  Control command ACK : (0) None, (1) one received
//07 |  Trim command ACK : (0) None, (1) one received
//08 |  Trim running : (0) none, (1) running
//09 |  Trim result : (0) failed, (1) succeeded
//10 |  Navdata demo : (0) All navdata, (1) only navdata demo
//11 |  Navdata bootstrap : (0) options sent in all or demo mode, (1) no navdata options sent
//12 |  Motors status : (0) Ok, (1) Motors Com is down
//13 | 
//14 |  Bit means that there's an hardware problem with gyrometers
//15 |  VBat low : (1) too low, (0) Ok
//16 |  VBat high (US mad) : (1) too high, (0) Ok
//17 |  Timer elapsed : (1) elapsed, (0) not elapsed
//18 |  Power : (0) Ok, (1) not enough to fly
//19 |  Angles : (0) Ok, (1) out of range
//20 |  Wind : (0) Ok, (1) too much to fly
//21 |  Ultrasonic sensor : (0) Ok, (1) deaf
//22 |  Cutout system detection : (0) Not detected, (1) detected
//23 |  PIC Version number OK : (0) a bad version number, (1) version number is OK
//24 |   ATCodec thread ON : (0) thread OFF (1) thread ON
//25 |  Navdata thread ON : (0) thread OFF (1) thread ON
//26 |   Video thread ON : (0) thread OFF (1) thread ON
//27 |   Acquisition thread ON : (0) thread OFF (1) thread ON
//28 |   CTRL watchdog : (1) delay in control execution (> 5ms), (0) control is well scheduled // Check frequency of control loop
//29 |  ADC Watchdog : (1) delay in uart2 dsr (> 5ms), (0) uart2 is good // Check frequency of uart2 dsr (com with adc)
//30 | Communication Watchdog : (1) com problem, (0) Com is ok // Check if we have an active connection with a client
//31 Emergency landing : (0) no emergency, (1) emergency

*/
int main ( int argc, char** argv, char** envv ) {

	int i , US, TRIM, BAT;
	ARDrone* bob ;
	NavData  data ;
	float latitude;
	int64_t lat;
	bob = ARDrone_new( "192.168.10.3" ) ;
	ARDrone_connect( bob, 1 ) ;
	ARDrone_trim ( bob ) ;
	ARDrone_land (bob);
	i=1;
	while(i<40){
	ARDrone_get_navdata( bob, &data ) ;
 	printf("données gps latitude %lf longitude %lf elevation %lf \n",data.lat, data.lon, data.elevation);
 	printf("données gps hdop %lf vdop %lf \n", data.hdop, data.vdop);
 	sleep(2);
 	i=i+1;
 	
 	}
	ARDrone_free( bob ) ;

  
	return 0 ;

}
int main ( int argc, char** argv, char** envv ) {

	int iFrame ;
	ARDrone* bob ;
	YUV420Image* img ;

	img = YUV420Image_new(640,480) ;
	bob = ARDrone_new( "192.168.1.1" ) ;

	ARDrone_connect( bob ) ;
		
	ARDrone_trim ( bob ) ;
	
	iFrame = 0 ;

	while(1) {

		ARDrone_get_YUV420Image ( bob, img ) ;
		
		SaveFrame( img, iFrame ) ;
		iFrame++ ;

		usleep( 50000 ) ;
	}

	ARDrone_free( bob ) ;


	return 0 ;

}
int main ( int argc, char** argv, char** envv ) {

    int iFrame ;
    ARDrone* bob ;
    RGB24Image* img ;

    img = RGB24Image_new(640,480) ;
    bob = ARDrone_new( "192.168.1.1" ) ;

    ARDrone_connect( bob ) ;

    ARDrone_trim ( bob ) ;

    iFrame = 0 ;

    ARDrone_zap_camera ( bob, 1 ) ;

    sleep(2) ;

    for ( iFrame=0; iFrame<100; iFrame++ ) {

        ARDrone_get_RGB24Image ( bob, img ) ;
        SaveFrame( img, iFrame ) ;

    }

    ARDrone_zap_camera ( bob, 2 ) ;

    sleep(2) ;

    for ( iFrame=100; iFrame<200; iFrame++ ) {

        ARDrone_get_RGB24Image ( bob, img ) ;
        SaveFrame( img, iFrame ) ;

    }

    ARDrone_free( bob ) ;


    return 0 ;

}
Esempio n. 5
0
int main ( int argc, char** argv, char** envv ) {

	ARDrone* bob ;

	bob = ARDrone_new( "192.168.1.1" ) ;

	ARDrone_connect( bob ) ;

		
	ARDrone_trim ( bob ) ;
	
	sleep(2) ;

	ARDrone_reset_defaults( bob ) ;


	ARDrone_free( bob ) ;


	return 0 ;

}
int main ( int argc, char** argv, char** envv ) {

	ARDrone* bob ;
	GLWindow*   win ;
	YUV420Image* img ;
	RGB24Image* img2 ;
	unsigned char* picture;
	unsigned char* stream;
	//int i;

	img = YUV420Image_new(640,360) ; // ou 480
	img2 = RGB24Image_new(640,360);
	
	bob = ARDrone_new( "192.168.1.1" ) ;

	ARDrone_connect( bob ) ;
		
	ARDrone_trim ( bob ) ;
	
	sleep(2);

	ARDrone_zap_camera ( bob, 2 ) ;

	sleep(1);
	
	win = GLWindow_new ("glview", 640, 360, 0 ) ;

	while(1) 
	{		

		ARDrone_get_YUV420Image ( bob, img ) ;
		
		picture=convYUV( img );
		stream=convYUVtoRGB(picture) ;
		//for(i=0;i<30;i++)
		//{
		//	printf("%d ",picture[i]);
		//}
		
		ARDrone_get_RGB24Image ( bob, img2 ) ;
		
		GLWindow_draw_rgb(win,picture ); //img2->pixels
		
		GLWindow_swap_buffers(win);
		
		XEvent event;

		while ( GLWindow_next_event( win, &event ) ) 
		{

			GLWindow_process_events( win, event );
		
		}

		//printf("\n\n");
		usleep( 50000 ) ;
		//sleep(8);
	}

	ARDrone_free( bob ) ;
	free(picture);
	free(stream);


	return 0 ;

}