mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-07-24 15:27:41 +08:00
* fix(fw_mode_manager): honor DO_CHANGE_SPEED in manual airspeed modes Re-anchor the throttle-stick airspeed interpolation on the last MAV_CMD_DO_CHANGE_SPEED value (falling back to FW_AIRSPD_TRIM if none). Previously, _commanded_manual_airspeed_setpoint was stored but never read when FW_POS_STK_CONF bit 1 was set (the default), so DO_CHANGE_SPEED had no effect in Position/Altitude. With this change: - Stick centered = commanded cruise speed (= FW_AIRSPD_TRIM if no command). - Stick deflection deviates from cruise between FW_AIRSPD_MIN/MAX. - Disconnecting the controller collapses the interpolation to the cruise (Sticks zeroes the throttle channel on manual_control_signal_lost). - No setpoint jump when a controller is plugged in with stick centered. - No behavior change for users who never send DO_CHANGE_SPEED. * fix(fw_mode_manager): clear DO_CHANGE_SPEED override on mode change Reset _commanded_manual_airspeed_setpoint to NaN when entering a manual airspeed mode from outside the manual airspeed pair, so a prior MAV_CMD_DO_CHANGE_SPEED does not silently anchor the manual airspeed setpoint after the pilot has left and re-entered manual airspeed control. Toggling between Position and Altitude preserves the commanded value since both modes share the same airspeed mechanic. Also fold in a make-format whitespace fix in get_manual_airspeed_setpoint. * docs(flight_modes_fw): document DO_CHANGE_SPEED in manual airspeed modes Describe how MAV_CMD_DO_CHANGE_SPEED re-anchors the throttle-stick cruise airspeed in Position and Altitude mode, matching the new behavior in the fw_mode_manager. Covers the centered-stick anchor, deflection scaling between FW_AIRSPD_MIN/MAX, the shared setpoint across both modes, and the reset to trim when entering from any other mode. Signed-off-by: Gregor Hohl <gregor.hohl@auterion.com> * Subedit * fix(fw_mode_manager): reset DO_CHANGE_SPEED override on any mode change Reset _commanded_manual_airspeed_setpoint to NaN whenever the position control mode changes, instead of only when entering manual airspeed control from outside the Position/Altitude pair. This makes the manual airspeed setpoint revert to FW_AIRSPD_TRIM on every mode change, including toggling between Position and Altitude, for predictable behavior. Signed-off-by: Gregor Hohl <gregor.hohl@auterion.com> * docs(flight_modes_fw): note manual airspeed resets on mode change Clarify that the commanded airspeed defaults to FW_AIRSPD_TRIM when no airspeed has been commanded, and document that the commanded airspeed resets on every flight mode change. Signed-off-by: Gregor Hohl <gregor.hohl@auterion.com> * docs(flight_modes_fw): clarify DO_CHANGE_SPEED param1/param2 handling Signed-off-by: Gregor Hohl <gregor.hohl@auterion.com> --------- Signed-off-by: Gregor Hohl <gregor.hohl@auterion.com> Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
69 lines
5.8 KiB
Markdown
69 lines
5.8 KiB
Markdown
# Position Mode (Fixed-Wing)
|
|
|
|
<img src="../../assets/site/difficulty_easy.png" title="Easy to fly" width="30px" /> <img src="../../assets/site/remote_control.svg" title="Manual/Remote control required" width="30px" /> <img src="../../assets/site/position_fixed.svg" title="Position fix required (e.g. GPS)" width="30px" />
|
|
|
|
_Position mode_ is the easiest and safest manual mode.
|
|
It is supported on vehicles that have a position estimate (e.g. GPS).
|
|
It makes it easier for pilots to control vehicle altitude, and in particular to reach and maintain a fixed altitude.
|
|
The mode will hold the vehicle's course against wind.
|
|
Airspeed is actively controlled if an airspeed sensor is installed.
|
|
|
|
The vehicle performs a [coordinated turn](https://en.wikipedia.org/wiki/Coordinated_flight) if the roll sticks are non-zero, while the pitch stick controls the rate of ascent/descent.
|
|
The throttle determines airspeed — at 50% throttle the aircraft will hold its current altitude with a preset cruise speed.
|
|
|
|
When all sticks are released/centered (no roll, pitch, yaw, and ~50% throttle) the aircraft will return to straight, level flight, and keep its current altitude and flight path irrespective of wind.
|
|
This makes it easy to recover from any problems when flying.
|
|
Roll and pitch are angle-controlled (so it is impossible to roll over or loop the vehicle).
|
|
|
|
The yaw stick can be used to increase/reduce the yaw rate of the vehicle in turns.
|
|
If left at center the controller does the turn coordination by itself, meaning that it will apply the necessary yaw rate for the current roll angle to perform a smooth turn.
|
|
The diagram below shows the mode behaviour visually (for a [mode 2 transmitter](../getting_started/rc_transmitter_receiver.md#transmitter_modes)).
|
|
|
|

|
|
|
|
## Technical Description
|
|
|
|
Position mode is like [Stabilized mode](../flight_modes_fw/altitude.md) but with course stabilization.
|
|
Airspeed is also stabilized if an airspeed sensor is present.
|
|
|
|
- Centered Roll/Pitch/Yaw inputs (inside deadband):
|
|
- Autopilot levels vehicle and maintains altitude, airspeed and course over ground.
|
|
- Outside center:
|
|
- Pitch stick controls altitude.
|
|
- Throttle stick controls the airspeed of the aircraft if an airspeed sensor is connected. Without an airspeed sensor the vehicle will fly level at trim throttle ([FW_THR_TRIM](../advanced_config/parameter_reference.md#FW_THR_TRIM)), increasing or decreasing throttle as needed to climb or descend.
|
|
- Roll stick controls roll angle. Autopilot will maintain [coordinated flight](https://en.wikipedia.org/wiki/Coordinated_flight).
|
|
- Yaw stick adds an additional yaw rate setpoint (added to the one calculated by the autopilot to maintain coordinated flight).
|
|
Can be used to manually change the side slip of the vehicle.
|
|
- Manual control input is required (such as RC control, joystick).
|
|
- An altitude measurement source is required (usually barometer or GPS)
|
|
|
|
## Parameters
|
|
|
|
The mode is affected by the following parameters:
|
|
|
|
| Parameter | Description |
|
|
| ----------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
|
|
| <a id="FW_AIRSPD_MIN"></a>[FW_AIRSPD_MIN](../advanced_config/parameter_reference.md#FW_AIRSPD_MIN) | Min airspeed. Default: 10 m/s. |
|
|
| <a id="FW_AIRSPD_MAX"></a>[FW_AIRSPD_MAX](../advanced_config/parameter_reference.md#FW_AIRSPD_MAX) | Max airspeed. Default: 20 m/s. |
|
|
| <a id="FW_AIRSPD_TRIM"></a>[FW_AIRSPD_TRIM](../advanced_config/parameter_reference.md#FW_AIRSPD_TRIM) | Cruise speed. Default: 15 m/s. |
|
|
| <a id="FW_MAN_P_MAX"></a>[FW_MAN_P_MAX](../advanced_config/parameter_reference.md#FW_MAN_P_MAX) | Max pitch setpoint in attitude stabilized mode. Default: 45 degrees. |
|
|
| <a id="FW_MAN_R_MAX"></a>[FW_MAN_R_MAX](../advanced_config/parameter_reference.md#FW_MAN_R_MAX) | Max roll setpoint in attitude stabilized mode. Default: 45 degrees. |
|
|
| <a id="FW_T_CLMB_R_SP"></a>[FW_T_CLMB_R_SP](../advanced_config/parameter_reference.md#FW_T_CLMB_R_SP) | Max climb rate setpoint. Default: 3 m/s. |
|
|
| <a id="FW_T_SINK_R_SP"></a>[FW_T_SINK_R_SP](../advanced_config/parameter_reference.md#FW_T_SINK_R_SP) | Max sink rate setpoint. Default: 2 m/s. |
|
|
| <a id="FW_PN_R_SLEW_MAX"></a>[FW_PN_R_SLEW_MAX](../advanced_config/parameter_reference.md#FW_PN_R_SLEW_MAX) | Roll setpoint slew rate limit. Default: 90 °/s. |
|
|
|
|
## MAVLink Commands
|
|
|
|
The following commands are relevant to this mode:
|
|
|
|
- [MAV_CMD_DO_CHANGE_SPEED](https://mavlink.io/en/messages/common.html#MAV_CMD_DO_CHANGE_SPEED) — Sets the cruise airspeed for centred throttle stick.
|
|
|
|
This requires an airspeed sensor.
|
|
Only the airspeed speed type is handled (`param1` must be `0`); other speed types are ignored.
|
|
At centered throttle the vehicle holds the commanded airspeed (`param2`) if a positive value is set (non-positive values are ignored).
|
|
The value is constrained between [FW_AIRSPD_MIN](../advanced_config/parameter_reference.md#FW_AIRSPD_MIN) and [FW_AIRSPD_MAX](../advanced_config/parameter_reference.md#FW_AIRSPD_MAX), and defaults to [FW_AIRSPD_TRIM](../advanced_config/parameter_reference.md#FW_AIRSPD_TRIM) if no airspeed has been commanded.
|
|
Deflecting the throttle stick scales the airspeed toward `FW_AIRSPD_MIN` (back) or `FW_AIRSPD_MAX` (forward) around this value.
|
|
The commanded airspeed resets to `FW_AIRSPD_TRIM` on every flight mode change.
|
|
|
|
Note, other commands may be supported.
|