Failsafe throttle when RC is lost is now a parameter

This commit is contained in:
Julian Oes
2012-11-07 10:50:52 -08:00
parent 9f92c6df67
commit 5995240a07
@@ -68,10 +68,13 @@
#include <systemlib/perf_counter.h>
#include <systemlib/systemlib.h>
#include <systemlib/param/param.h>
#include "multirotor_attitude_control.h"
#include "multirotor_rate_control.h"
PARAM_DEFINE_FLOAT(MC_RCLOSS_THROT, 0.0f);
__EXPORT int multirotor_att_control_main(int argc, char *argv[]);
static bool thread_should_exit;
@@ -142,6 +145,9 @@ mc_thread_main(int argc, char *argv[])
bool flag_system_armed = false;
bool man_yaw_zero_once = false;
param_t failsafe_throttle_handle = param_find("MC_RCLOSS_THROT");
float failsafe_throttle = 0.0f;
while (!thread_should_exit) {
/* wait for a sensor update, check for exit condition every 500 ms */
@@ -228,10 +234,11 @@ mc_thread_main(int argc, char *argv[])
att_sp.thrust = manual.throttle;
if(state.rc_signal_lost) {
param_get(failsafe_throttle_handle, &failsafe_throttle);
att_sp.roll_body = 0.0f;
att_sp.pitch_body = 0.0f;
att_sp.yaw_body = 0.0f;
att_sp.thrust = 0.4f;
att_sp.thrust = failsafe_throttle;
}
att_sp.timestamp = hrt_absolute_time();