void log_accel() {
	flog_push(7, 
			(float)flight_time
			,log[12]/1000.0f,log[13]/1000.0f,log[14]/1000.0f
			,log[15]/1000.0f,log[16]/1000.0f,log[17]/1000.0f
		 );
}
Ejemplo n.º 2
0
void log() {
	static unsigned long l = 0;
	static RTIME t1=rt_timer_read();
	static RTIME t2=rt_timer_read();
	static unsigned long dt;

	//calculate dt - time between runs in ms
	t2 = rt_timer_read();

	dt = (t2-t1)/1000000;
	t1 = t2;

	l++;
	if (l%200 == 0) { 
	if (inflight) { //create file log only when in flight
		flog_push(12
			,dt,dt
			,ms.ypr[0],ms.ypr[1],ms.ypr[2]
			,ms.gyro[0],ms.gyro[1],ms.gyro[2]
			,rec.yprt[0],rec.yprt[1],rec.yprt[2],rec.yprt[3]
			);
	}

		printf("c: %i\ty: %2.1f, p: %2.1f, r: %2.1f\tgy: %2.1f,gp: %2.1f,gr: %2.1f\try: %2.1f, rp: %2.1f, rr: %2.1f, rt: %2.1f\n"
			,ms.count
			,ms.ypr[0],ms.ypr[1],ms.ypr[2]
			,ms.gyro[0],ms.gyro[1],ms.gyro[2]
			,rec.yprt[0],rec.yprt[1],rec.yprt[2],rec.yprt[3]
			);
		}
}
void log_gyro() { //gyro & quat
	flog_push(8, 
			(float)flight_time
			,log[1]/100.0f,log[2]/100.0f,log[3]/100.0f
			,log[8]/1.f,log[9]/1.f,log[10]/1.f
			,log[11]/1.f
		 );
}
void log_quat() {
	flog_push(9, 
			(float)flight_time
			,log[4]/100.0f,log[5]/100.0f,log[6]/100.0f,log[7]/100.0f
			,log[8]/1.f,log[9]/1.f,log[10]/1.f
			,log[11]/1.f
		 );
}
void log_altitude() {
	flog_push(4, 
			(float)flight_time
			,log[18]/1.f,log[19]/1.f,log[20]/1.f
		 );
}