Skip to content

motion: the S-curve single axis planner stops at the end of a move - #4844

Merged
grandixximo merged 1 commit into
LinuxCNC:masterfrom
grandixximo:scurve-jog-settle
Nov 14, 2026
Merged

grandixximo merged 1 commit into
LinuxCNC:masterfrom
grandixximo:scurve-jog-settle

Conversation

@grandixximo

Copy link
Copy Markdown
Contributor

On the S-curve planner (PLANNER_TYPE = 1 with a jerk limit), a move of the single axis planner hunted around its target for about two seconds after arriving, and came to rest up to 0.8 um off it. That planner runs world and joint jogs, free mode joint moves (homing included) and external offsets. Motion reported the jog done while this went on.

Example: an incremental jog of X by 5 at 100 mm/s, 800 mm/s^2 and jerk 10000 arrives after 252 servo cycles. On master it then went back and forth until cycle 2047, up to 7.7 um off the target, and stopped 0.8 um off. With this change it stops on the cycle it arrives, 3 nm off.

The cause: once within its dead band of the target, simple_scurve_tp_update() set the speed to zero but still took one more step with the previous cycle's speed and acceleration. That step put it a few microns back outside the band, the trapezoid ramp it falls back on brought it in again, and so on, each round a little smaller. Now it stops at the target without that step.

I found it because tests/twp-jog-frame on the multiaxis branch (#4374) waits for the position to stop changing after each jog, and its S-curve run spent about 30 of its 44 seconds waiting out the hunting.

tests/jog-speed-change now also makes an incremental jog of joint 0 in free mode and of X in teleop mode, on both planners. It checks that each ends where it was sent and that no servo cycle runs the other way. On master the S-curve run has joint 0 running backwards in 130 servo cycles and X in 445; here none. The joint's velocity is checked in free mode only, because in teleop it comes from the cubic interpolator rather than the planner. The test passes with six copies beside four busy loops and pinned to one CPU.

On the S-curve planner, a move of the single axis planner, which runs jogs, free mode joint moves, homing included, and external offsets, that reached its target went back and forth over it for about two seconds and stopped up to 0.8 um off. Once within its dead band of the target, simple_scurve_tp_update() set the speed to zero but still took one more step with the speed and acceleration of the cycle before; that step put it some microns back outside, the trapezoid ramp it falls back on there brought it in again, and so on, each round a little smaller. Motion reported the jog done while this went on. An incremental jog of X by 5 at 100 mm/s, 800 mm/s^2 and a jerk of 10000 arrives after 252 servo cycles, then hunted until cycle 2047, up to 7.7 um off the target, and came to rest 0.8 um off it; now it stops on the cycle it arrives, 3 nm off.

At the target the planner now stops without that step.

tests/jog-speed-change adds an incremental jog of joint 0 in free mode and of X in teleop mode, on both planners, and checks that each ends where it was sent and that no servo cycle runs the other way. On master the S-curve run has joint 0 run backwards in 130 servo cycles and X in 445; here none. The joint's velocity is checked in free mode only, since in teleop it comes from the cubic interpolator rather than the planner.
@grandixximo
grandixximo merged commit 401f78f into LinuxCNC:master Nov 14, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant