Skip to content

genhexkins: no default joint axes - #4931

Open
Ash-Pera wants to merge 1 commit into
LinuxCNC:masterfrom
Ash-Pera:genhex-default-axes
Open

Ash-Pera wants to merge 1 commit into
LinuxCNC:masterfrom
Ash-Pera:genhex-default-axes

Conversation

@Ash-Pera

@Ash-Pera Ash-Pera commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

From #4902: the screw correction keeps its fold past a quarter turn of twist, and kins(9) says so. The joint axes lose their defaults.

The default axes put four of the six struts past a quarter turn at home (55.4°, 90.7°, -101.7°, 128.2°, -27.1° and 131.6°), and don't fit the default struts: strut 0's base axis lies close to the strut. The axes are the machine's joints, which genhexkins can't know, so they now default to 0. A strut with an axis at 0 already gets no correction; with a screw lead set, genhexkins says so once. No configuration in the tree sets a lead. The upgrade notes give the old values.

The lead tests now set the old axes, keeping the fold covered: hexfwdcheck-screw.hal and the lead cases of kins-jacobian and kins-params. The forward check gains a run with a lead and no axes: every correction is 0, and the message comes once.

Each check fails when what it covers is broken: the no-axes run with no message or one on every call, the forward check without its step limit, and the kins-jacobian lead case with the fold's sign dropped from the correction's rates. genhexkins-forward, kins-jacobian, kins-params and kins-switch-unsolved pass.

🤖 Generated with Claude Code

@BsAtHome

Copy link
Copy Markdown
Contributor

I do recognize the numbers 0.707107 and 0.866025 as (a bit aggressively) truncated forms of sqrt(2)/2 and sqrt(3)/2 and can relate those to common triangle and trigonometric configurations as they appear there quite often.
However, the new numbers are real magic numbers. They require an explanation of how you get to them with the angles (and calculation) specified. Also, a note in the code above the numbers as to why you want them to be like this would help the reader to understand what is going on.

The default joint axes put four struts' twist past a quarter turn at
home, where the screw correction folds back, and they don't fit the
default struts: strut 0's base axis lies close to the strut.  No default
can be right, since the axes are the machine's joints, so default them to
0.  A strut with an axis at 0 already gets no correction; with a screw
lead set, say so once.  No configuration in the tree sets a lead.

Say in kins(9) that the correction holds while each strut's twist stays
within a quarter turn, and give the old defaults in the upgrade notes.

The lead tests set the old axes, so the fold stays covered, and the
forward check gains a run with a lead and no axes.

Closes LinuxCNC#4902
@Ash-Pera
Ash-Pera force-pushed the genhex-default-axes branch from 2a37fd0 to 7cb608e Compare November 30, 2026 19:04
@Ash-Pera Ash-Pera changed the title genhexkins: default joint axes level and across each strut genhexkins: no default joint axes Nov 30, 2026
@Ash-Pera

Copy link
Copy Markdown
Contributor Author

Fair point, and I couldn't make them not magic: a unit vector needs sqrt(), which clang won't take in a static initializer. Besides, no default can be right, since the axes are the machine's joints. So I've dropped them: the axes default to 0, a strut with an axis at 0 gets no correction (as before), and with a screw lead set genhexkins says so once. The old values are in the upgrade notes.

That goes further than the defaults suggested in #4902; the description explains why.

@BsAtHome

Copy link
Copy Markdown
Contributor

Yes, I know you can't put sqrt in the initializer. But that is not important here.
So, now you effectively dropped all the initializers in the code and set them to zero. Is there any reason to keep them as defines then? Or will you be changing them again? If not, then the initialization procedure(s) needs to be changed and simply set it all to zero. Or is there an argument for keeping this as convoluted with the defines when they are all zero anyway?

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