LSM9DS1 and balancing math

1235»

Comments

  • No I have yet to try the comp filter, but am going to drop the EKF for now and give it a try.
    From what I have learned so far, the EKF is best used as an all inclusive formula (gyro, accel, gps, altimeter, compass, pitot, servos, engine, flaps, drag, user input, preset destinations...)
    With redundant sensors, the EKF implemented in that way would likely be suitable for actual aircraft
  • JwolfJwolf Posts: 74
    edited 2019-06-03 - 05:24:20
    ok I'll have time to work on this throughout the week...
    Are we sure this is correct?
    theta = 0.98*(theta+gy*Ts)+.02*accelAngle;

    At first glance it appears to me it should be:
    AccelX = atan2(ax,az)
    GyroX = gx*ts
    ThetaX = ThetaX + ((0.98*GyroX) + (.02*AccelX))
    Roll = ThetaX
  • Hi Jwolf,

    I'm positive the theta equation is correct. But I encourage you to try your own algorithms as well and see what you get. That's how you learn what works and what doesn't and most importantly why. Let us know what you come up with.

    David
  • @Jwolf
    The equation for finding the current amount of rotation using just the gyro is something like this.
    Pitch = Pitch + ((gx * 17.5 * dT) / 1000)
    

    So knowing that equation you can combine it with your comp filter like this.
    theta = 0.98*(theta+((gx * 17.5 * dT) / 1000))+.02*accelAngle
    

    I'm not sure but doesn't the Atan2 function return a result in radians? If so the ACC angle needs to be converted to degrees. I don't have access to the PC that I use with the propeller, sadly my garage is tore up and my pc has been put away for safe keeping.





Sign In or Register to comment.