ButterFlight / butterflight

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

Pr Kalmann filter gyro acc pid 1G blackbox #255

Closed adrianmiriuta closed 5 years ago

adrianmiriuta commented 5 years ago

full Kalman filtering added GYRO ACC PID:

  1. use pid_kalman_q to adjust filtering ! (higher value -> less filtering)
  2. disable DYNAMIC_FILTER (if your quad is not extreme noisy)
  3. do not use gyro_kalman_q for noise filtering ! (it is intended only for boards with gyro supply problems, and filters outliers)
  4. PID are a little different to tune P in general a little lower D little higher
  5. this is beta please fly it with caution.

some start settings:

feature -DYNAMIC_FILTER set gyro_32khz_hardware_lpf = EXPERIMENTAL set gyro_sync_denom = 4 set gyro_calib_duration = 333 set gyro_overflow_detect = OFF set gyro_use_32khz = ON set pid_process_denom = 1 set debug_mode = PID_FILTER

details: Kalman GYRO, ACC, PID gyro -> gyro_filter -> PID -> pid_filter -> motors acc -> acc_filter -> PID

removed gyro_offset_yaw (obsolete) removed acc_unarmedcal (unused) added 2Gb flash support w25n01g including msc large file support renamed acc_limit -> rate_acc_limit renamed acc_limit_yaw -> rate_acc_limit_yaw reworked complete ACC calibration to a 6 point method (to do HOWTO for 6 point calibration) eliminated approx trigonometric functions (too large quaternion errors around 0° 90°) removed INFLIGHT_ACC_CAL optimized IMU dcm changed boardAlignment angles to decidegrees (configurator changes needed to synch) dual gyro use of different gyros allowed (see OMNIBUS FC) CLRACINGF7 target changes to use 2Gb flash OMNINXT target changes to use dual gyro

bubi-007 commented 5 years ago

hi, did you ever test this pr with helio? doens't work on helio but omninxt4 for example.

adrianmiriuta commented 5 years ago

@bubi-007 this PR is not intended for Helio boards.

They already have a modified Kalman controler in the imuf F3 code. If you want to use it with a helio board than disable kalman PID filter, and use d-term biquad filter.

bubi-007 commented 5 years ago

Not even a well known ONMIBUS F4 NEXT is working.

spatzengr commented 5 years ago

image

Red is unfiltered PID Sum Green is filtered PID Sum

It appears work is needed - unless already done - to reduce the signal delay of the filtering.


Below is same section of the low, with BBE 10% smoothing of unfiltered PID Sum turned off image

robert-b commented 5 years ago

you don't understand. you can configure the filter.

spatzengr commented 5 years ago

Talking to Adrian he says no. I'm no Kalman expert, but it can be vetted for viaibility (for real this time?).

From my Discord: image image

robert-b commented 5 years ago

https://quadmeup.com/butterflight_kalman_calculator/ math is not your domain - neither control laws

spatzengr commented 5 years ago

And comments like that are why you never get anywhere Rob.

I fully understand how the Q & R ratio effect the cutoff. But Andrian is working on real Kalman, not the Fake Kalman.

robert-b commented 5 years ago

switching over to a 'real' kalman is easy. take c++ and it looks the same :-)

i can't take mark spatz seriously when he is talking about stinking pt1 filters as saying so in the bf slack.

spatzengr commented 5 years ago

Do you have anything productive to add? Just doing flight tests and publishing results. Working with Andrian to see if we can make a success. He closed PR because you guys are idiots this is a waste of time here.

robert-b commented 5 years ago

https://www.youtube.com/watch?v=gJ4z48BRsh8 you find my name in the early days of the development. i did this type of filtering years ago - nothing new. and i used a same idea to calibrate the accelerometer. i just tried to get the new experience without using an imu-f.

looking at the pictures above and reading your comments i still see a leaning curve for you.

robert-b commented 5 years ago

oh, btw. the pull request has at least one programming bug which is quite severe plus two details where a logic problem (error) exists. you have 'tech' in your nickname. in case you know a few basic things - go and locate it. then we might discuss.