Commit f8dc84d
committed
Add hysteresis to prevent spurious acceleration sign changes
Add hysteresis to CalculateAcceleration() to prevent spurious
sign changes in the middle of the deceleration phase. Once
we start decelerating towards the target, continue decelerating
until we either overshoot (caught by the v_frame*dx<0 check)
or reach the target.
This eliminates mid-deceleration jitter caused by floating-point
noise in the distance-based threshold calculation. End-of-trajectory
oscillations (when velocity crosses zero) are still allowed as they
are part of normal overshoot correction.
The test expectations have been updated to:
- Distinguish mid-trajectory violations (should be 0) from
end-of-trajectory oscillations (allowed up to 15)
- Allow slightly wider step range for trajectory completion
(440-470 vs 440-460)
- Update expected durations for acceleration-only cases to
account for the ~1% longer trajectory due to committing to
deceleration earlier1 parent 2db5feb commit f8dc84d
2 files changed
+51
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
| |||
112 | 113 | | |
113 | 114 | | |
114 | 115 | | |
115 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
116 | 135 | | |
117 | 136 | | |
118 | 137 | | |
| |||
160 | 179 | | |
161 | 180 | | |
162 | 181 | | |
163 | | - | |
| 182 | + | |
164 | 183 | | |
165 | 184 | | |
166 | 185 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
388 | 388 | | |
389 | 389 | | |
390 | 390 | | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
397 | 399 | | |
398 | 400 | | |
399 | 401 | | |
| |||
653 | 655 | | |
654 | 656 | | |
655 | 657 | | |
| 658 | + | |
656 | 659 | | |
657 | 660 | | |
658 | 661 | | |
| |||
686 | 689 | | |
687 | 690 | | |
688 | 691 | | |
689 | | - | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
690 | 703 | | |
691 | 704 | | |
692 | 705 | | |
| |||
700 | 713 | | |
701 | 714 | | |
702 | 715 | | |
| 716 | + | |
| 717 | + | |
703 | 718 | | |
704 | | - | |
705 | | - | |
706 | | - | |
707 | | - | |
708 | | - | |
709 | | - | |
710 | | - | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
711 | 727 | | |
0 commit comments