diff --git a/docs/en/flight_modes_mc/hold.md b/docs/en/flight_modes_mc/hold.md index 390b046029..ea2520fb2c 100644 --- a/docs/en/flight_modes_mc/hold.md +++ b/docs/en/flight_modes_mc/hold.md @@ -39,6 +39,7 @@ Hold mode behaviour can be configured using the parameters below. | ----------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [NAV_MIN_LTR_ALT](../advanced_config/parameter_reference.md#NAV_MIN_LTR_ALT) | This is the minimum altitude above Home the system will always obey in Hold mode if switched into this mode without specifying an altitude (e.g. through switch on RC). | | [MAN_OVERRIDE_SPD](../advanced_config/parameter_reference.md#MAN_OVERRIDE_SPD) | Speed (normalized stick travel per second) above which moving the sticks controlling a multicopter (or VTOL in hover) gives control back to the pilot by switching to [Position mode](../flight_modes_mc/position.md) (or Altitude mode if position is unavailable). At the default value of 1 a half-stick movement in ~0.5 s triggers it; lower is more sensitive. A stick held statically has zero speed and will not trigger. Set to -1 to disable. | +| [MPC_AUTO_NUDGING](../advanced_config/parameter_reference.md#MPC_AUTO_NUDGING) | Bitmask enabling stick nudging in Auto modes (multicopter). Bit 0 (yaw nudging) lets the yaw stick nudge heading in Hold, held when the stick is released; switching flight mode clears the held heading. Requires stick override to be disabled ([MAN_OVERRIDE_SPD](#MAN_OVERRIDE_SPD) = -1). | diff --git a/docs/en/flight_modes_mc/land.md b/docs/en/flight_modes_mc/land.md index 5b18094ab3..3d590a4fbc 100644 --- a/docs/en/flight_modes_mc/land.md +++ b/docs/en/flight_modes_mc/land.md @@ -36,6 +36,7 @@ Land mode behaviour can be configured using the parameters below. | [MPC_LAND_SPEED](../advanced_config/parameter_reference.md#MPC_LAND_SPEED) | The rate of descent during landing. This should be kept fairly low as the ground conditions are not known. | | [COM_DISARM_LAND](../advanced_config/parameter_reference.md#COM_DISARM_LAND) | Time-out for auto disarm after landing, in seconds. If set to -1 the vehicle will not disarm on landing. | | [MAN_OVERRIDE_SPD](../advanced_config/parameter_reference.md#MAN_OVERRIDE_SPD) | Speed (normalized stick travel per second) above which moving the sticks controlling a multicopter (or VTOL in hover) gives control back to the pilot by switching to [Position mode](../flight_modes_mc/position.md) (or Altitude mode if position is unavailable). At the default value of 1 a half-stick movement in ~0.5 s triggers it; lower is more sensitive. A stick held statically has zero speed and will not trigger. Set to -1 to disable. | +| [MPC_AUTO_NUDGING](../advanced_config/parameter_reference.md#MPC_AUTO_NUDGING) | Bitmask enabling stick nudging in Auto modes (multicopter). Bit 0 (yaw nudging) lets the yaw stick nudge heading during landing. Bit 1 (land nudging) additionally lets the pitch/roll sticks move the vehicle horizontally (within [MPC_LAND_RADIUS](#MPC_LAND_RADIUS)), the throttle stick amend the descent speed, and the yaw stick rotate the heading. Requires stick override to be disabled ([MAN_OVERRIDE_SPD](#MAN_OVERRIDE_SPD) = -1). | ## See Also diff --git a/docs/en/flight_modes_mc/mission.md b/docs/en/flight_modes_mc/mission.md index a71d5ab01c..b7be5bf6fb 100644 --- a/docs/en/flight_modes_mc/mission.md +++ b/docs/en/flight_modes_mc/mission.md @@ -13,6 +13,7 @@ The mission is typically created and uploaded with a Ground Control Station (GCS - RC control switches can be used to change flight modes on any vehicle. - Stick movement will [by default](#MAN_OVERRIDE_SPD) change the vehicle to [Position mode](../flight_modes_mc/position.md) unless prevented by the active failsafe state. This is true for multicopters and VTOL in hover. +- The yaw stick can optionally nudge vehicle heading during the mission without changing mode (see [MPC_AUTO_NUDGING](#MPC_AUTO_NUDGING)). ::: @@ -109,6 +110,7 @@ General parameters: | ----------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [NAV_RCL_ACT](../advanced_config/parameter_reference.md#NAV_RCL_ACT) | RC loss failsafe mode (what the vehicle will do if it looses RC connection) - e.g. enter hold mode, return mode, terminate etc. | | [MAN_OVERRIDE_SPD](../advanced_config/parameter_reference.md#MAN_OVERRIDE_SPD) | Speed (normalized stick travel per second) above which moving the sticks controlling a multicopter (or VTOL in hover) gives control back to the pilot by switching to [Position mode](../flight_modes_mc/position.md) (or Altitude mode if position is unavailable). At the default value of 1 a half-stick movement in ~0.5 s triggers it; lower is more sensitive. A stick held statically has zero speed and will not trigger. Set to -1 to disable. | +| [MPC_AUTO_NUDGING](../advanced_config/parameter_reference.md#MPC_AUTO_NUDGING) | Bitmask enabling stick nudging in Auto modes (multicopter). Bit 0 (yaw nudging) lets the yaw stick nudge heading without switching modes; the heading is held when the stick is released. Switching flight mode (e.g. to Hold and back) clears the held heading and returns yaw to the mode default. Requires stick override to be disabled ([MAN_OVERRIDE_SPD](#MAN_OVERRIDE_SPD) = -1). | Parameters related to [mission feasibility checks](#mission-feasibility-checks): diff --git a/docs/en/releases/1.18.md b/docs/en/releases/1.18.md index e3ea2b72e8..5ac1e2482a 100644 --- a/docs/en/releases/1.18.md +++ b/docs/en/releases/1.18.md @@ -130,9 +130,18 @@ Please continue reading for [upgrade instructions](#upgrade-guide). ### RC - Parse ELRS Status and Link Statistics TX messages in the CRSF parser. +- Merged the stick override parameters `COM_RC_OVERRIDE` and `COM_RC_STICK_OV` into a single [MAN_OVERRIDE_SPD](../advanced_config/parameter_reference.md#MAN_OVERRIDE_SPD) and made override reject erratic signal jumps. ([PX4-Autopilot#27041](https://github.com/PX4/PX4-Autopilot/pull/27041)). ### Multi-Rotor +- Removed parameters: + + | Name | Notes | + | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | + | `MPC_LAND_RC_HELP` | Replaced by Bit 1 of [MPC_AUTO_NUDGING](../advanced_config/parameter_reference.md#MPC_AUTO_NUDGING). ([PX4-Autopilot#27691](https://github.com/PX4/PX4-Autopilot/pull/27691)) | + +- Yaw stick nudging in auto modes ([MPC_AUTO_NUDGING](../advanced_config/parameter_reference.md#MPC_AUTO_NUDGING)). Bit 0 lets the yaw stick rotate vehicle heading during any auto mode (mission, RTL, hold, landing, takeoff) without switching modes. The heading is held when the stick is released and cleared on a flight mode switch. Requires stick override to be disabled ([MAN_OVERRIDE_SPD](../advanced_config/parameter_reference.md#MAN_OVERRIDE_SPD) = -1). ([PX4-Autopilot#27691](https://github.com/PX4/PX4-Autopilot/pull/27691)) + ### VTOL - [Return mode VTOL Rally Point Approach Loiters](../flight_modes_vtol/return.md#vtol-rally-point-approach-loiters): VTOLs returning in fixed-wing mode can now use the approach loiter associated with the selected home/rally landing location (instead of home) to choose the most wind-aligned valid approach (if several are defined). ([PX4-Autopilot#27004: fix(navigator): rtl compute wind angle to select best land approach based on rally point location instead of home location](https://github.com/PX4/PX4-Autopilot/pull/27004)) diff --git a/docs/en/releases/main.md b/docs/en/releases/main.md index f055734846..0cbeeaa4ca 100644 --- a/docs/en/releases/main.md +++ b/docs/en/releases/main.md @@ -22,8 +22,6 @@ Update these notes with features that are going to be in `main` (PX4 v1.18 or la ## Read Before Upgrading -- The RC override parameters `COM_RC_OVERRIDE` and `COM_RC_STICK_OV` are replaced by a single [MAN_OVERRIDE_SPD](../advanced_config/parameter_reference.md#MAN_OVERRIDE_SPD) (minimum stick speed to take over, default `1`; negative disables). `COM_RC_OVERRIDE=0` is migrated to `MAN_OVERRIDE_SPD=-1`. The `COM_RC_STICK_OV` value is not auto-migrated because its unit changed, so re-tune `MAN_OVERRIDE_SPD` if you had customized it. - Please continue reading for [upgrade instructions](#upgrade-guide). ## Major Changes @@ -82,7 +80,7 @@ Please continue reading for [upgrade instructions](#upgrade-guide). ### RC -- Merged the RC override parameters `COM_RC_OVERRIDE` and `COM_RC_STICK_OV` into a single [MAN_OVERRIDE_SPD](../advanced_config/parameter_reference.md#MAN_OVERRIDE_SPD) and made override reject erratic signal jumps. ([PX4-Autopilot#27041](https://github.com/PX4/PX4-Autopilot/pull/27041)). +- TBD ### Multi-Rotor diff --git a/docs/en/ros/offboard_control.md b/docs/en/ros/offboard_control.md index 5e95d37017..71550c1cfa 100644 --- a/docs/en/ros/offboard_control.md +++ b/docs/en/ros/offboard_control.md @@ -12,7 +12,7 @@ This is done through the MAVLink protocol, specifically the [SET_POSITION_TARGET There are two things you want to setup on the firmware side before starting offboard development. -### Enable RC Override +### Enable Stick Override In _QGroundControl_ the [MAN_OVERRIDE_SPD](../advanced_config/parameter_reference.md#MAN_OVERRIDE_SPD) parameter controls automatically switching from offboard (or autonomous) mode to Position mode when the remote sticks are moved. This is enabled by default; set it to -1 to disable. This is the best way to ensure that an operator can easily take control of the vehicle and switch to the safest flight mode. @@ -23,7 +23,7 @@ In _QGroundControl_ you can set the [RC_MAP_OFFB_SW](../advanced_config/paramete This can be used to switch between offboard mode and the mode set by the mode switch ([RC_MAP_MODE_SW](../advanced_config/parameter_reference.md#RC_MAP_MODE_SW)). You can also switch into offboard mode using a GCS/MAVLink so this is not "mandatory". -Note also that this mechanism is not as "safe" as using [RC Override](#enable-rc-override) to switch out of offboard mode, because the mode you switch to is unpredictable. +Note also that this mechanism is not as "safe" as using [stick Override](#enable-stick-override) to switch out of offboard mode, because the mode you switch to is unpredictable. ### Enable the companion computer interface diff --git a/src/lib/parameters/param_translation.cpp b/src/lib/parameters/param_translation.cpp index 2676888314..04c6a0a788 100644 --- a/src/lib/parameters/param_translation.cpp +++ b/src/lib/parameters/param_translation.cpp @@ -270,5 +270,21 @@ param_modify_on_import_ret param_modify_on_import(bson_node_t node) } } + // 2026-06-29: MPC_LAND_RC_HELP replaced by the MPC_AUTO_NUDGING bitmask (landing nudging = bit 1). + // The old in-Hold yaw nudge is not migrated; it now lives in bit 0 (yaw nudging in all auto modes). + { + if ((node->type == bson_type_t::BSON_INT32) && (strcmp("MPC_LAND_RC_HELP", node->name) == 0)) { + if (node->i32 != 0) { + int32_t nudging = 0; + param_get(param_find("MPC_AUTO_NUDGING"), &nudging); + nudging |= (1 << 1); + param_set(param_find("MPC_AUTO_NUDGING"), &nudging); + } + + PX4_INFO("migrating MPC_LAND_RC_HELP -> MPC_AUTO_NUDGING bit 1 (value=%" PRId32 ")", node->i32); + return param_modify_on_import_ret::PARAM_SKIP_IMPORT; + } + } + return param_modify_on_import_ret::PARAM_NOT_MODIFIED; } diff --git a/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.cpp b/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.cpp index 38ae6a835a..0bc60b4e09 100644 --- a/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.cpp +++ b/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.cpp @@ -53,6 +53,10 @@ bool FlightTaskAuto::activate(const trajectory_setpoint_s &last_setpoint) _yaw_setpoint = _yaw; _yawspeed_setpoint = 0.0f; + _manual_yaw_active = false; + _triplet_yaw = NAN; + _nav_state_prev = _sub_vehicle_status.get().nav_state; + Vector3f vel_prev{last_setpoint.velocity}; Vector3f pos_prev{last_setpoint.position}; Vector3f accel_prev{last_setpoint.acceleration}; @@ -101,9 +105,6 @@ bool FlightTaskAuto::updateInitialize() _sub_vehicle_status.update(); _position_setpoint_triplet_sub.update(); _takeoff_status_sub.update(); -#if defined(CONFIG_MODULES_VISION_TARGET_ESTIMATOR) && CONFIG_MODULES_VISION_TARGET_ESTIMATOR - _prec_land_status_sub.update(); -#endif // CONFIG_MODULES_VISION_TARGET_ESTIMATOR // require valid reference and valid target ret = ret && _evaluateGlobalReference() && _evaluatePositionSetpointTriplet(); @@ -153,11 +154,6 @@ bool FlightTaskAuto::update() break; case WaypointType::loiter: - if (_param_mpc_land_rc_help.get() && _sticks.checkAndUpdateStickInputs()) { - rcHelpModifyYaw(_yaw_setpoint); - } - - // FALLTHROUGH case WaypointType::takeoff: case WaypointType::position: default: @@ -222,7 +218,7 @@ bool FlightTaskAuto::update() _unsmoothed_velocity_setpoint = smoothed_setpoints.unsmoothed_velocity; _want_takeoff = smoothed_setpoints.unsmoothed_velocity(2) < -0.3f; - if (!PX4_ISFINITE(_yaw_setpoint) && !PX4_ISFINITE(_yawspeed_setpoint)) { + if (!PX4_ISFINITE(_yaw_setpoint) && !PX4_ISFINITE(_yawspeed_setpoint) && !_manual_yaw_active) { // no valid heading -> generate heading in this flight task // Generate heading along trajectory if possible, otherwise hold the previous yaw setpoint if (!_generateHeadingAlongTraj()) { @@ -233,10 +229,34 @@ bool FlightTaskAuto::update() // update previous type _type_previous = _type; + const uint8_t nav_state = _sub_vehicle_status.get().nav_state; + + if (nav_state != _nav_state_prev) { + _manual_yaw_active = false; + } + + _nav_state_prev = nav_state; + + const bool rc_yaw_type = (_type == WaypointType::position || _type == WaypointType::takeoff + || _type == WaypointType::loiter || _type == WaypointType::land); + const int nudging = _param_mpc_auto_nudging.get(); + const bool yaw_nudge_enabled = ((nudging & 1) && rc_yaw_type) || ((nudging & 2) && _type == WaypointType::land); + + if (yaw_nudge_enabled && _sticks.checkAndUpdateStickInputs()) { + if (fabsf(_sticks.getYawExpo()) > FLT_EPSILON) { + _manual_yaw_active = true; + } + + if (_manual_yaw_active) { + rcHelpModifyYaw(_yaw_setpoint); + } + + } else { + _manual_yaw_active = false; + } + _smoothYaw(); - _constraints.want_takeoff = _checkTakeoff(); - return ret; } @@ -273,13 +293,6 @@ void FlightTaskAuto::_prepareLandSetpoints() } if (_type_previous != WaypointType::land) { - // initialize yaw and xy-position - _land_heading = PX4_ISFINITE(_yaw_setpoint) ? _yaw_setpoint : _yaw_setpoint_previous; - - if (!PX4_ISFINITE(_land_heading)) { - _land_heading = _yaw; - } - _stick_acceleration_xy.resetPosition(Vector2f(_triplet_current)); _initial_land_position = Vector3f(_triplet_current(0), _triplet_current(1), NAN); } @@ -287,37 +300,22 @@ void FlightTaskAuto::_prepareLandSetpoints() // Update xy-position in case of landing position changes (etc. precision landing) _land_position = Vector3f(_triplet_current(0), _triplet_current(1), NAN); -#if defined(CONFIG_MODULES_VISION_TARGET_ESTIMATOR) && CONFIG_MODULES_VISION_TARGET_ESTIMATOR - - // Use the raw navigator/precland yaw command here. _yaw_setpoint can stay finite from - // generic land yaw logic even after precland clears current.yaw. - const uint8_t pld_state = _prec_land_status_sub.get().state; - const bool pld_ongoing = pld_state != prec_land_status_s::PREC_LAND_STATE_STOPPED - && pld_state != prec_land_status_s::PREC_LAND_STATE_DONE; - - if (_param_pld_yaw_en.get() && pld_ongoing) { - const float prec_land_yaw = _position_setpoint_triplet_sub.get().current.yaw; - _land_heading = PX4_ISFINITE(prec_land_yaw) ? prec_land_yaw : _yaw; - } - -#endif // CONFIG_MODULES_VISION_TARGET_ESTIMATOR - // User input assisted landing - if (_param_mpc_land_rc_help.get() && _sticks.checkAndUpdateStickInputs()) { + if ((_param_mpc_auto_nudging.get() & 2) && _sticks.checkAndUpdateStickInputs()) { // Stick full up -1 -> stop, stick full down 1 -> double the speed vertical_speed *= (1 - _sticks.getThrottleZeroCenteredExpo()); Vector2f sticks_xy = _sticks.getPitchRollExpo(); if (sticks_xy.longerThan(FLT_EPSILON)) { - // Ensure no unintended yawing when nudging horizontally during initial heading alignment - _land_heading = _yaw_setpoint_previous; + // Prevent unintended yaw during initial heading alignment when nudging horizontally + _yaw_setpoint = _yaw_setpoint_previous; } - rcHelpModifyYaw(_land_heading); - + // Yaw nudging is handled by the unified block in update(); use current _yaw_setpoint for XY rotation + const float heading_for_xy = PX4_ISFINITE(_yaw_setpoint) ? _yaw_setpoint : _yaw; Vector2f sticks_ne = sticks_xy; - Sticks::rotateIntoHeadingFrameXY(sticks_ne, _yaw, _land_heading); + Sticks::rotateIntoHeadingFrameXY(sticks_ne, _yaw, heading_for_xy); float max_speed = INFINITY; @@ -344,7 +342,7 @@ void FlightTaskAuto::_prepareLandSetpoints() } _stick_acceleration_xy.setVelocityConstraint(max_speed); - _stick_acceleration_xy.generateSetpoints(sticks_xy, _yaw, _land_heading, _position, + _stick_acceleration_xy.generateSetpoints(sticks_xy, _yaw, heading_for_xy, _position, _velocity_setpoint_feedback.xy(), _deltatime); _stick_acceleration_xy.getSetpoints(_land_position, _velocity_setpoint, _acceleration_setpoint); @@ -356,7 +354,6 @@ void FlightTaskAuto::_prepareLandSetpoints() } _position_setpoint = _land_position; // The last element of the land position has to stay NAN - _yaw_setpoint = _land_heading; _velocity_setpoint(2) = vertical_speed; _gear.landing_gear = landing_gear_s::GEAR_DOWN; } @@ -527,13 +524,29 @@ bool FlightTaskAuto::_evaluatePositionSetpointTriplet() _yaw_lock = false; _yaw_setpoint = NAN; _yawspeed_setpoint = 0.f; - - } else if (PX4_ISFINITE(position_setpoint_triplet.current.yaw)) { - _yaw_setpoint = position_setpoint_triplet.current.yaw; - _yawspeed_setpoint = NAN; + _triplet_yaw = NAN; // force re-detection on recovery } else { - _set_heading_from_mode(); + const float triplet_yaw = position_setpoint_triplet.current.yaw; + + if (PX4_ISFINITE(triplet_yaw)) { + // End of RTL changes yaw once, precision land can change it all the time + const bool yaw_changed = !PX4_ISFINITE(_triplet_yaw) + || fabsf(wrap_pi(triplet_yaw - _triplet_yaw)) > 1e-4f; + + if (!_manual_yaw_active || yaw_changed) { + _yaw_setpoint = triplet_yaw; + _yawspeed_setpoint = NAN; + _manual_yaw_active = false; // navigator published a different yaw, reset nudge latch + } + + } else if (!_manual_yaw_active && (_type != WaypointType::land || _type_previous != WaypointType::land)) { + // Skip when manual yaw latch is active (nudge holds heading until mode switch) or + // during ongoing land (heading initialised on first cycle, only nudging/weathervane may change it). + _set_heading_from_mode(); + } + + _triplet_yaw = triplet_yaw; // NaN resets for future detection, finite value tracks last seen } } @@ -686,6 +699,10 @@ void FlightTaskAuto::_ekfResetHandlerHeading(const float delta_psi) { _yaw_setpoint_previous = wrap_pi(_yaw_setpoint_previous + delta_psi); _heading_smoothing.reset(wrap_pi(_heading_smoothing.getSmoothedHeading() + delta_psi)); + + if (PX4_ISFINITE(_yaw_setpoint)) { + _yaw_setpoint = wrap_pi(_yaw_setpoint + delta_psi); + } } void FlightTaskAuto::_checkEmergencyBraking() diff --git a/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.hpp b/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.hpp index 15190b9dd9..8da05e4907 100644 --- a/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.hpp +++ b/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.hpp @@ -44,9 +44,6 @@ #include #include #include -#if defined(CONFIG_MODULES_VISION_TARGET_ESTIMATOR) && CONFIG_MODULES_VISION_TARGET_ESTIMATOR -#include -#endif // CONFIG_MODULES_VISION_TARGET_ESTIMATOR #include #include #include @@ -124,9 +121,6 @@ protected: WaypointType _type{WaypointType::idle}; /**< Type of current target triplet. */ uORB::SubscriptionData _position_setpoint_triplet_sub{ORB_ID(position_setpoint_triplet)}; -#if defined(CONFIG_MODULES_VISION_TARGET_ESTIMATOR) && CONFIG_MODULES_VISION_TARGET_ESTIMATOR - uORB::SubscriptionData _prec_land_status_sub {ORB_ID(prec_land_status)}; -#endif // CONFIG_MODULES_VISION_TARGET_ESTIMATOR uORB::SubscriptionData _sub_home_position {ORB_ID(home_position)}; uORB::SubscriptionData _sub_vehicle_status{ORB_ID(vehicle_status)}; uORB::SubscriptionData _takeoff_status_sub{ORB_ID(takeoff_status)}; @@ -134,6 +128,9 @@ protected: float _target_acceptance_radius{0.0f}; /**< Acceptances radius of the target */ float _yaw_setpoint_previous{NAN}; /**< Used because _yaw_setpoint is overwritten in multiple places */ + float _triplet_yaw{NAN}; /**< Last yaw from position_setpoint_triplet, to detect navigator changes */ + bool _manual_yaw_active{false}; + uint8_t _nav_state_prev{0}; HeadingSmoothing _heading_smoothing; bool _yaw_sp_aligned{false}; @@ -143,15 +140,11 @@ protected: StickAccelerationXY _stick_acceleration_xy{this}; StickYaw _stick_yaw{this}; matrix::Vector3f _land_position; - float _land_heading; WaypointType _type_previous{WaypointType::idle}; /**< Previous type of current target triplet. */ bool _is_emergency_braking_active{false}; bool _want_takeoff{false}; DEFINE_PARAMETERS_CUSTOM_PARENT(FlightTask, -#if defined(CONFIG_MODULES_VISION_TARGET_ESTIMATOR) && CONFIG_MODULES_VISION_TARGET_ESTIMATOR - (ParamInt) _param_pld_yaw_en, -#endif // CONFIG_MODULES_VISION_TARGET_ESTIMATOR (ParamFloat) _param_mpc_xy_cruise, (ParamFloat) _param_nav_mc_alt_rad, //vertical acceptance radius at which waypoints are updated @@ -168,7 +161,7 @@ protected: (ParamFloat) _param_mpc_z_err_max, (ParamFloat) _param_mpc_land_speed, (ParamFloat) _param_mpc_land_crwl, - (ParamInt) _param_mpc_land_rc_help, + (ParamInt) _param_mpc_auto_nudging, (ParamFloat) _param_mpc_land_radius, (ParamFloat) _param_mpc_land_alt1, (ParamFloat) _param_mpc_land_alt2, diff --git a/src/modules/flight_mode_manager/tasks/Descend/FlightTaskDescend.cpp b/src/modules/flight_mode_manager/tasks/Descend/FlightTaskDescend.cpp index 4d16f7d4c9..9470afd7f2 100644 --- a/src/modules/flight_mode_manager/tasks/Descend/FlightTaskDescend.cpp +++ b/src/modules/flight_mode_manager/tasks/Descend/FlightTaskDescend.cpp @@ -59,7 +59,7 @@ bool FlightTaskDescend::update() } // Nudging - if (_param_mpc_land_rc_help.get() && _sticks.checkAndUpdateStickInputs()) { + if ((_param_mpc_auto_nudging.get() & 2) && _sticks.checkAndUpdateStickInputs()) { _stick_yaw.generateYawSetpoint(_yawspeed_setpoint, _yaw_setpoint, _sticks.getYawExpo(), _yaw, _deltatime); _acceleration_setpoint.xy() = _stick_tilt_xy.generateAccelerationSetpoints(_sticks.getPitchRoll(), _deltatime, _yaw, _yaw_setpoint); diff --git a/src/modules/flight_mode_manager/tasks/Descend/FlightTaskDescend.hpp b/src/modules/flight_mode_manager/tasks/Descend/FlightTaskDescend.hpp index 46ae7543d1..e774f7e35c 100644 --- a/src/modules/flight_mode_manager/tasks/Descend/FlightTaskDescend.hpp +++ b/src/modules/flight_mode_manager/tasks/Descend/FlightTaskDescend.hpp @@ -57,7 +57,7 @@ private: StickYaw _stick_yaw{this}; DEFINE_PARAMETERS_CUSTOM_PARENT(FlightTask, - (ParamInt) _param_mpc_land_rc_help, + (ParamInt) _param_mpc_auto_nudging, (ParamFloat) _param_mpc_land_speed, ///< velocity for controlled descend (ParamFloat) _param_mpc_thr_hover ///< thrust at hover equilibrium ) diff --git a/src/modules/mc_pos_control/multicopter_nudging_params.yaml b/src/modules/mc_pos_control/multicopter_nudging_params.yaml index add0e0b381..8efcee8c12 100644 --- a/src/modules/mc_pos_control/multicopter_nudging_params.yaml +++ b/src/modules/mc_pos_control/multicopter_nudging_params.yaml @@ -2,29 +2,32 @@ module_name: mc_pos_control parameters: - group: Multicopter Position Control definitions: - MPC_LAND_RC_HELP: + MPC_AUTO_NUDGING: description: - short: Enable nudging based on user input during autonomous land routine + short: Enable stick nudging in autonomous modes long: |- - Using stick input the vehicle can be moved horizontally and yawed. - The descend speed is amended: - stick full up - 0 - stick centered - MPC_LAND_SPEED - stick full down - 2 * MPC_LAND_SPEED + Bitmask to enable pilot override of heading and position during auto modes. - Manual override has to be disabled to use this feature (MAN_OVERRIDE_SPD -1). - type: enum - values: - 0: Nudging disabled - 1: Nudging enabled + Bit 0 - Yaw nudging: yaw stick rotates the heading in all auto types + (takeoff, mission, RTL, hold, landing). The new heading is held until a + mode switch resets it. + + Bit 1 - Land nudging: during autonomous landing the pitch/roll sticks move + the vehicle horizontally, the throttle stick amends the descent speed + (stick full up: 0, centered: MPC_LAND_SPEED, full down: 2 * MPC_LAND_SPEED), + and the yaw stick rotates the heading. + + Stick override must be disabled (set MAN_OVERRIDE_SPD = -1). + type: bitmask + bit: + 0: Yaw nudging + 1: Landing nudging default: 0 - min: 0 - max: 1 MPC_LAND_RADIUS: description: short: User assisted landing radius long: |- - When nudging is enabled (see MPC_LAND_RC_HELP), this defines the maximum + When landing nudging is enabled (MPC_AUTO_NUDGING bit 1), this defines the maximum allowed horizontal displacement from the original landing point. - If inside of the radius, only allow nudging inputs that do not move the vehicle outside of it. - If outside of the radius, only allow nudging inputs that move the vehicle back towards it.