From 6a2ebfc0cc4ebe068cc6e842fee13a876e13d72e Mon Sep 17 00:00:00 2001 From: Jaeyoung-Lim Date: Fri, 5 Nov 2021 18:16:22 +0100 Subject: [PATCH] Handle setpoint types properly for fixedwing position control Handle setpoint types properly for fixedwing position control --- .../fw_pos_control_l1/FixedwingPositionControl.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/modules/fw_pos_control_l1/FixedwingPositionControl.cpp b/src/modules/fw_pos_control_l1/FixedwingPositionControl.cpp index 50fbc231e7..7628e953bb 100644 --- a/src/modules/fw_pos_control_l1/FixedwingPositionControl.cpp +++ b/src/modules/fw_pos_control_l1/FixedwingPositionControl.cpp @@ -787,7 +787,7 @@ FixedwingPositionControl::control_auto(const hrt_abstime &now, const Vector2d &c } /* Copy thrust output for publication, handle special cases */ - if (pos_sp_curr.type == position_setpoint_s::SETPOINT_TYPE_TAKEOFF && // launchdetector only available in auto + if (_position_sp_type == position_setpoint_s::SETPOINT_TYPE_TAKEOFF && // launchdetector only available in auto _launch_detection_state != LAUNCHDETECTION_RES_DETECTED_ENABLEMOTORS && !_runway_takeoff.runwayTakeoffEnabled()) { @@ -796,12 +796,12 @@ FixedwingPositionControl::control_auto(const hrt_abstime &now, const Vector2d &c the pre-takeoff throttle and the idle throttle normally map to the same parameter. */ _att_sp.thrust_body[0] = _param_fw_thr_idle.get(); - } else if (pos_sp_curr.type == position_setpoint_s::SETPOINT_TYPE_TAKEOFF && + } else if (_position_sp_type == position_setpoint_s::SETPOINT_TYPE_TAKEOFF && _runway_takeoff.runwayTakeoffEnabled()) { _att_sp.thrust_body[0] = _runway_takeoff.getThrottle(now, get_tecs_thrust()); - } else if (pos_sp_curr.type == position_setpoint_s::SETPOINT_TYPE_IDLE) { + } else if (_position_sp_type == position_setpoint_s::SETPOINT_TYPE_IDLE) { _att_sp.thrust_body[0] = 0.0f; @@ -821,11 +821,11 @@ FixedwingPositionControl::control_auto(const hrt_abstime &now, const Vector2d &c bool use_tecs_pitch = true; // auto runway takeoff - use_tecs_pitch &= !(pos_sp_curr.type == position_setpoint_s::SETPOINT_TYPE_TAKEOFF && + use_tecs_pitch &= !(_position_sp_type == position_setpoint_s::SETPOINT_TYPE_TAKEOFF && (_launch_detection_state == LAUNCHDETECTION_RES_NONE || _runway_takeoff.runwayTakeoffEnabled())); // flaring during landing - use_tecs_pitch &= !(pos_sp_curr.type == position_setpoint_s::SETPOINT_TYPE_LAND && _land_noreturn_vertical); + use_tecs_pitch &= !(_position_sp_type == position_setpoint_s::SETPOINT_TYPE_LAND && _land_noreturn_vertical); if (use_tecs_pitch) { _att_sp.pitch_body = get_tecs_pitch();