From 8d37a11ab2ac5ea82e969623c6c601019791a68f Mon Sep 17 00:00:00 2001 From: Shengwen Cheng Date: Sat, 25 May 2024 18:52:48 +0800 Subject: [PATCH] Add 5% throttle deadzone for quadrotor task --- user/quadrotor/quadrotor.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/user/quadrotor/quadrotor.c b/user/quadrotor/quadrotor.c index b0a9b6f..2f22aa8 100644 --- a/user/quadrotor/quadrotor.c +++ b/user/quadrotor/quadrotor.c @@ -361,8 +361,9 @@ void flight_control_task(void) quadrotor_thrust_allocation(throttle, pid_roll.output, pid_pitch.output, pid_yaw_rate.output, motors); - /* Check safety switch */ - if (rc.dual_switch1) { + /* Enable motor outputs only if the safety switch is off and + * the throttle is greater than 5% */ + if (rc.dual_switch1 || rc.throttle <= 5) { /* Motor disarmed */ ioctl(led_fd, LED_R, LED_DISABLE); ioctl(led_fd, LED_G, LED_DISABLE);