void updateBehavior(void) { if (current_orientation == F_INVERTED) { if (canStabilizeHover() && rmat[7] < -14000) { current_orientation = F_HOVER; } else if (canStabilizeInverted() && rmat[8] < 6000) { current_orientation = F_INVERTED; } else { current_orientation = F_NORMAL; } } else if (current_orientation == F_HOVER) { if (canStabilizeHover() && rmat[7] < -8000) { current_orientation = F_HOVER; } else if (canStabilizeInverted() && rmat[8] < -6000) { current_orientation = F_INVERTED; } else { current_orientation = F_NORMAL; } } else { if (canStabilizeInverted() && rmat[8] < -6000) { current_orientation = F_INVERTED; } else if (canStabilizeHover() && rmat[7] < -14000) { current_orientation = F_HOVER; } else { current_orientation = F_NORMAL; } } if (flags._.pitch_feedback && !flags._.GPS_steering) { desired_behavior.W = current_orientation; } dcm_enable_yaw_drift_correction(current_orientation != F_HOVER); }
void yawCntrl(void) { if (canStabilizeHover() && current_orientation == F_HOVER) { hoverYawCntrl(); } else { normalYawCntrl(); } }
void pitchCntrl(void) { if (canStabilizeHover() && desired_behavior._.hover) { hoverPitchCntrl(); } else { normalPitchCntrl(); } }
void rollCntrl(void) { if (canStabilizeHover() && current_orientation == F_HOVER) { hoverRollCntrl(); } else { normalRollCntrl(); } }