Skip to content

Commit a0d22a4

Browse files
committed
FW Position Control: make explicit when underspeed detection logic is en-/disabled
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
1 parent acc0cd7 commit a0d22a4

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

src/modules/fw_pos_control/FixedwingPositionControl.cpp

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,7 @@ FixedwingPositionControl::control_auto_descend(const float control_interval)
973973
// Hard-code descend rate to 0.5m/s. This is a compromise to give the system to recover,
974974
// but not letting it drift too far away.
975975
const float descend_rate = -0.5f;
976+
const bool disable_underspeed_handling = false;
976977

977978
tecs_update_pitch_throttle(control_interval,
978979
_current_altitude,
@@ -983,7 +984,7 @@ FixedwingPositionControl::control_auto_descend(const float control_interval)
983984
_param_fw_thr_max.get(),
984985
_param_sinkrate_target.get(),
985986
_param_climbrate_target.get(),
986-
false,
987+
disable_underspeed_handling,
987988
descend_rate);
988989

989990
const float roll_body = math::radians(_param_nav_gpsf_r.get()); // open loop loiter bank angle
@@ -1170,6 +1171,7 @@ FixedwingPositionControl::control_auto_velocity(const float control_interval, co
11701171
target_airspeed = _npfg.getAirspeedRef() / _eas2tas;
11711172

11721173
float yaw_body = _yaw;
1174+
const bool disable_underspeed_handling = false;
11731175

11741176
tecs_update_pitch_throttle(control_interval,
11751177
position_sp_alt,
@@ -1180,7 +1182,7 @@ FixedwingPositionControl::control_auto_velocity(const float control_interval, co
11801182
tecs_fw_thr_max,
11811183
_param_sinkrate_target.get(),
11821184
_param_climbrate_target.get(),
1183-
false,
1185+
disable_underspeed_handling,
11841186
pos_sp_curr.vz);
11851187
const float pitch_body = get_tecs_pitch();
11861188

@@ -1541,6 +1543,8 @@ FixedwingPositionControl::control_auto_takeoff(const hrt_abstime &now, const flo
15411543
_tecs.resetIntegrals();
15421544
}
15431545

1546+
const bool disable_underspeed_handling = true;
1547+
15441548
tecs_update_pitch_throttle(control_interval,
15451549
altitude_setpoint_amsl,
15461550
target_airspeed,
@@ -1550,7 +1554,7 @@ FixedwingPositionControl::control_auto_takeoff(const hrt_abstime &now, const flo
15501554
_param_fw_thr_max.get(),
15511555
_param_sinkrate_target.get(),
15521556
_performance_model.getMaximumClimbRate(_air_density),
1553-
true); // disable underspeed handling
1557+
disable_underspeed_handling);
15541558

15551559
_tecs.set_equivalent_airspeed_min(_performance_model.getMinimumCalibratedAirspeed()); // reset after TECS calculation
15561560

@@ -1626,6 +1630,7 @@ FixedwingPositionControl::control_auto_takeoff(const hrt_abstime &now, const flo
16261630

16271631
const float max_takeoff_throttle = (_launchDetector.getLaunchDetected() < launch_detection_status_s::STATE_FLYING) ?
16281632
_param_fw_thr_idle.get() : _param_fw_thr_max.get();
1633+
const bool disable_underspeed_handling = true;
16291634

16301635
tecs_update_pitch_throttle(control_interval,
16311636
altitude_setpoint_amsl,
@@ -1636,7 +1641,7 @@ FixedwingPositionControl::control_auto_takeoff(const hrt_abstime &now, const flo
16361641
max_takeoff_throttle,
16371642
_param_sinkrate_target.get(),
16381643
_performance_model.getMaximumClimbRate(_air_density),
1639-
true); // disable underspeed handling
1644+
disable_underspeed_handling);
16401645

16411646
if (_launchDetector.getLaunchDetected() < launch_detection_status_s::STATE_FLYING) {
16421647
// explicitly set idle throttle until motors are enabled
@@ -1813,6 +1818,7 @@ FixedwingPositionControl::control_auto_landing_straight(const hrt_abstime &now,
18131818
const float throttle_max = flare_ramp_interpolator_sqrt * _param_fw_thr_idle.get() +
18141819
(1.0f - flare_ramp_interpolator_sqrt) *
18151820
_param_fw_thr_max.get();
1821+
const bool disable_underspeed_handling = true;
18161822

18171823
tecs_update_pitch_throttle(control_interval,
18181824
altitude_setpoint,
@@ -1823,7 +1829,7 @@ FixedwingPositionControl::control_auto_landing_straight(const hrt_abstime &now,
18231829
throttle_max,
18241830
_param_sinkrate_target.get(),
18251831
_param_climbrate_target.get(),
1826-
true,
1832+
disable_underspeed_handling,
18271833
height_rate_setpoint);
18281834

18291835
/* set the attitude and throttle commands */
@@ -2029,6 +2035,7 @@ FixedwingPositionControl::control_auto_landing_circular(const hrt_abstime &now,
20292035
const float throttle_max = flare_ramp_interpolator_sqrt * _param_fw_thr_idle.get() +
20302036
(1.0f - flare_ramp_interpolator_sqrt) *
20312037
_param_fw_thr_max.get();
2038+
const bool disable_underspeed_handling = true;
20322039

20332040
tecs_update_pitch_throttle(control_interval,
20342041
_current_altitude, // is not controlled, control descend rate
@@ -2039,7 +2046,7 @@ FixedwingPositionControl::control_auto_landing_circular(const hrt_abstime &now,
20392046
throttle_max,
20402047
_param_sinkrate_target.get(),
20412048
_param_climbrate_target.get(),
2042-
true,
2049+
disable_underspeed_handling,
20432050
height_rate_setpoint);
20442051

20452052
/* set the attitude and throttle commands */
@@ -2085,6 +2092,8 @@ FixedwingPositionControl::control_auto_landing_circular(const hrt_abstime &now,
20852092
const float glide_slope_sink_rate = airspeed_land * glide_slope / sqrtf(glide_slope * glide_slope + 1.0f);
20862093
const float desired_max_sinkrate = math::min(math::max(glide_slope_sink_rate, _param_sinkrate_target.get()),
20872094
_param_fw_t_sink_max.get());
2095+
const bool disable_underspeed_handling = false;
2096+
20882097
tecs_update_pitch_throttle(control_interval,
20892098
_current_altitude, // is not controlled, control descend rate
20902099
target_airspeed,
@@ -2094,7 +2103,7 @@ FixedwingPositionControl::control_auto_landing_circular(const hrt_abstime &now,
20942103
_param_fw_thr_max.get(),
20952104
desired_max_sinkrate,
20962105
_param_climbrate_target.get(),
2097-
false,
2106+
disable_underspeed_handling,
20982107
-glide_slope_sink_rate); // heightrate = -sinkrate
20992108

21002109
/* set the attitude and throttle commands */
@@ -2151,6 +2160,8 @@ FixedwingPositionControl::control_manual_altitude(const float control_interval,
21512160
throttle_max = 0.0f;
21522161
}
21532162

2163+
const bool disable_underspeed_handling = false;
2164+
21542165
tecs_update_pitch_throttle(control_interval,
21552166
_current_altitude,
21562167
calibrated_airspeed_sp,
@@ -2160,7 +2171,7 @@ FixedwingPositionControl::control_manual_altitude(const float control_interval,
21602171
throttle_max,
21612172
_param_sinkrate_target.get(),
21622173
_param_climbrate_target.get(),
2163-
false,
2174+
disable_underspeed_handling,
21642175
height_rate_sp);
21652176

21662177
float roll_body = _manual_control_setpoint.roll * radians(_param_fw_r_lim.get());
@@ -2251,6 +2262,8 @@ FixedwingPositionControl::control_manual_position(const float control_interval,
22512262
}
22522263
}
22532264

2265+
const bool disable_underspeed_handling = false;
2266+
22542267
tecs_update_pitch_throttle(control_interval,
22552268
_current_altitude, // TODO: check if this is really what we want.. or if we want to lock the altitude.
22562269
calibrated_airspeed_sp,
@@ -2260,7 +2273,7 @@ FixedwingPositionControl::control_manual_position(const float control_interval,
22602273
throttle_max,
22612274
_param_sinkrate_target.get(),
22622275
_param_climbrate_target.get(),
2263-
false,
2276+
disable_underspeed_handling,
22642277
height_rate_sp);
22652278

22662279
if (!_yaw_lock_engaged || fabsf(_manual_control_setpoint.roll) >= HDG_HOLD_MAN_INPUT_THRESH ||

0 commit comments

Comments
 (0)