motion: per-axis homed check for teleop jog soft limits - #4631
Open
grandixximo wants to merge 1 commit into
Open
grandixximo wants to merge 1 commit into
grandixximo wants to merge 1 commit into
Conversation
This was referenced Oct 4, 2026
Axis (teleop) jogs were clamped to the INI soft limits even when the machine was not homed, so an unhomed machine at position 0 could only jog as far as the limits allowed from 0. Joint jogs have used the current position plus/minus one limit range in this case since 2006 (refresh_jog_limits). Identity kinematics allow entering teleop mode unhomed, so the axis jog path needs the same treatment. Axes are not homed, joints are. Treat an axis as homed when every joint mapped to its coordinate letter is homed, using the joint bitmaps kins_util already builds from the coordinates parameter, now exported as identityKinematicsAxisJointsBitmap(). A gantry letter with two joints needs both homed before its INI limits apply. Non-identity kins can only be in teleop mode when all joints are homed, so nothing changes there. A homed axis jogs within its INI soft limits as before. An unhomed axis jogs within one limit range of its current position, and the servo-cycle INI limit check in update_teleop_with_check() is skipped for it, since the position is not known. Out-of-tree identity kins modules built on an old kins_util copy do not export the new accessor and need a rebuild against these headers. Fixes LinuxCNC#182
grandixximo
force-pushed
the
axis-jog-unhomed-182
branch
from
October 4, 2026 13:14
bb6751a to
777aacf
Compare
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.
Fixes #182 (and its duplicate #224).
Problem
An unhomed machine jogging in teleop mode is clamped to the INI soft limits as if its position were 0: at X0 with MIN_LIMIT=-10 the jog stops at -10 although the true position is unknown. Joint jogs got this right in 2006 (refresh_jog_limits): unhomed jogs one limit range from the current position, homed uses the INI limits.
Only identity kinematics can enter teleop unhomed, and the usual routes never exercise it: AXIS and gmoccapy stay in joint mode until homed, so their unhomed jogs are joint jogs and already behave. What is affected is an axis jog source wired straight to motion: a panel on the halui axis pins with NO_FORCE_HOMING=1, jogging near the home switches before homing, or a script that teleop_enable(1) first. That panel setup is less rare than one might imagine.
Fix
Axes are not homed, joints are, so the check is per axis: an axis is homed when every joint mapped to its coordinate letter is homed. A gantry letter needs all its joints homed before its INI limits apply; homing Z alone gives Z its limits while X and Y still jog one limit range from wherever they stand.
The letter-to-joints map is the one identity kinematics already build from the coordinates parameter (kins_util.c), exported as identityKinematicsAxisJointsBitmap() instead of re-derived in motion. Modules without a map report 0 and fall back to all-homed, which teleop guarantees for them, so non-identity kinematics are unaffected. Homed axes behave exactly as before; for an unhomed axis the servo-cycle INI check in update_teleop_with_check() is skipped, since its position is not known.
Tested
sim/axis, X limits ±10, Z limits -8..0.12, jogged via halui axis pins with NO_FORCE_HOMING=1 and via scripted teleop jogs (same motion path):
plus the tests/motion suite (5/5).
Compatibility
The accessor is a weak symbol in motion: kinematics modules that do not link kins_util.c (matrixkins, out-of-tree modules built on older headers) load and run exactly as before, answered by the all-homed fallback. No rebuilds required.
Note for the post-NML work
"Which joints are which axis letter" is re-derived all over the tree: gmoccapy re-parses [KINS]KINEMATICS in Python, AXIS applies lathe/trivkins heuristics, qtvcp reads [TRAJ]COORDINATES, and each guesses wrong on gantries or reordered coordinates in its own way. The map exported here is the natural single source. Whatever replaces NML should carry the joint-to-axis map to task and the UIs, built from this same kins-side data, so the GUI-side re-implementations can be deleted. This fix does not depend on that; motion runs in RT and needs the map where the kinematics module already has it.