ButterFlight / butterflight

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

copy and paste ... #153

Open robert-b opened 6 years ago

robert-b commented 6 years ago

https://github.com/ButterFlight/butterflight/blob/88adbaa3a5a6193353731bd6516e920e983be655/src/main/sensors/gyro.c#L1106

we need the single sample and not the rate change per microsecond.

adrianmiriuta commented 6 years ago

@robert-b this code is correct, a change would destroy Attitude calculus.

Please take your time and think, or test before opening issues without reason.

robert-b commented 6 years ago

surprise.

robert-b commented 6 years ago

you need to take the sum of the samples and divide it by the sample count. the code doesn't do anything to prevent drift. yes i know it destroys the attitude. fully flight tested: https://www.youtube.com/watch?v=TsI3Ag7eD0M

what does it destroy exactly?

adrianmiriuta commented 6 years ago

@robert-b this has nothing to do with drift

you have 2 time domains gyro loop (32k 16k ... xxx) and attitude calculus (runs at 200 Hz)

You have to sum up the gyro increments in the gyro loop (trapezium integration) and divide trough accumulation time in attitude loop to get the accumulated angular velocity for attitude quaternion integration.

if you divide it trough sample count you get a sampling average, not a accumulation average! (but you need a accumulation average ... absolute angle velocity )

that's all .

adrianmiriuta commented 6 years ago

@robert-b your FPV flight is acro-mode the change you propose only affects stabilized flight modes (which use Attitude quaternion).

robert-b commented 6 years ago

no

robert-b commented 6 years ago

it is not acro mode - just to prove the situation

robert-b commented 6 years ago

and btw. your view on the units is strange.

adrianmiriuta commented 6 years ago

@robert-b ok was nice talking to you ... bye

robert-b commented 6 years ago

what is your mother tongue?