anshchawla521 / DIY_FC

GNU General Public License v3.0
0 stars 1 forks source link

Angle overflows after 360 degree #11

Closed anshchawla521 closed 1 year ago

anshchawla521 commented 1 year ago

When trying to go to 200 degrees in stabilize mode the drone does 3 flips and then falls . It is suspected that after reaching 359 degrees it counts from 360 and above instead of resetting to 0.

When the roll stick is reflected to its max the drone completes a half roll and reaches 200 degree now when the stick is released it tries to come back the same path in which it rotated (longer path) rather than completing the flip and taking the shorter path

anshchawla521 commented 1 year ago

That theory is wrong, The angle calculated by madgwick filter lies between -180 degree to + 180 degree hence when we try to go to 200 degree the drone is unable to do so and see a sudden jump in angle from -180 to + 180 and the differential part of PID goes crazy. Hence don't implement max angle in stable mode more than 180 degree, heck yeah to be safe don't go more than 80 degree