Skip to content

twinspindlekins: a mill-turn whose two spindles are two primary types - #4942

Merged
BsAtHome merged 3 commits into
LinuxCNC:masterfrom
grandixximo:twinspindle
Dec 2, 2026
Merged

BsAtHome merged 3 commits into
LinuxCNC:masterfrom
grandixximo:twinspindle

Conversation

@grandixximo

Copy link
Copy Markdown
Contributor

Split out of #4889 as Bertho asked; it needs the orienting axes that went in there.

twinspindlekins is a mill-turn: a head on X Y Z tilts the tool on B between a main spindle turning its part on C and a sub spindle facing it along Z, turning its part on W. Type 0 works in the main spindle's part frame and orients with C and B, type 1 in the sub spindle's part frame and orients with W and B. Both are primary, so G12.1 picks the spindle and the same program runs on either part. Type 2 is the identity and the machine frame.

The vismach sim configs/sim/axis/vismach/twinspindle drills a ring of tilted holes into the part in each spindle through one subroutine that names no rotary: G53.3 turns whichever pair the type in force orients with. The INI sets MACHINE_MOVES_IN_MACHINE_FRAME, as the five axis sims do.

Tests:

  • tests/kins-params checks both working types against realtime.
  • tests/twinspindle (new, for the new module) checks the orienting axes of each type, that the same tilted hole solves and is reached on either spindle with the tip on the hole and the tool along its axis, and that the demo program runs.

Comment thread tests/kins-params/test.sh Resolved
Comment thread tests/twinspindle/test-ui.py Resolved
A head on X Y Z tilts the tool on B between a main spindle turning its
part on C and a sub spindle facing it along Z and turning its own part on
W, an ANGULAR axis.  Type 0 works in the frame of the main spindle's part
and orients the tool with C and B, type 1 in the frame of the sub
spindle's part, the main one turned half a turn about X so its Z too
points at the tool, and orients it with W and B; both are primary, so
G12.1 picks the spindle and a program reads the same on either part.
Type 2 is the identity and the machine frame.

Written as pure functions of the parameter block, with work and tool
frames and the orienting letters declared, so the interpreter solves the
tilted work plane on either spindle.  The joints read the gauge line with
B at 0 and the tool length goes along the tool, as on 5axiskins.

tests/kins-params checks both working types against realtime.
@BsAtHome

BsAtHome commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

If you didn'tre base yet,... Is that *** ./tests/interp/g28.2/invalid-pword: FAIL: test run exited with 1 in the package-arch-32bit i386 fixed with #4947?

@grandixximo

Copy link
Copy Markdown
Contributor Author

If you didn'tre base yet,... Is that *** ./tests/interp/g28.2/invalid-pword: FAIL: test run exited with 1 in the package-arch-32bit i386 fixed with #4947?

Looking into it, it's related, but different fix, I think I have to touch task, relying on delays is not robust, and removing the delay broke all hell loose, but I still think #4833 is the right thing to do.

@BsAtHome

BsAtHome commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

relying on delays is not robust, and removing the delay broke all hell loose, but I still think #4833 is the right thing to do.

So do I . Delays are always a bad choice for synchronization as they usually hide the races. It is just a lot of work to fix the fallout ;-)

A vismach sim of twinspindlekins, the spindle line across the screen,
with a demo program that drills a ring of tilted holes into the part in
the main spindle and then into the part in the sub spindle through one
subroutine.  It names no rotary: G53.3 turns the ones the type in force
orients with, and the report reads them as #<_kins_orient_1> and
#<_kins_orient_2>, C and B on one spindle, W and B on the other, with
their angles as #<_orient_rot1> and #<_orient_rot2>.

tests/twinspindle checks the orienting axes of each type, that the same
tilted hole solves and is reached on either spindle, the tip on the hole
and the tool along its axis, and that the demo program runs.
Like the five axis sims: the INI sets MACHINE_MOVES_IN_MACHINE_FRAME with a comment, and the README says so, so G53 puts the slides in the same place on either spindle's type whatever the tool and the head angle. The demo program and tests/twinspindle (its own test.ini) use no G53, G28 or G30 off the machine frame type.
grandixximo added a commit that referenced this pull request Dec 2, 2026
When an MDI arrives while task is still busy, for instance with the
cleanup after an abort, task puts it in its MDI queue and runs it later.
The status that echoes the command still showed the interpreter idle,
so a client that sends an MDI and then waits for idle returned at once
and read the machine before the command had run.
tests/interp/g28.2/invalid-pword did exactly that and failed on the i386
CI job of #4942: "coordinated motion did not survive the rejected Pn (X
stayed at 0.9999999999999999)", X still at 1 from the G0 X1 before.

Task now sets the interpreter state to reading when it queues an MDI, as
it does when it runs one straight away. It goes back to idle once the
queued command has run, as before.

The test no longer sleeps after its mode switches: task applies a mode in
the cycle that echoes it, so the next command already sees it.

Tested in a sandbox under load, runtests -j 8 with 8 CPU hogs: the test
as it is on master failed 6 times in 220 runs, and passed 220 of 220 with
this change; the test from this commit passed 240 of 240. The full
runtests suite passes.
@BsAtHome
BsAtHome merged commit 0b77a16 into LinuxCNC:master Dec 2, 2026
19 checks passed
@grandixximo

Copy link
Copy Markdown
Contributor Author

Thanks, the CI should also be more stable after the other recent merges/fixes, finger crossed 🤞

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.

2 participants