Please sign in to comment.
Fix issue where Crazyflie spins uncontrollably if you bump it so it y…
…aws left while it's hovering. The problem was, the int16_t yawOutput value computed in controllerCorrectRatePID() will be negated in stabilizerTask(). However if it saturates to -32768, the +32768 can't fit in an int16_t, so it will roll over back to -32768, causing it to spiral out of control. The fix is to not allow that value. However, there's another issue: TRUNCATE_SINT16() is a macro, and will evaluate its second argument three times, thus calling pidUpdate() three times as often as necessary. This only affects CPU load, and may require modifying the PID constants to fix, so that will be in a later snapshot.
- Loading branch information...