htool / ESP32_Precision-9_compass_CMPS14

Digital compass acting as B&G Precision 9 based on ESP32 and CMPS14
18 stars 5 forks source link

Heave (vertical displacement in waves) estimation #8

Open mgrouch opened 3 months ago

mgrouch commented 3 months ago

I did some research on how it can be estimated based on vertical acceleration. There are two approaches.

One is by plugging acceleration into trochoidal wave model, which allows to calculate displacement from acceleration at any given time. It requires estimating frequency of the acceleration and adjusting it for Doppler effect due to boat moving through the waves. Estimating frequency of acceleration can be done without doing Fourier transform, by using Aranovskiy frequency estimator filter. Acceleration sampling need to be high frequency 100Hz or higher if possible.

Second method is Kalman filter that calculates double integral of acceleration into displacement and adjusts for drift of the integration based on average zero vertical displacement. Again acceleration sampling needs to be high (>= 100Hz)

Do you know what max frequency of acceleration sampling you can achieve with the IMU hardware you are using?

Here is write-up I did for both methods with all required formulas and algorithms:

https://bareboat-necessities.github.io/my-bareboat/bareboat-math.html

With Aranovskiy estimator it all can be done as a set of on-line filters.

Thanks

mgrouch commented 3 months ago

I’ve looked at datasheet for BNO085

https://www.ceva-ip.com/wp-content/uploads/2019/10/BNO080_085-Datasheet.pdf#page50

It looks like it can provide linear acceleration at 400Hz. Which is very promising

mgrouch commented 3 months ago

I’ve experimented a little with estimating wave frequency using IMU. I have m5atom with built in mpu6886 and tiny LCD to display it.

Here is the code

https://github.com/bareboat-necessities/bbn-wave-period-esp32

so far no tilt compensation, sample rate is too low 100Hz and I didn’t find the way to switch accelerometer rage from 8G to 2G for better readings (in ocean waves you have less than 2G accelerations). 1G is breaking wave.

If I can make good estimates for wave periods then I can add Kalman integrator, estimations from trochoidal model and Doppler adjustments.

I actually played with those too.

Good IMU is important, lower noise, higher sample rate, control over acceleration measurement range, less bias and drift on compass, as well as less lag in AHRS.