ButterFlight / butterflight

GNU General Public License v3.0
106 stars 26 forks source link

Acc calibration #110

Closed adrianmiriuta closed 6 years ago

adrianmiriuta commented 6 years ago

Acc calibration fails to level quad !

version

ButterFlight / HELIOSPRING (HESP) 3.5.1 Apr 10 2018 / 21:13:41 (49c2ac986) MSP API: 1.40

IMU-F Version: 106

screenshot from 2018-04-12 15-15-09

orneryd commented 6 years ago

Calibration doesn't "level" the quad. it levels it relative to gravity. If a table is 1 degree off it will be 1 degree off. image

image

adrianmiriuta commented 6 years ago

@orneryd If the FC is mounted with a few degrees misalignment (2° roll 3°pitch), or the MPU is soldered with a small angular offset ... You have to correct this offsets trough acc Calibration. (put quad level and calibrate !) Else you will get a offset in Attitude , and a drift in Level and Horizon modes !

orneryd commented 6 years ago

calibrating it won't make it flat in the UI, calibrating it will set the trims. if you go to the cli and type "set acc" you will see the trims set to compensate for the angle.

On Thu, Apr 12, 2018 at 9:41 PM, adrianmiriuta notifications@github.com wrote:

@orneryd https://github.com/orneryd If the FC is mounted with a few degrees misalignment (2° roll 3°pitch), or the MPU is soldered with a small angular offset ... You have to correct this offsets trough acc Calibration. (put quad level and calibrate !) Else you will get a offset in Attitude , and a drift in Level and Horizon modes !

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ButterFlight/butterflight/issues/110#issuecomment-381021560, or mute the thread https://github.com/notifications/unsubscribe-auth/ABp-H5YRYFJqdgs45hC9Jywhc4tgobLRks5toCyKgaJpZM4TRxF5 .

-- -Tim Sweet

adrianmiriuta commented 6 years ago

@orneryd I see , but it should level the Attitude quaternion,

It only fails to do so because someone deactivated acc handling in imuCalculateEstimatedAttitude bool useAcc = false;

This means Attitude is only calculated from gyro and will drift !

I tried to patch that (PR #112), but it was reverted !

orneryd commented 6 years ago

I fixed that in the refactor i did here:

    quaternion vGyroAverage;
    gyroGetAverage(&vGyroAverage);

    quaternion vAccAverage;
    if (accGetAverage(&vAccAverage) && accIsHealthy(&vAccAverage)) {
        applyAccError(&vAccAverage, &vError);
    }

However, that code does not get used with imu-f because we calculate the quaternion and pass it directly.