Commit Graph
51 Commits
Author SHA1 Message Date
Leonard Thall 044b249da5 AP_Math: limit_accel_xy: take a normalised velocity, fade below 0.25 2026-07-27 12:10:17 +09:00
ChrisRosserandClaude Opus 4.8 99619ec9bc AP_Math: fade cross-track accel prioritisation to zero near zero speed
limit_accel_xy() splits the acceleration command into along-track and
cross-track components using the normalised velocity, and prioritises the
cross-track component when the command saturates the maximum lean angle.

As the velocity vector rotates through zero (e.g. a hard stick reversal in
Loiter, where forward speed passes through zero before reversing) the unit
velocity spins rapidly. With any small residual lateral velocity (wind crab,
residual velocity from prior manoeuvring) this re-projects the saturated
longitudinal braking command onto a rapidly rotating axis and emits a large
lateral acceleration spike, seen as a roll wobble at the moment of the stop
and as a PSCE.TAE spike at each PSCN.VN zero crossing.

Fade the cross-track prioritisation out to a direction-preserving magnitude
limit below LIMIT_ACCEL_XY_MIN_SPEED_MS (1 m/s). Above that speed behaviour is
unchanged, so path/corner tracking is unaffected. The limiter only acts when
the command saturates the lean-angle limit, and stationary hold already used
the isotropic branch, so precision position hold is unaffected.

Adds a regression test sweeping velocity through zero and asserting no lateral
acceleration is injected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-27 12:10:17 +09:00
Leonard Hall c2045d7198 AP_Math: Remove fabsf from kinematic_limit clean up 2026-04-15 15:43:13 +10:00
Leonard Hall 0760b4c7c0 AP_Math: Clarify kinematic_limit clean up 2026-04-15 15:43:13 +10:00
Leonard Hall 74b078e67c AP_Math: Clarify kinematic_limit behavior and improve naming 2026-04-14 09:06:33 +09:00
Leonard Hall bc6e5150f6 AP_Math: Support future plane command model requirements. 2026-02-04 18:38:37 +11:00
Leonard Hall 8d30995077 AP_Math: limit_accel_corner_xy: Improve function readability. 2026-01-26 19:07:31 -05:00
Leonard Hall 420ddafa1a AP_Math: Shaper algorithm - limit handling update 2026-01-26 19:07:31 -05:00
Leonard Hall 801ac6ad64 AP_Math: limit_accel_corner_xy: Improve post corner cross track behavior 2026-01-26 19:07:31 -05:00
Leonard Hall 5170571b51 AP_Math: Simplify Shaper algorithm, same behavior 2026-01-26 19:07:31 -05:00
Leonard Hall 4d07b4216a AP_Math: limit_accel_corner_xy: Improve corner behavior 2026-01-26 19:07:31 -05:00
Leonard Hall 2f5e5e7c6b AP_Math: Tighten sqrt_controller_accel input checks 2026-01-26 19:07:31 -05:00
Leonard Hall 4692e07845 AP_Math: Update shaping to use improved command model 2026-01-26 19:07:31 -05:00
Leonard Hall 84bf935c1c AP_Math: Control: Add limit_accel_corner_xy 2026-01-08 11:50:49 +11:00
Leonard Hall aba26e9882 AP_Math: Control: Name and comment changes 2026-01-08 06:43:51 +11:00
Leonard Hall acc584da2a AP_Math: NEU to NED renaming - Conversion 2025-12-17 08:03:10 +09:00
Leonard Hall d650d534f9 AP_Math: Support SCurve Arcs 2025-11-12 20:47:30 +11:00
Leonard Hall df6e48f1fd AP_Math: Control: Improve comments 2025-07-11 13:50:33 +09:00
Leonard Hall 816fb9c2e3 AP_Math: Convert copter to radians 2025-07-01 09:06:25 +09:00
Leonard Hall c5c840ecd5 AP_Math: Names and Units 2025-06-23 15:05:55 +09:00
Leonard Hall 5fb3e867fb AP_Math: Control: add Const 2025-05-22 11:53:02 +09:00
Leonard Hall dd091a7fe0 AP_Math: fix shape limits 2025-05-22 11:53:02 +09:00
Leonard Hall 2b818520cc AP_Math: Control: Add heading input shaping 2025-05-22 11:53:02 +09:00
9dc992619b AP_Math: prevent FPE in SITL when limiting accel vectors
The cross-product code can produce something slightly negative. Fix
safe_sqrt to avoid barfing on that, as was originally intended, and
clarify why it's being used.

Co-authored-by: Leonard Hall <leonardthall@gmail.com>
Co-authored-by: Thomas Watson <twatson52@icloud.com>
2025-01-07 16:08:03 +11:00
Leonard Hall ac3a3d9576 AP_Math: Target velocity can reduce when limited
AP_Math: Target velocity can reduce when limited
2022-12-30 20:25:58 +09:00
Leonard Hall 114e8e2f52 AP_Math: Control Tools Enhancments
AP_Math: Control Tools Enhancments
2022-12-30 20:25:58 +09:00
Leonard Hall 1382923db0 AP_Math: Support changing update period 2022-12-13 17:10:06 +11:00
Leonard Hall 1e3e5e5577 AP_Math: Control: Add velocity limits to shaping functions 2022-08-08 20:54:37 -04:00
Leonard Hall 1a21c6da1e AP_Math: Move rc_input_to_roll_pitch conversion 2022-05-31 08:08:17 +09:00
Andrew Tridgell ca4151be2c AP_Math: added angle_to_accel() and accel_to_angle() 2022-03-18 13:36:16 +11:00
Randy Mackay f57a081ceb AP_Math: minor control format fix 2022-02-08 17:01:23 +09:00
Leonard Hall a47fc65511 AP_Math: Control: improve real time S-Curve response to small inputs 2022-02-08 16:58:44 +09:00
Randy Mackay 8bbdd4825f AP_Math: minor control spelling and format fixes 2022-01-12 13:07:15 +09:00
Leonard Hall 1e124ca957 AP_Math: Control: Add directional based acceleration limit
AP_Math: Control: Add directional based acceleration limit
2021-12-16 09:54:49 +09:00
Randy Mackay 09388b7408 AP_Math: minor comment fix 2021-12-15 11:58:23 +09:00
Leonard Hall 718c094293 AP_Math: Control: Adjust limit handling to improve corners 2021-12-07 09:47:42 +09:00
Randy Mackay 4096a70a1f AP_Math: update_pos_vel_accel methods accept limit as const reference
also update some comments
2021-12-01 12:45:46 +09:00
Iampete1 460df9bb50 AP_Math: control: remove unneeded normalisation. 2021-11-23 13:47:10 +09:00
Leonard Hall 77fbcf1741 AP_Math: Control: add expo calculation. 2021-09-23 20:03:53 +09:00
Leonard Hall 8961695369 AP_Math: Control: Refactor to use Jerk 2021-08-11 17:07:29 +09:00
Leonard Hall 3a8924c185 AP_Math: Control: protect against divide by zero 2021-08-11 17:07:29 +09:00
Leonard Hall de36398ebf AC_Math: Control: Support Accel only input 2021-07-10 20:25:05 +09:00
Andrew Tridgell 9b91cfe4ee AP_Math: implement double versions of some position control methods 2021-06-24 21:34:30 +10:00
Andrew Tridgell 639570505b AP_Math: cleanups from Leonards feedback 2021-06-24 20:28:45 +10:00
Andrew Tridgell 566dd8ca8b AP_Math: cleanup API comments on control code 2021-06-24 20:28:45 +10:00
Andrew Tridgell 86f09cad09 AP_Math: cleanup position control APIs
use Vector2 for xy, float for z
2021-06-24 20:28:45 +10:00
Leonard Hall 5c47c0a131 AP_Math: Fix before squash 2021-05-24 20:13:37 +10:00
Leonard Hall c4bb8baf0c AP_Math: Control: Add XY S-Curve shapers and shaping limits 2021-05-24 20:13:37 +10:00
Randy Mackay 0e506a71a1 AP_Math: remove control's limit_vector_length
these have been moved to Vector2f and Vector3f
2021-04-03 12:07:59 +09:00
Leonard Hall 3bb0482795 AP_Math: add update_pos_vel_accel to control
also add shape_vel, shape_pos_vel and stopping_distance
also add calculation of kinematic limits
2021-04-03 12:07:59 +09:00