40 #include "flightstatus.h"
41 #include "stabilizationdesired.h"
42 #include "systemsettings.h"
63 if (reset_controller) {
64 FlightStatusArmedOptions armed;
65 FlightStatusArmedGet(&armed);
69 uint8_t flight_status;
70 FlightStatusFlightModeGet(&flight_status);
71 if (flight_status != FLIGHTSTATUS_FLIGHTMODE_FAILSAFE || reset_controller) {
72 flight_status = FLIGHTSTATUS_FLIGHTMODE_FAILSAFE;
73 FlightStatusFlightModeSet(&flight_status);
77 SystemSettingsAirframeTypeGet(&airframe_type);
79 StabilizationDesiredData stabilization_desired = {};
80 stabilization_desired.Thrust = 0;
81 stabilization_desired.Roll = 0;
82 stabilization_desired.Pitch = 0;
83 stabilization_desired.Yaw = 0;
85 stabilization_desired.ReprojectionMode = STABILIZATIONDESIRED_REPROJECTIONMODE_NONE;
86 stabilization_desired.ThrustMode = STABILIZATIONDESIRED_THRUSTMODE_DIRECT;
90 stabilization_desired.StabilizationMode[STABILIZATIONDESIRED_STABILIZATIONMODE_ROLL] = STABILIZATIONDESIRED_STABILIZATIONMODE_DISABLED;
91 stabilization_desired.StabilizationMode[STABILIZATIONDESIRED_STABILIZATIONMODE_PITCH] = STABILIZATIONDESIRED_STABILIZATIONMODE_DISABLED;
92 stabilization_desired.StabilizationMode[STABILIZATIONDESIRED_STABILIZATIONMODE_YAW] = STABILIZATIONDESIRED_STABILIZATIONMODE_DISABLED;
94 stabilization_desired.StabilizationMode[STABILIZATIONDESIRED_STABILIZATIONMODE_ROLL] = STABILIZATIONDESIRED_STABILIZATIONMODE_FAILSAFE;
95 stabilization_desired.StabilizationMode[STABILIZATIONDESIRED_STABILIZATIONMODE_PITCH] = STABILIZATIONDESIRED_STABILIZATIONMODE_FAILSAFE;
96 stabilization_desired.StabilizationMode[STABILIZATIONDESIRED_STABILIZATIONMODE_YAW] = STABILIZATIONDESIRED_STABILIZATIONMODE_FAILSAFE;
99 StabilizationDesiredSet(&stabilization_desired);
Process transmitter inputs and use as control source.
int32_t failsafe_control_select(bool reset_controller)
Use failsafe mode.
int32_t failsafe_control_update()
Perform any updates to the failsafe controller.
Failsafe controller when transmitter control is lost.
static SystemSettingsAirframeTypeOptions airframe_type
Includes PiOS and core architecture components.
int32_t failsafe_control_initialize()
Initialize the failsafe controller.
static bool armed_when_enabled