dlktdr / HeadTracker

This project is built to record the orientation a FPV headset to allow the camera on your RC to follow your head movements.
GNU General Public License v3.0
377 stars 89 forks source link

Auto Gyro #140

Closed dlktdr closed 1 year ago

dlktdr commented 1 year ago

This PR constantly monitors the Gyro + Accel for no motion. When no motion is detected it takes a Weighted Average of XX(300) samples.

1 - To detect no motion I first compute the magnitude of the Gyro X,Y,Z + Accel X,Y,Z. Then differentiate it. If this rate of change is lower than a threshold is considered no motion. Found values for the Nano33BLE while it was sitting still, giving small bumps and larger bumps to find an appropriate value but still above the noise floor.

Below are photos of the differential of the gyro magnitude. First 3 are me tapping my finger lightly on my desk. Next 3 are tapping harder on the desk, Next 3 are tapping lightly on the board Next 3 are tapping heavily on the board

image image Second photo is the first bump in above. Went with 175 for the value as it was still giving consistent offsets when placed still.

The accelerometer was very easy to tell where to set the value. image

Kst Plot Above -- It's pretty nice! https://github.com/Kst-plot/kst-build/

2 - If sitting still starts running a weighted average on the values for XX samples ! If it ever climbs above the no-motion threshold sampling starts all over

3 - After XX stable samples the average is compared to flash values, if either X,Y or Z are off by more than XX(0.5) degs/sec. Flash is updated with the new values.

TODO: DTQSys Board needs to be confirmed the values work here too.