示例#1
0
//logging
void navLog_Send()
{
  char logbuf[1024];
  int logbuflen;

  float motval[4];
	mot_GetMot(motval);
    
  logcnt++;
  logbuflen=sprintf(logbuf,"%d,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f"
    //sequence+timestamp
    ,logcnt
    ,att.ts   // navdata timestamp in sec
    //sensor data
    ,att.ax   // acceleration x-axis in [G] front facing up is positive         
    ,att.ay   // acceleration y-axis in [G] left facing up is positive                
    ,att.az   // acceleration z-axis in [G] top facing up is positive             
    ,RAD2DEG(att.gx)   // gyro value x-axis in [deg/sec] right turn, i.e. roll right is positive           
    ,RAD2DEG(att.gy)   // gyro value y-axis in [deg/sec] right turn, i.e. pirch down is positive                     
    ,RAD2DEG(att.gz)   // gyro value z-axis in [deg/sec] right turn, i.e. yaw left is positive 
    ,att.hv   // vertical speed [cm/sec]
    //height
    ,setpoint.h  // setpoint height
    ,att.h       // actual height above ground in [cm] 
    ,throttle    // throttle setting 0.00 - 1.00
    //pitch
    ,RAD2DEG(setpoint.pitch)  //setpoint pitch [deg]
    ,RAD2DEG(att.pitch)       //actual pitch   
    ,adj_pitch                //pitch motor adjustment 
    //roll
    ,RAD2DEG(setpoint.roll)   //setpoint roll [deg]
    ,RAD2DEG(att.roll)        //actual roll  
    ,adj_roll                 //roll motor adjustment 
    //yaw
    ,RAD2DEG(setpoint.yaw)    //yaw pitch [deg]
    ,RAD2DEG(att.yaw)         //actual yaw  
    ,adj_yaw                  //yaw motor adjustment
  );    

  printf(logbuf);
//  udpClient_Send(&udpNavLog,logbuf,logbuflen); 
}
示例#2
0
//logging
void navLog_Send()
{
  char logbuf[512];
  int logbuflen;

  float motval[4];
	mot_GetMot(motval);
  
  logcnt++;//38
  logbuflen=sprintf(logbuf,(char*)" %.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f "
    //sequence+timestamp
    ,ahrsdata.tm   // navdata timestamp in sec
    ,ahrsdata.tm_pre   
    ,ahrsdata.frame

    ,ahrsdata.pitch_w  //=sum(gx * dt)
    ,ahrsdata.pitch_a  //=pitch(az,ax)
    ,ahrsdata.pitch    //kalman pitch estimate from gy and pitch_a

    //roll estimates in radians, positive is roll right (fly rightward)
    ,ahrsdata.roll_w   //=sum(gy * dt)
    ,ahrsdata.roll_a   //=roll(az,ay)
    ,ahrsdata.roll     //kalman roll estimate from gx and roll_a
  
    //yaw estimate, positive is yaw left
    ,ahrsdata.yaw_w      //=sum(gz * dt)
    ,ahrsdata.yaw_m      //=sum(gz * dt)
    ,ahrsdata.yaw      //=sum(gz * dt)

    ,ahrsdata.dt  // time since last navdata sample in sec
    ,ahrsdata.dt2 // time consumed by the ahrs calculations
    ,ahrsdata.q_est[0]
    ,ahrsdata.q_est[1]
    ,ahrsdata.q_est[2]
    ,ahrsdata.q_est[3]
    ,ahrsdata.b_est[0]
    ,ahrsdata.b_est[1]
    ,ahrsdata.b_est[2]
  
    //copy of physical navdata values
    ,ahrsdata.ts  // navdata timestamp in sec
    ,ahrsdata.hraw    // height above ground in [cm] 
    ,ahrsdata.h_meas// 1=height was measured in this sample, 0=height is copy of prev value

    ,ahrsdata.ax   // acceleration x-axis in [G] front facing up is positive         
    ,ahrsdata.ay   // acceleration y-axis in [G] left facing up is positive                
    ,ahrsdata.az   // acceleration z-axis in [G] top facing up is positive            
    ,ahrsdata.wx   // gyro value x-axis in [rad/sec] right turn, i.e. roll right is positive           
    ,ahrsdata.wy   // gyro value y-axis in [rad/sec] right turn, i.e. pirch down is positive                     
    ,ahrsdata.wz   // gyro value z-axis in [rad/sec] right turn, i.e. yaw left is positive
    ,ahrsdata.magX
    ,ahrsdata.magY 
    ,ahrsdata.magZ
    ,ahrsdata.pressure
    ,ahrsdata.rotX
    ,ahrsdata.rotY
    ,ahrsdata.rotZ
    ,ahrsdata.altd
    ,ahrsdata.motor1
    ,ahrsdata.motor2
    ,ahrsdata.motor3
    ,ahrsdata.motor4
  );    
  udpClient_Send(&udpNavLog,logbuf,logbuflen); 
}