Skip to content

Commit 62101db

Browse files
committed
fw-atrim: use trim and auto-trim in all modes
1 parent d53e67d commit 62101db

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/modules/fw_rate_control/FixedwingRateControl.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,11 @@ void FixedwingRateControl::Run()
283283
return;
284284
}
285285

286+
const float airspeed = get_airspeed_and_update_scaling();
287+
_trim.setAirspeed(airspeed);
288+
286289
if (_vcontrol_mode.flag_control_rates_enabled) {
287290

288-
const float airspeed = get_airspeed_and_update_scaling();
289291

290292
/* reset integrals where needed */
291293
if (_rates_sp.reset_integral) {
@@ -335,9 +337,6 @@ void FixedwingRateControl::Run()
335337
}
336338
}
337339

338-
_trim.setAirspeed(airspeed);
339-
_trim_slew.update(_trim.getTrim(), dt);
340-
341340
_rates_sp_sub.update(&_rates_sp);
342341

343342
Vector3f body_rates_setpoint = Vector3f(_rates_sp.roll, _rates_sp.pitch, _rates_sp.yaw);
@@ -397,7 +396,6 @@ void FixedwingRateControl::Run()
397396
} else {
398397
// full manual
399398
_rate_control.resetIntegral();
400-
_trim.reset();
401399
}
402400

403401
// Add feed-forward from roll control output to yaw control output
@@ -427,6 +425,7 @@ void FixedwingRateControl::Run()
427425
}
428426

429427
_trim.updateAutoTrim(Vector3f(_vehicle_torque_setpoint.xyz), dt);
428+
_trim_slew.update(_trim.getTrim(), dt);
430429
}
431430

432431
updateActuatorControlsStatus(dt);

0 commit comments

Comments
 (0)