4 #define CRASH_CHECK_TRIGGER_SEC 2 // 2 seconds inverted indicates a crash 5 #define CRASH_CHECK_ANGLE_DEVIATION_DEG 30.0f // 30 degrees beyond angle max is signal we are inverted 6 #define CRASH_CHECK_ACCEL_MAX 3.0f // vehicle must be accelerating less than 3m/s/s to be considered crashed 13 static uint16_t crash_counter;
48 gcs().
send_text(MAV_SEVERITY_EMERGENCY,
"Crash: Disarming");
54 #if PARACHUTE == ENABLED 57 #define PARACHUTE_CHECK_TRIGGER_SEC 1 // 1 second of loss of control triggers the parachute 58 #define PARACHUTE_CHECK_ANGLE_DEVIATION_CD 3000 // 30 degrees off from target indicates a loss of control 65 static uint16_t control_loss_count;
66 static int32_t baro_alt_start;
78 control_loss_count = 0;
84 control_loss_count = 0;
89 if (
ap.land_complete) {
90 control_loss_count = 0;
102 if (control_loss_count > 0) {
103 control_loss_count--;
110 control_loss_count++;
114 if (control_loss_count == 1) {
118 }
else if (
baro_alt >= baro_alt_start) {
119 control_loss_count = 0;
127 control_loss_count = 0;
139 gcs().
send_text(MAV_SEVERITY_INFO,
"Parachute: Released");
163 if (
ap.land_complete) {
174 gcs().
send_text(MAV_SEVERITY_ALERT,
"Parachute: Too low");
184 #endif // PARACHUTE == ENABLED #define ERROR_CODE_PARACHUTE_TOO_LOW
#define DATA_PARACHUTE_RELEASED
AC_AttitudeControl_t * attitude_control
LowPassFilterVector3f land_accel_ef_filter
uint16_t get_loop_rate_hz(void)
#define CRASH_CHECK_ACCEL_MAX
#define ERROR_SUBSYSTEM_PARACHUTE
void parachute_manual_release()
#define ERROR_CODE_PARACHUTE_LANDED
AP_LandingGear landinggear
void Log_Write_Error(uint8_t sub_system, uint8_t error_code)
void enabled(bool on_off)
void Log_Write_Event(uint8_t id)
Location_Class current_loc
void send_text(MAV_SEVERITY severity, const char *fmt,...)
const Vector3f & get() const
#define CRASH_CHECK_ANGLE_DEVIATION_DEG
void init_disarm_motors()
void set_position(LandingGearCommand cmd)
#define ERROR_CODE_CRASH_CHECK_CRASH
#define ERROR_CODE_CRASH_CHECK_LOSS_OF_CONTROL
#define PARACHUTE_CHECK_TRIGGER_SEC
control_mode_t control_mode
#define CRASH_CHECK_TRIGGER_SEC
#define ERROR_SUBSYSTEM_CRASH_CHECK