I looked at heading_filter function as example.
It applies low pass on angle value. Angle value is a circular parameter. I think it’s invalid way to average angles.
Correct way of averaging angles is low pass on sin and cos, the normalization and reverting back to angle with atan2.
It seems everywhere in the code averaging of angles is not right.
Average between 170 and -170 degrees is 180. It’s not 0 or
whatever weighted currently coded in low pass filters.
Average between 1 and 359 is 0. It’s not 180
This will be possibly the reason people can’t get heading right even
with working IMUs.
I think it a serious bug.
I’ve reported it here: https://github.com/pypilot/pypilot/issues/258
Thanks,
Fair Winds!
It applies low pass on angle value. Angle value is a circular parameter. I think it’s invalid way to average angles.
Correct way of averaging angles is low pass on sin and cos, the normalization and reverting back to angle with atan2.
It seems everywhere in the code averaging of angles is not right.
Average between 170 and -170 degrees is 180. It’s not 0 or
whatever weighted currently coded in low pass filters.
Average between 1 and 359 is 0. It’s not 180
This will be possibly the reason people can’t get heading right even
with working IMUs.
I think it a serious bug.
I’ve reported it here: https://github.com/pypilot/pypilot/issues/258
Thanks,
Fair Winds!
Download BBN Marine OS for raspberry pi
https://bareboat-necessities.github.io/m...at-os.html
Video of actual installation:
https://www.youtube.com/watch?v=3zMjUs2X3qU
https://bareboat-necessities.github.io/m...at-os.html
Video of actual installation:
https://www.youtube.com/watch?v=3zMjUs2X3qU

