VTOL: Smarter pusher ramp up during front transtitions for standard VTOLs (#20394)

New param VT_PSHER_SLEW for ramping up throttle of pusher during front/back transition, that replaces the old VT_PSHER_RMP_DT param.
This commit is contained in:
GaspardBesacier
2022-11-14 16:32:51 +01:00
committed by GitHub
parent f5ecd1106f
commit dfced1fe46
4 changed files with 25 additions and 12 deletions
+11
View File
@@ -259,5 +259,16 @@ bool param_modify_on_import(bson_node_t node)
} }
} }
// 2022-11-11: translate VT_F_TRANS_THR/VT_PSHER_RMP_DT -> VT_PSHER_SLEW
{
if (strcmp("VT_PSHER_RMP_DT", node->name) == 0) {
strcpy(node->name, "VT_PSHER_SLEW");
double _param_vt_f_trans_thr = param_find("VT_F_TRANS_THR");
node->d = _param_vt_f_trans_thr / node->d;
PX4_INFO("copying %s -> %s", "VT_PSHER_RMP_DT", "VT_PSHER_SLEW");
return true;
}
}
return false; return false;
} }
+5 -5
View File
@@ -231,13 +231,14 @@ void Standard::update_transition_state()
} }
if (_vtol_schedule.flight_mode == vtol_mode::TRANSITION_TO_FW) { if (_vtol_schedule.flight_mode == vtol_mode::TRANSITION_TO_FW) {
if (_param_vt_psher_rmp_dt.get() <= 0.0f) { if (_param_vt_psher_slew.get() <= FLT_EPSILON) {
// just set the final target throttle value // just set the final target throttle value
_pusher_throttle = _param_vt_f_trans_thr.get(); _pusher_throttle = _param_vt_f_trans_thr.get();
} else if (_pusher_throttle <= _param_vt_f_trans_thr.get()) { } else if (_pusher_throttle <= _param_vt_f_trans_thr.get()) {
// ramp up throttle to the target throttle value // ramp up throttle to the target throttle value
_pusher_throttle = _param_vt_f_trans_thr.get() * time_since_trans_start / _param_vt_psher_rmp_dt.get(); _pusher_throttle = math::min(_pusher_throttle +
_param_vt_psher_slew.get() * _dt, _param_vt_f_trans_thr.get());
} }
_airspeed_trans_blend_margin = _param_vt_arsp_trans.get() - _param_vt_arsp_blend.get(); _airspeed_trans_blend_margin = _param_vt_arsp_trans.get() - _param_vt_arsp_blend.get();
@@ -291,9 +292,8 @@ void Standard::update_transition_state()
if (time_since_trans_start >= _param_vt_b_rev_del.get()) { if (time_since_trans_start >= _param_vt_b_rev_del.get()) {
// Handle throttle reversal for active breaking // Handle throttle reversal for active breaking
float thrscale = (time_since_trans_start - _param_vt_b_rev_del.get()) / (_param_vt_psher_rmp_dt.get()); _pusher_throttle = math::constrain((time_since_trans_start - _param_vt_b_rev_del.get())
thrscale = math::constrain(thrscale, 0.0f, 1.0f); * _param_vt_psher_slew.get(), 0.0f, _param_vt_b_trans_thr.get());
_pusher_throttle = thrscale * _param_vt_b_trans_thr.get();
} }
// continually increase mc attitude control as we transition back to mc mode // continually increase mc attitude control as we transition back to mc mode
+1 -1
View File
@@ -84,7 +84,7 @@ private:
void parameters_update() override; void parameters_update() override;
DEFINE_PARAMETERS_CUSTOM_PARENT(VtolType, DEFINE_PARAMETERS_CUSTOM_PARENT(VtolType,
(ParamFloat<px4::params::VT_PSHER_RMP_DT>) _param_vt_psher_rmp_dt, (ParamFloat<px4::params::VT_PSHER_SLEW>) _param_vt_psher_slew,
(ParamFloat<px4::params::VT_B_TRANS_RAMP>) _param_vt_b_trans_ramp, (ParamFloat<px4::params::VT_B_TRANS_RAMP>) _param_vt_b_trans_ramp,
(ParamFloat<px4::params::FW_PSP_OFF>) _param_fw_psp_off, (ParamFloat<px4::params::FW_PSP_OFF>) _param_fw_psp_off,
(ParamFloat<px4::params::VT_B_REV_OUT>) _param_vt_b_rev_out, (ParamFloat<px4::params::VT_B_REV_OUT>) _param_vt_b_rev_out,
@@ -108,7 +108,7 @@ PARAM_DEFINE_FLOAT(VT_B_REV_OUT, 0.0f);
* *
* Set this to a value greater than 0 to give the motor time to spin down. * Set this to a value greater than 0 to give the motor time to spin down.
* *
* unit s * @unit s
* @min 0 * @min 0
* @max 10 * @max 10
* @increment 1 * @increment 1
@@ -118,14 +118,16 @@ PARAM_DEFINE_FLOAT(VT_B_REV_OUT, 0.0f);
PARAM_DEFINE_FLOAT(VT_B_REV_DEL, 0.0f); PARAM_DEFINE_FLOAT(VT_B_REV_DEL, 0.0f);
/** /**
* Pusher throttle ramp up window * Pusher throttle ramp up slew rate
* *
* Defines the time window during which the pusher throttle will be ramped up linearly to VT_F_TRANS_THR during a transition * Defines the slew rate of the puller/pusher throttle during transitions.
* to fixed wing mode. Zero or negative values will produce an instant throttle rise to VT_F_TRANS_THR. * Zero will deactivate the slew rate limiting and thus produce an instant throttle
* rise to the transition throttle VT_F_TRANS_THR.
* *
* @max 20 * @unit 1/s
* @min 0
* @increment 0.01 * @increment 0.01
* @decimal 2 * @decimal 2
* @group VTOL Attitude Control * @group VTOL Attitude Control
*/ */
PARAM_DEFINE_FLOAT(VT_PSHER_RMP_DT, 3.0f); PARAM_DEFINE_FLOAT(VT_PSHER_SLEW, 0.33f);