mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-03 04:41:36 +08:00
Move throttle check from land detector to posctrl
This commit is an attempt to fix a race condition happening on takeoff between the land detector and the multicopter position controller. Previously, an auto-takeoff leads to the following events: 1. A takeoff setpoint is given. 2. The thrust setpoint spikes because we don't enter smooth takeoff yet. 3. The land detector detects a takeoff because of the high thrust. 4. The position controller sees the landed state transition and initiates the smooth takeoff. Thrust goes back down. 5. Depending on control gains the takeoff is successful or fails if the smoothing takes too long which causes thrust to be too low, so the land detector detects land again. The two obvious problems with this are: - The intermittent spike. - The failed takeoff because of the smoothing leads to a delay.. With this change, the logic for a takeoff detection is moved from the land detector to the position controller. The events are now: 1. A takeoff setpoint is given. 2. The position controller detects the takeoff setpoint and initiates the smooth takeoff. 3. As thrust ramps up, the land detector detects the take off. In the same way, we now detect the intent to takeoff in manual, altitude, control, position control in the position controller instead of in the land detector.
This commit is contained in:
@@ -52,7 +52,6 @@
|
||||
#include <uORB/topics/actuator_armed.h>
|
||||
#include <uORB/topics/actuator_controls.h>
|
||||
#include <uORB/topics/battery_status.h>
|
||||
#include <uORB/topics/manual_control_setpoint.h>
|
||||
#include <uORB/topics/parameter_update.h>
|
||||
#include <uORB/topics/sensor_bias.h>
|
||||
#include <uORB/topics/vehicle_attitude.h>
|
||||
@@ -110,9 +109,7 @@ private:
|
||||
param_t minManThrottle;
|
||||
param_t freefall_acc_threshold;
|
||||
param_t freefall_trigger_time;
|
||||
param_t manual_stick_down_threshold;
|
||||
param_t altitude_max;
|
||||
param_t manual_stick_up_position_takeoff_threshold;
|
||||
param_t landSpeed;
|
||||
} _paramHandle;
|
||||
|
||||
@@ -126,9 +123,7 @@ private:
|
||||
float minManThrottle;
|
||||
float freefall_acc_threshold;
|
||||
float freefall_trigger_time;
|
||||
float manual_stick_down_threshold;
|
||||
float altitude_max;
|
||||
float manual_stick_up_position_takeoff_threshold;
|
||||
float landSpeed;
|
||||
} _params;
|
||||
|
||||
@@ -137,7 +132,6 @@ private:
|
||||
int _actuatorsSub;
|
||||
int _armingSub;
|
||||
int _attitudeSub;
|
||||
int _manualSub;
|
||||
int _sensor_bias_sub;
|
||||
int _vehicle_control_mode_sub;
|
||||
int _battery_sub;
|
||||
@@ -147,7 +141,6 @@ private:
|
||||
struct actuator_controls_s _actuators;
|
||||
struct actuator_armed_s _arming;
|
||||
struct vehicle_attitude_s _vehicleAttitude;
|
||||
struct manual_control_setpoint_s _manual;
|
||||
struct sensor_bias_s _sensors;
|
||||
struct vehicle_control_mode_s _control_mode;
|
||||
struct battery_status_s _battery;
|
||||
@@ -159,7 +152,6 @@ private:
|
||||
float _get_takeoff_throttle();
|
||||
bool _has_altitude_lock();
|
||||
bool _has_position_lock();
|
||||
bool _has_manual_control_present();
|
||||
bool _has_minimal_thrust();
|
||||
bool _has_low_thrust();
|
||||
bool _is_climb_rate_enabled();
|
||||
|
||||
Reference in New Issue
Block a user