fix(mc_pos_control): allow disabling trajectory time-stretch and fix docs

The trajectory time-stretch is skipped when the max-error param is at or below
FLT_EPSILON, so zero is a valid 'disabled' setting. Lower the minimum of
MPC_XY_ERR_MAX and MPC_Z_ERR_MAX from 0.1 to 0 so users can actually select it,
and document it in both params.

Also fix the setMaxAllowedVerticalError() doc comment, which incorrectly
claimed zero was the default: the MPC_Z_ERR_MAX param default is 1 m.

Signed-off-by: Julian Oes <julian@oes.ch>
This commit is contained in:
Julian Oes
2026-06-24 14:59:31 +12:00
committed by Ramon Roche
parent 49535090a8
commit 94c12f468c
2 changed files with 9 additions and 7 deletions

View File

@@ -333,9 +333,9 @@ public:
/**
* @param error Maximum vertical error allowed by the trajectory generator. Set to param MPC_Z_ERR_MAX.
* Zero (default) disables vertical time-stretch — trajectory integration is only slowed by horizontal
* lag. A finite value makes the smoother slow down when the virtual trajectory leads the drone in Z,
* preventing a noisy altitude reference from walking the commanded z away from the drone.
* Zero disables vertical time-stretch — trajectory integration is only slowed by horizontal lag.
* A finite value (param default is 1 m) makes the smoother slow down when the virtual trajectory leads
* the drone in Z, preventing a noisy altitude reference from walking the commanded z away from the drone.
*/
inline void setMaxAllowedVerticalError(float error)
{

View File

@@ -123,10 +123,11 @@ parameters:
trajectory is stopped to wait for the drone.
This value can be adjusted depending on the tracking
capabilities of the vehicle.
capabilities of the vehicle. Set to 0 to disable the horizontal
time-stretch.
type: float
default: 2.0
min: 0.1
min: 0
max: 10
decimal: 1
increment: 1
@@ -139,10 +140,11 @@ parameters:
slowed down so the virtual setpoint can't walk away from the drone.
This suppresses altitude overshoots caused by a noisy altitude
reference (e.g. mission setpoint jittering as the home altitude
estimate is refined in flight).
estimate is refined in flight). Set to 0 to disable the vertical
time-stretch.
type: float
default: 1.0
min: 0.1
min: 0
max: 10
decimal: 1
increment: 0.1