예제 #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 ;

}
예제 #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 ;

}