mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-08 08:53:56 -04:00
ArduPlane: add thr position trigger to ThrLandCtrl Q_OPTION
This commit is contained in:
parent
784d1ddf7c
commit
551d55a85c
@ -286,3 +286,9 @@
|
|||||||
#ifndef FS_EKF_THRESHOLD_DEFAULT
|
#ifndef FS_EKF_THRESHOLD_DEFAULT
|
||||||
# define FS_EKF_THRESHOLD_DEFAULT 0.8f // EKF failsafe's default compass and velocity variance threshold above which the EKF failsafe will be triggered
|
# define FS_EKF_THRESHOLD_DEFAULT 0.8f // EKF failsafe's default compass and velocity variance threshold above which the EKF failsafe will be triggered
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Landing Throttle Control Trigger Threshold
|
||||||
|
#ifndef THR_CTRL_LAND_THRESH
|
||||||
|
#define THR_CTRL_LAND_THRESH 0.7
|
||||||
|
#endif
|
||||||
|
@ -1223,7 +1223,7 @@ bool QuadPlane::is_flying_vtol(void) const
|
|||||||
smooth out descent rate for landing to prevent a jerk as we get to
|
smooth out descent rate for landing to prevent a jerk as we get to
|
||||||
land_final_alt.
|
land_final_alt.
|
||||||
*/
|
*/
|
||||||
float QuadPlane::landing_descent_rate_cms(float height_above_ground) const
|
float QuadPlane::landing_descent_rate_cms(float height_above_ground)
|
||||||
{
|
{
|
||||||
if (poscontrol.get_state() == QPOS_LAND_FINAL) {
|
if (poscontrol.get_state() == QPOS_LAND_FINAL) {
|
||||||
// when in final use descent rate for final even if alt has climbed again
|
// when in final use descent rate for final even if alt has climbed again
|
||||||
@ -1237,19 +1237,24 @@ float QuadPlane::landing_descent_rate_cms(float height_above_ground) const
|
|||||||
if ((options & OPTION_THR_LANDING_CONTROL) != 0) {
|
if ((options & OPTION_THR_LANDING_CONTROL) != 0) {
|
||||||
// allow throttle control for landing speed
|
// allow throttle control for landing speed
|
||||||
const float thr_in = get_pilot_land_throttle();
|
const float thr_in = get_pilot_land_throttle();
|
||||||
const float dz = 0.1;
|
if (thr_in > THR_CTRL_LAND_THRESH) {
|
||||||
const float thresh1 = 0.5+dz;
|
thr_ctrl_land = true;
|
||||||
const float thresh2 = 0.5-dz;
|
|
||||||
const float scaling = 1.0 / (0.5 - dz);
|
|
||||||
if (thr_in > thresh1) {
|
|
||||||
// start climbing
|
|
||||||
ret = -(thr_in - thresh1)*scaling*max_climb_speed;
|
|
||||||
} else if (thr_in > thresh2) {
|
|
||||||
// hold height
|
|
||||||
ret = 0;
|
|
||||||
} else {
|
|
||||||
ret *= (thresh2 - thr_in)*scaling;
|
|
||||||
}
|
}
|
||||||
|
if (thr_ctrl_land) {
|
||||||
|
const float dz = 0.1;
|
||||||
|
const float thresh1 = 0.5+dz;
|
||||||
|
const float thresh2 = 0.5-dz;
|
||||||
|
const float scaling = 1.0 / (0.5 - dz);
|
||||||
|
if (thr_in > thresh1) {
|
||||||
|
// start climbing
|
||||||
|
ret = -(thr_in - thresh1)*scaling*max_climb_speed;
|
||||||
|
} else if (thr_in > thresh2) {
|
||||||
|
// hold height
|
||||||
|
ret = 0;
|
||||||
|
} else {
|
||||||
|
ret *= (thresh2 - thr_in)*scaling;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (poscontrol.pilot_correction_active) {
|
if (poscontrol.pilot_correction_active) {
|
||||||
@ -2302,6 +2307,9 @@ void QuadPlane::PosControlState::set_state(enum position_control_state s)
|
|||||||
} else if (s == QPOS_AIRBRAKE) {
|
} else if (s == QPOS_AIRBRAKE) {
|
||||||
// start with zero integrator on vertical throttle
|
// start with zero integrator on vertical throttle
|
||||||
qp.pos_control->get_accel_z_pid().set_integrator(0);
|
qp.pos_control->get_accel_z_pid().set_integrator(0);
|
||||||
|
} else if (s == QPOS_LAND_DESCEND) {
|
||||||
|
// reset throttle descent control
|
||||||
|
qp.thr_ctrl_land = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
state = s;
|
state = s;
|
||||||
|
@ -122,6 +122,9 @@ public:
|
|||||||
|
|
||||||
// return true if the user has set ENABLE
|
// return true if the user has set ENABLE
|
||||||
bool enabled(void) const { return enable != 0; }
|
bool enabled(void) const { return enable != 0; }
|
||||||
|
|
||||||
|
// is throttle controlled landing descent active?
|
||||||
|
bool thr_ctrl_land;
|
||||||
|
|
||||||
uint16_t get_pilot_velocity_z_max_dn() const;
|
uint16_t get_pilot_velocity_z_max_dn() const;
|
||||||
|
|
||||||
@ -239,7 +242,7 @@ private:
|
|||||||
bool should_relax(void);
|
bool should_relax(void);
|
||||||
void motors_output(bool run_rate_controller = true);
|
void motors_output(bool run_rate_controller = true);
|
||||||
void Log_Write_QControl_Tuning();
|
void Log_Write_QControl_Tuning();
|
||||||
float landing_descent_rate_cms(float height_above_ground) const;
|
float landing_descent_rate_cms(float height_above_ground);
|
||||||
|
|
||||||
// setup correct aux channels for frame class
|
// setup correct aux channels for frame class
|
||||||
void setup_default_channels(uint8_t num_motors);
|
void setup_default_channels(uint8_t num_motors);
|
||||||
@ -396,7 +399,7 @@ private:
|
|||||||
|
|
||||||
// are we in a guided takeoff?
|
// are we in a guided takeoff?
|
||||||
bool guided_takeoff:1;
|
bool guided_takeoff:1;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
// time when motors reached lower limit
|
// time when motors reached lower limit
|
||||||
uint32_t lower_limit_start_ms;
|
uint32_t lower_limit_start_ms;
|
||||||
|
Loading…
Reference in New Issue
Block a user