refactor(vtol_att_ctrl/standard): simplify logic

There were a lot of lines to do essentially what math::interpolate would
do in one step.
This commit is contained in:
Balduin committed 2026-11-25 16:26:17 +01:00
1 parent 6893410483
commit b4e9cd6648
2 files changed
+3 -11

No files matched your search

+3 -10
View File
@@ -155,8 +155,6 @@ void Standard::update_transition_state()
_last_time_pusher_transition_update = now;
}
_airspeed_trans_blend_margin = getTransitionAirspeed() - getBlendAirspeed();
float airspeed = _attc->get_calibrated_airspeed();
if (!PX4_ISFINITE(airspeed)) {
@@ -164,13 +162,9 @@ void Standard::update_transition_state()
airspeed = getTransitionAirspeed() * _time_since_trans_start / getOpenLoopFrontTransitionTime();
}
// do blending of mc and fw controls if a blending airspeed has been provided and the minimum transition time has passed
if (_airspeed_trans_blend_margin > 0.0f &&
airspeed > 0.0f &&
airspeed >= getBlendAirspeed() &&
_time_since_trans_start > getMinimumFrontTransitionTime()) {
mc_weight = 1.0f - fabsf(airspeed - getBlendAirspeed()) / _airspeed_trans_blend_margin;
// blend mc and fw controls between blend and transition airspeed once the minimum transition time has passed
if (_time_since_trans_start > getMinimumFrontTransitionTime()) {
mc_weight = math::interpolate(airspeed, getBlendAirspeed(), getTransitionAirspeed(), 1.f, 0.f);
}
// ramp up FW_PSP_OFF
@@ -178,7 +172,6 @@ void Standard::update_transition_state()
_v_att_sp->thrust_body[0] = _pusher_throttle;
const Quatf q_sp(Eulerf(roll_body, pitch_body, yaw_body));
q_sp.copyTo(_v_att_sp->q_d);
mc_weight = math::constrain(mc_weight, 0.0f, 1.0f);
} else if (_common_vtol_mode == mode::TRANSITION_TO_MC) {
-1
View File
@@ -67,7 +67,6 @@ public:
private:
float _pusher_throttle{0.0f};
float _airspeed_trans_blend_margin{0.0f};
hrt_abstime _last_time_pusher_transition_update{0};
float _front_transition_pitch{NAN};