diff options
Diffstat (limited to 'apps/multirotor_att_control/multirotor_att_control_main.c')
-rw-r--r-- | apps/multirotor_att_control/multirotor_att_control_main.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/apps/multirotor_att_control/multirotor_att_control_main.c b/apps/multirotor_att_control/multirotor_att_control_main.c index 78ea63018..951840ab1 100644 --- a/apps/multirotor_att_control/multirotor_att_control_main.c +++ b/apps/multirotor_att_control/multirotor_att_control_main.c @@ -73,7 +73,7 @@ #include "multirotor_attitude_control.h" #include "multirotor_rate_control.h" -PARAM_DEFINE_FLOAT(MC_RCLOSS_THROT, 0.0f); +PARAM_DEFINE_FLOAT(MC_RCLOSS_THROT, 0.0f); // This defines the throttle when the RC signal is lost. __EXPORT int multirotor_att_control_main(int argc, char *argv[]); @@ -145,6 +145,7 @@ mc_thread_main(int argc, char *argv[]) bool flag_system_armed = false; bool man_yaw_zero_once = false; + /* prepare the handle for the failsafe throttle */ param_t failsafe_throttle_handle = param_find("MC_RCLOSS_THROT"); float failsafe_throttle = 0.0f; @@ -233,7 +234,9 @@ mc_thread_main(int argc, char *argv[]) } att_sp.thrust = manual.throttle; + /* if the RC signal is lost, try to stay level and go slowly back down to ground */ if(state.rc_signal_lost) { + /* the failsafe throttle is stored as a parameter, as it depends on the copter and the payload */ param_get(failsafe_throttle_handle, &failsafe_throttle); att_sp.roll_body = 0.0f; att_sp.pitch_body = 0.0f; |