Advertisement
Guest User

centripetal_compensation

a guest
Sep 21st, 2016
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* Use the gps velocity information to calculate the estimated centripetal force on the UAV
  2.  * REFER TO: http://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/20140002398.pdf by NASA for some centrifugal stuff.*/
  3. void AHRS_centripetal_compensation(IMU_t * imuStruct, float longitudinalSpeed)
  4. {
  5.  
  6.  
  7.     // Firstly, lets get the vectors:
  8.     sensor_vector_t angularRate = (sensor_vector_t) { 0 } ; // angular rate of the body (GYRO)
  9.     sensor_vector_t bodyVelocity = (sensor_vector_t) {0}; // velocity vector of the body (UAV GPS)
  10.     sensor_vector_t centripetalAcceleration = (sensor_vector_t) {0};
  11.  
  12.     angularRate = (sensor_vector_t){ imuStruct->gyro.x, imuStruct->gyro.y, imuStruct->gyro.z };
  13.     bodyVelocity.x = longitudinalSpeed;
  14.  
  15.     // Now centripetal acceleration = angular rate x body velocity.
  16.     crossProduct(&centripetalAcceleration, angularRate, bodyVelocity);
  17.  
  18.     // Finally, we can remove the centripetal acceleration from the body acceleration values:
  19.     imuStruct->acceleration.x -= centripetalAcceleration.x;
  20.     imuStruct->acceleration.y -= centripetalAcceleration.y;
  21.     imuStruct->acceleration.z -= centripetalAcceleration.z;
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement