FW Position Controller: mini fw_control_yaw_wheel refactoring

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
Silvan Fuhrer
2022-12-20 16:09:49 +01:00
parent 1e56d9c219
commit caee131e6a
2 changed files with 9 additions and 6 deletions
@@ -273,13 +273,9 @@ void FixedwingAttitudeControl::Run()
vehicle_land_detected_poll();
// the position controller will not emit attitude setpoints in some modes
// we need to make sure that this flag is reset
_att_sp.fw_control_yaw_wheel = _att_sp.fw_control_yaw_wheel && _vcontrol_mode.flag_control_auto_enabled;
bool wheel_control = false;
if (_param_fw_w_en.get() && _att_sp.fw_control_yaw_wheel) {
if (_param_fw_w_en.get() && _att_sp.fw_control_yaw_wheel && _vcontrol_mode.flag_control_auto_enabled) {
wheel_control = true;
}
@@ -419,6 +415,12 @@ void FixedwingAttitudeControl::Run()
} else {
// full manual
_wheel_ctrl.reset_integrator();
_landing_gear_wheel.normalized_wheel_setpoint = PX4_ISFINITE(_manual_control_setpoint.yaw) ?
_manual_control_setpoint.yaw : 0.f;
_landing_gear_wheel.timestamp = hrt_absolute_time();
_landing_gear_wheel_pub.publish(_landing_gear_wheel);
}
}
@@ -1338,8 +1338,9 @@ FixedwingPositionControl::control_auto_takeoff(const hrt_abstime &now, const flo
}
// tune up the lateral position control guidance when on the ground
if (_att_sp.fw_control_yaw_wheel) {
if (_runway_takeoff.controlYaw()) {
_npfg.setPeriod(_param_rwto_npfg_period.get());
}
const Vector2f start_pos_local = _global_local_proj_ref.project(_runway_takeoff.getStartPosition()(0),