Skip to content

motion: a non-finite inverse in coordinated mode no longer hangs the servo thread - #4685

Open
grandixximo wants to merge 1 commit into
LinuxCNC:masterfrom
grandixximo:kins-nonfinite-freeze
Open

grandixximo wants to merge 1 commit into
LinuxCNC:masterfrom
grandixximo:kins-nonfinite-freeze

Conversation

@grandixximo

Copy link
Copy Markdown
Contributor

When the inverse kinematics returns a non-finite joint location in coordinated mode, the isfinite() check in control.c only breaks out of the joint loop. Joint 0 is left without its interpolation point, so the enclosing while (cubicNeedNextPoint(...)) loop runs the planner and the inverse again, forever, inside the servo thread.

Sigma1912 hit this with a mill-turn kinematics module whose inverse divided by zero after a kinematics switch (G12.1 P1). I ran the config headless: the servo thread stalled and printed "kinematicsInverse gave non-finite joint location on joint 0" 5.4 million times in under a minute. On a real-time kernel the PC freezes.

The fix leaves the loop the way the existing "kinematicsInverse failed" branch already does. With it, the same config reports the error once, the machine disables and the servo thread keeps running.

The teleop path has the same early break, but it has no enclosing loop, so it cannot hang.

…servo thread

When the inverse kinematics gave a non-finite joint location in
coordinated mode, the check broke out of the joint loop only. Joint 0
was left without its interpolation point, so the enclosing
cubicNeedNextPoint() loop ran the planner and the inverse again,
forever, inside the servo thread: millions of identical errors and, on
a real-time kernel, a frozen PC. Leave the loop the way a failed
inverse already does, so the error is reported once and the machine
disables.

Reported by Sigma1912 with a mill-turn kinematics module whose inverse
divided by zero.
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