mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-14 20:33:34 +08:00
Failsafe throttle when RC is lost is now a parameter
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user