40 #include "flightstatus.h"
41 #include "geofencesettings.h"
42 #include "stabilizationdesired.h"
43 #include "systemalarms.h"
44 #include "systemsettings.h"
64 if (reset_controller) {
65 FlightStatusArmedOptions armed;
66 FlightStatusArmedGet(&armed);
70 uint8_t flight_status;
71 FlightStatusFlightModeGet(&flight_status);
72 if (flight_status != FLIGHTSTATUS_FLIGHTMODE_STABILIZED1 || reset_controller) {
73 flight_status = FLIGHTSTATUS_FLIGHTMODE_STABILIZED1;
74 FlightStatusFlightModeSet(&flight_status);
78 SystemSettingsAirframeTypeGet(&airframe_type);
82 StabilizationDesiredData stabilization_desired;
83 StabilizationDesiredGet(&stabilization_desired);
84 StabilizationDesiredGet(&stabilization_desired);
85 stabilization_desired.Thrust = (airframe_type == SYSTEMSETTINGS_AIRFRAMETYPE_HELICP) ? 0 : -1;
86 stabilization_desired.Roll = 0;
87 stabilization_desired.Pitch = 0;
88 stabilization_desired.Yaw = 0;
89 stabilization_desired.ReprojectionMode = STABILIZATIONDESIRED_REPROJECTIONMODE_NONE;
93 stabilization_desired.StabilizationMode[STABILIZATIONDESIRED_STABILIZATIONMODE_ROLL] = STABILIZATIONDESIRED_STABILIZATIONMODE_DISABLED;
94 stabilization_desired.StabilizationMode[STABILIZATIONDESIRED_STABILIZATIONMODE_PITCH] = STABILIZATIONDESIRED_STABILIZATIONMODE_DISABLED;
95 stabilization_desired.StabilizationMode[STABILIZATIONDESIRED_STABILIZATIONMODE_YAW] = STABILIZATIONDESIRED_STABILIZATIONMODE_DISABLED;
97 stabilization_desired.StabilizationMode[STABILIZATIONDESIRED_STABILIZATIONMODE_ROLL] = STABILIZATIONDESIRED_STABILIZATIONMODE_FAILSAFE;
98 stabilization_desired.StabilizationMode[STABILIZATIONDESIRED_STABILIZATIONMODE_PITCH] = STABILIZATIONDESIRED_STABILIZATIONMODE_FAILSAFE;
99 stabilization_desired.StabilizationMode[STABILIZATIONDESIRED_STABILIZATIONMODE_YAW] = STABILIZATIONDESIRED_STABILIZATIONMODE_FAILSAFE;
102 StabilizationDesiredSet(&stabilization_desired);
111 if (GeoFenceSettingsHandle()) {
112 uint8_t alarm_status[SYSTEMALARMS_ALARM_NUMELEM];
113 SystemAlarmsAlarmGet(alarm_status);
115 if (alarm_status[SYSTEMALARMS_ALARM_GEOFENCE] == SYSTEMALARMS_ALARM_ERROR ||
116 alarm_status[SYSTEMALARMS_ALARM_GEOFENCE] == SYSTEMALARMS_ALARM_CRITICAL) {
Process transmitter inputs and use as control source.
Geofence controller that is enabled when out of zone.
static bool geofence_armed_when_enabled
int32_t geofence_control_update()
Perform any updates to the geofence controller.
int32_t geofence_control_select(bool reset_controller)
Use geofence control mode.
bool geofence_control_activate()
Query if out of bounds and the geofence controller should take over.
static SystemSettingsAirframeTypeOptions airframe_type
Includes PiOS and core architecture components.
int32_t geofence_control_initialize()
Initialize the geofence controller.