Repository navigation
kinematics: each type names the axes it orients the tool with - #4889
Open
grandixximo wants to merge 7 commits into
Open
grandixximo wants to merge 7 commits into
grandixximo wants to merge 7 commits into
Conversation
Contributor
|
Would it make sense to split this PR in two? The first takes care of infrastructural work. The second adds the twinspindle stuff. |
The code LinuxCNC#4730 added to the interpreter and canon still took A B C for angles and X Y Z U V W for lengths: the machine pose and back (interp_workplane.cc), the tool offset handed to the kinematics, the point G43.4 and G49 re-anchor on, the words of G53.5, G53.7, G28.5 and G30.5, and the check that a letter on the identity kinematics names a joint of its own kind. They go by type now, as the rest does since "Honor [AXIS_<letter>] TYPE in the interpreter and canon". Canon's segment sampling counts the turn of every angular axis, not of A B C. tests/axis-type runs G53.5 and G28.5 under G20 on its ANGULAR V, which the interpreter now evaluates through trivkins with coordinates= given in the INI.
G43.5 wrote the pose it solved into A B C and refused A B C words beside I J K, whatever axes the machine orients with. A kinematics type now names them: kins_ops.orient gives the two letters, first rotation then second, and left NULL they are the letters the joint map gives the two joints that turn the frames, which is right for every module in the tree. kinematicsUserOrientAxes() answers for the active type, with head or table for each, from the frames: two heads or two tables in the order toolFrameOrientJoints() gives, a table and a head the table first. G43.5 writes the solution into those two letters and refuses a word of either beside I J K, and G53.3 and G53.6 turn those two letters where they turned A B C and left U V W behind; a type that orients otherwise, a robot's three pose angles, keeps A B C. The interpreter exposes them as #<_kins_orient_1>, #<_kins_orient_2> (axis numbers, 0 X to 8 W, -1 for none) and #<_kins_orient_1_head>, #<_kins_orient_2_head>, and refuses a module whose type orients with an axis [AXIS_<letter>] TYPE makes LINEAR when it first loads it.
A machine with two tool heads, a saw blade and a waterjet say, has a working transform per head and selects the head with G12.1. The loader now accepts any number of types flagged primary; identity and machine frame stay unique, since G13.1 and G49 resolve a single answer from them. G43.4 and G43.5 stay on the type in force when it is primary, and from any other type switch to the lowest numbered primary, which is the single primary on every module that declares one. tests/ptp-machine-frame gains a second head on slantkins (type 3, the tip again, primary) and checks both rules.
#<_orient_a> #<_orient_b> #<_orient_c> become #<_orient_rot1> to #<_orient_rot3>: the angles of the axes #<_kins_orient_1> to #<_kins_orient_3> name, in that order, so a program reads them the same way whatever letters the machine gives its rotaries, as Fanuc and Siemens number the rotaries first and second. #5071-#5076 carry X Y Z and the three rotaries, #5077-#5079 are written 0. kinematicsUserOrientAxes() answers up to three axes. A type with three rotaries between tool and work, xyzacb_trsrn's A table and B C head, gives all three, tables first, each group in joint order, or the three letters its orient declares; a robot arm, whose joints all turn the tool, gives the A B C of its pose. #<_kins_orient_3> and #<_kins_orient_3_head> are new; a two rotary type reads -1 there, as before. G43.5 and the LINEAR check cover the third axis.
compute_jfwd() converts every link to a quaternion pose twice and builds the Jacobian through generic matrix calls: 0.9 us of the 1.2 us that genser_jacobian() takes. Canon's segment cap takes one at every sample of a move, and genser_inverse() one per iteration. genser_jfwd_frames() chains the DH frames as rotations and origins and takes each column as z_i x (o_n - o_i), z_i. It gives what compute_jfwd() gives to within 3e-10 relative over 20000 random poses, in 0.12 us. genser_jacobian() and genser_inverse() use it; genser_kin_jac_inv() and genser_kin_jac_fwd() keep compute_jfwd(). With the puma560 genser config, adding a move near the wrist singular pose falls from 153 to 71 us on average and from 207 to 93 us at most; other moves fall from 36 to 22 us.
The abort reset the planner onto its own position, which inside a joint interpolated segment is the chord between the world ends, and forgot the joints; the servo thread then inverted the chord point and the joints jumped there in one cycle (on 5axiskins, pivot 400, Y at 166670 mm/s). The joints the segment stopped on are now handed out as its end, and the planner takes the point the servo thread found from them, so the machine stays where it stopped. tests/ptp-machine-frame aborts a G53.4 G1 under the tip with B turning at 40 percent of the move and checks the joints are on their line, where the chord point's inverse puts X 3 mm off.
The slider left joint interpolated segments alone, since they run in joint units. It now caps the tool's chord between the ends, measured as canon measures a straight move (X Y Z, else U V W, not at all for the rotaries alone): the segment takes at least as long as the chord would at the slider's speed. With the slider at 10 mm/s a G53.4 over a 100 mm chord takes 10.07 s instead of 1.04 s. tests/ptp-machine-frame runs a G53.4 over 100 mm with the slider at 100 mm/s: 1.0 s, where it took 0.07 s.
grandixximo
force-pushed
the
orient-axes-pr
branch
from
November 23, 2026 13:56
d51a793 to
bd20b68
Compare
Contributor
Author
|
Done: this PR now holds the infrastructure, and twinspindlekins with its sim follows in its own PR once this is in. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Item 10 of the multiaxis plan in #4374, with the joint interpolated segment fixes found on the way. The orientation codes wrote their answer into A B C whatever axes turn the tool, so a head tilting on V or a spindle turning on W could not use them:
kins_ops.orientor from the joint map.G43.5,G53.3andG53.6drive those axes, and a module whose type orients with an axis[AXIS_<letter>] TYPEmakesLINEARis refused at load. The interpreter exposes them as#<_kins_orient_1>to#<_kins_orient_3>, with#<_kins_orient_1_head>to#<_kins_orient_3_head>saying whether each turns the head or the table.G53.2publishes the rotaries in that order, as Fanuc and Siemens number them first and second:#<_orient_rot1>to#<_orient_rot3>. They replace#<_orient_a>to#<_orient_c>, which came with interp, motion: the point-to-point moves and the tool orientation codes, G53.1 to G53.7 and G68.3 #4730 and have not been in a release.G43.4andG43.5stay on the type in force when it is primary, and otherwise take the lowest numbered primary.TYPE, not by letter:G53.5,G53.7,G28.5,G30.5, the tool offset handed to the kinematics and the pointG43.4andG49re-anchor on.G53.4and the like): an abort part way leaves the joints where they stopped, where it jumped them to the inverse of the straight chord, and the max velocity slider caps them by the chord as it does a straight move.genserkinsbuilds its Jacobian from the DH frames, the same values within 3e-10 in a tenth of the time.Tests:
tests/kins-orient-linear: theLINEARorientation axis refused at load.tests/kins-switchandtests/twp-native: the orientation axes of each type andG53.2's order.tests/ptp-machine-frame: the second primary head on slantkins; an abort at 40 percent of aG53.4under the tip with B turning, the joints on their line (3 mm off without the fix); aG53.4over 100 mm under the slider at 100 mm/s, 1.0 s instead of 0.07 s.tests/axis-type:G53.5andG28.5underG20read itsANGULARV as an angle.The abort, slider and V cases fail with their fix undone. ptp-machine-frame passes with 6 copies in parallel alongside 4 busy loops, and on one CPU.
twinspindlekins, a mill-turn with a spindle on C and one on W, each a primary type, follows in its own PR once this is in.