AnsweredAssumed Answered

Using Freescale Sensor Fusion Library with FRDM-SFUSION board



I am trying to use the FRDM-SFUSION kit with the k64f MCU to do some motion sensing. However, I am having a little trouble understanding exactly how to implement the functions that are provided. What I want to do is grab linear acceleration data in NED coordinates. I think I need to use  the fRun_9DOF_GBY_KALMAN function on line 1090 of the fusion.c file. In this function (lines 1519-1513) is see this


// gravity positive NED

  pthisSV->faGlPl[X] = -pthisSV->faGlPl[X];

  pthisSV->faGlPl[Y] = -pthisSV->faGlPl[Y];

  pthisSV->faGlPl[Z] = -(pthisSV->faGlPl[Z] - 1.0F);



With a comment above saying:


// compute the linear acceleration in the global frame from the accelerometer measurement (sensor frame).

// de-rotate the accelerometer measurement from the sensor to global frame using the inverse (transpose)

// of the a posteriori rotation matrix


It seems to me that this is the code that I am looking for. My problem is that there are a lot of inputs to this function, and I am not sure what all of them mean. Here is the entire function that I am trying to call.


void fRun_9DOF_GBY_KALMAN(struct SV_9DOF_GBY_KALMAN *pthisSV, struct AccelSensor *pthisAccel, struct MagSensor *pthisMag, struct GyroSensor *pthisGyro,

  struct MagCalibration *pthisMagCal, int16 ithisCoordSystem, int16 iOverSampleRatio)


I am wondering if someone could just give me an example of how to call this function. Again, I am using the NED coordinates, and don't care about over sampling.


Also, once I have called this function, would assigning the values look something like this?


accx = SV_9DOF_GBY_KALMAN.faGlPl[X]