Skip to content

Commit

Permalink
AP_TECS: continue code murdering spree
Browse files Browse the repository at this point in the history
  • Loading branch information
jschall committed Jun 1, 2024
1 parent 0bc7fd3 commit 4316932
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 30 deletions.
28 changes: 1 addition & 27 deletions libraries/AP_TECS/AP_TECS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,18 +552,6 @@ void AP_TECS::_update_height_demand(void)
_hgt_rate_dem = constrain_float(_hgt_rate_dem, -_sink_rate_limit, _climb_rate_limit);

_hgt_dem = _hgt_dem_in_raw;
} else {
// set all height filter states to current height to prevent large pitch transients if flare is aborted
_hgt_dem_lpf = _height;

if (!_flare_initialised) {
_hgt_at_start_of_flare = _hgt_afe;
_flare_initialised = true;
}

// Go to pure sink rate control for flare. Sink rate is already constrained.
_hgt_dem = _height;
_hgt_rate_dem = -_sink_rate_limit;
}
}

Expand Down Expand Up @@ -1093,7 +1081,6 @@ void AP_TECS::_initialise_states(int32_t ptchMinCO_cd, float hgt_afe)

// misc variables used for alternative precision landing pitch control
_hgt_afe = 0.0f;
_pitch_min_at_flare_entry = 0.0f;

_max_climb_scaler = 1.0f;
_max_sink_scaler = 1.0f;
Expand Down Expand Up @@ -1219,16 +1206,7 @@ void AP_TECS::update_pitch_throttle(int32_t hgt_dem_cm,

// calculate the expected pitch angle from the demanded climb rate and airspeed fo ruse during approach and flare
if (_landing.is_flaring()) {
// smoothly move the min pitch to the required minimum at touchdown
float p; // 0 at start of flare, 1 at finish
if (!_flare_initialised) {
p = 0.0f;
} else if (_hgt_at_start_of_flare > _flare_holdoff_hgt) {
p = constrain_float((_hgt_at_start_of_flare - _hgt_afe) / _hgt_at_start_of_flare, 0.0f, 1.0f);
} else {
p = 1.0f;
}
const float pitch_limit_deg = (1.0f - p) * _pitch_min_at_flare_entry + p * 0.01f * _landing.get_pitch_cd();
const float pitch_limit_deg = _landing.get_pitch_cd();

// in flare use min pitch from LAND_PITCH_DEG
_PITCHminf = MAX(_PITCHminf, pitch_limit_deg);
Expand All @@ -1243,10 +1221,6 @@ void AP_TECS::update_pitch_throttle(int32_t hgt_dem_cm,
_THRminf = 0;
} else if (_landing.is_on_approach()) {
_PITCHminf = MAX(_PITCHminf, aparm.pitch_limit_min);
_pitch_min_at_flare_entry = _PITCHminf;
_flare_initialised = false;
} else {
_flare_initialised = false;
}

if (_landing.is_on_approach()) {
Expand Down
3 changes: 0 additions & 3 deletions libraries/AP_TECS/AP_TECS.h
Original file line number Diff line number Diff line change
Expand Up @@ -382,10 +382,7 @@ class AP_TECS {
float _SKEdot;

// variables used for precision landing pitch control
float _hgt_at_start_of_flare;
float _hgt_rate_at_flare_entry;
float _hgt_afe;
float _pitch_min_at_flare_entry;

// used to scale max climb and sink limits to match vehicle ability
float _max_climb_scaler;
Expand Down

0 comments on commit 4316932

Please sign in to comment.