Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
708f86b
switchkins: reject a bad kinematics type before switching to it
grandixximo Aug 11, 2026
a39d478
switchkins: allow more than three kinematics types
grandixximo Aug 11, 2026
8db6fbf
switchkins: let switchkinsRegister() provide any kinematics type
grandixximo Aug 11, 2026
68b1def
switchkins: separate the dispatch from rtapi_app_main()
grandixximo Aug 11, 2026
28da923
switchkins: let halcompile components use the switchkins core
grandixximo Aug 11, 2026
0b1aa2e
switchkins: add an out-of-tree module template
grandixximo Aug 12, 2026
fc26b1d
G12.1, G13.1: select kinematics from G-code
grandixximo Aug 11, 2026
420acb8
G12.1, G13.1: take the kinematics from motion on every synch
grandixximo Aug 11, 2026
7a59516
motion: record the kinematics type only once the switch succeeds
grandixximo Aug 12, 2026
722dbba
motion: deprecate selecting the kinematics type from HAL
grandixximo Aug 12, 2026
ef34ff0
motion: name the kinematics selection for what it is
grandixximo Aug 12, 2026
e129cd8
configs: select kinematics with G12.1 in the switchkins comp sims
grandixximo Aug 12, 2026
34ab07b
configs: select kinematics with G12.1 in the remaining switchkins sims
grandixximo Aug 12, 2026
63cac2d
docs: stop offering the deprecated pin as an equal way to switch
grandixximo Aug 12, 2026
4dfd182
kins: drop the kinematics.h include switchkins.h already provides
grandixximo Aug 12, 2026
73740ad
kins: include switchkins.h as an exported header
grandixximo Aug 12, 2026
49efbc2
docs: lead with the deprecation notice for the switchkins pin
grandixximo Aug 12, 2026
4a874e3
switchkins: install the implementation as source for out-of-tree modules
grandixximo Aug 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ share/desktop-directories/linuxcnc-cnc.directory
share/desktop-directories/linuxcnc-ref.directory
share/desktop-directories/linuxcnc-doc.directory
share/linuxcnc/mesa_modbus.c.tmpl
share/linuxcnc/switchkins.c
share/linuxcnc/kins_util.c
src/modules.order
/configs/*/emc.nml
!/configs/common/emc.nml
Expand Down
1 change: 0 additions & 1 deletion configs/sim/axis/vismach/5axis/bridgemill/5axis.ini
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ CYCLE_TIME = 0.010
HALUI = halui
HALFILE = LIB:basic_sim.tcl
HALFILE = 5axisgui.hal
HALCMD = net :kinstype-select <= motion.analog-out-03 => motion.switchkins-type
POSTGUI_HALFILE = 5axis_postgui.hal

[HALUI]
Expand Down
17 changes: 3 additions & 14 deletions configs/sim/axis/vismach/5axis/bridgemill/remap_subs/428remap.ngc
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
;M428 by remap: select kinstype=0 genhexkins
o<428remap>sub
#<kinstype> = 0
#<SWITCHKINS_PIN> = 3 ; set N as required: motion.analog-out-0N

o1 if [exists [#<_hal[motion.switchkins-type]>]]
o1 else
(debug,M428:Missing [RS274NGC]HAL_PIN_VARS=1)
(debug,STOP)
M2
o1 endif

M68 E#<SWITCHKINS_PIN> Q#<kinstype> ; set kinstype value
M66 E0 L0 ; force synch
G13.1 ; back to kinstype 0, syncs interp and motion

o2 if [[#<_task> EQ 1] AND [#<_hal[motion.switchkins-type]> NE #<kinstype>]]
(debug,M428: Wrong motion.switchkins-type)
(debug,or missing hal net to analog-out-0x)
o2 if [[#<_task> EQ 1] AND [#<_kins_type> NE #<kinstype>]]
(debug,M428: Wrong kinematics type)
(debug,STOP)
M2
o2 else
o2 endif

o<428remap>endsub
17 changes: 3 additions & 14 deletions configs/sim/axis/vismach/5axis/bridgemill/remap_subs/429remap.ngc
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
;M429 by remap: select kinstype==1 Identity kinematics
o<429remap>sub
#<kinstype> = 1
#<SWITCHKINS_PIN> = 3 ; set N as required: motion.analog-out-0N

o1 if [exists [#<_hal[motion.switchkins-type]>]]
o1 else
(debug,M429:Missing [RS274NGC]HAL_PIN_VARS=1)
(debug,STOP)
M2
o1 endif

M68 E#<SWITCHKINS_PIN> Q#<kinstype> ; set kinstype value
M66 E0 L0 ; force synch
G12.1 P#<kinstype> ; select kinstype, syncs interp and motion

o2 if [[#<_task> EQ 1] AND [#<_hal[motion.switchkins-type]> NE #<kinstype>]]
(debug,M429:Wrong motion.switchkins-type)
(debug,or missing hal net to analog-out-0x)
o2 if [[#<_task> EQ 1] AND [#<_kins_type> NE #<kinstype>]]
(debug,M429:Wrong kinematics type)
(debug,STOP)
M2
o2 else
o2 endif

o<429remap>endsub
17 changes: 3 additions & 14 deletions configs/sim/axis/vismach/5axis/bridgemill/remap_subs/430remap.ngc
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
;M430 by remap: select kinstype==2 userk kins
o<430remap>sub
#<kinstype> = 2
#<SWITCHKINS_PIN> = 3 ; set N as required: motion.analog-out-0N

o1 if [exists [#<_hal[motion.switchkins-type]>]]
o1 else
(debug,M30:Missing [RS274NGC]HAL_PIN_VARS=1)
(debug,STOP)
M2
o1 endif

M68 E#<SWITCHKINS_PIN> Q#<kinstype> ; set kinstype value
M66 E0 L0 ; force synch
G12.1 P#<kinstype> ; select kinstype, syncs interp and motion

o2 if [[#<_task> EQ 1] AND [#<_hal[motion.switchkins-type]> NE #<kinstype>]]
(debug,M430:Wrong motion.switchkins-type)
(debug,or missing hal net to analog-out-0x)
o2 if [[#<_task> EQ 1] AND [#<_kins_type> NE #<kinstype>]]
(debug,M430:Wrong kinematics type)
(debug,STOP)
M2
o2 else
o2 endif

o<430remap>endsub
3 changes: 0 additions & 3 deletions configs/sim/axis/vismach/5axis/table-dual-rotary/README
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ For proper tool-path preview RELOAD THE CGODE after startup and after changing o
***********************************************
Note: IMPORTANT ini file requirements:

[HAL]
HALCMD = net :kinstype-select <= motion.analog-out-0N => motion.switchkins-type

[RS274NGC]
SUBROUTINE_PATH = ./remap_subs
REMAP = M428 modalgroup=10 ngc=428remap
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
;M428 by remap: kinstype==1 (xyzac,xyzbc) (note: sparm=identityfirst)
;M428 by remap: kinstype==1 (xyzab-tdr kinematics)
o<428remap>sub
#<kinstype> = 1 ; xyzac,xyzbc
#<SWITCHKINS_PIN> = 3 ; set N as required: motion.analog-out-0N
#<kinstype> = 1 ; xyzab-tdr

o1 if [exists [#<_hal[motion.switchkins-type]>]]
o1 else
(debug,M428:Missing [RS274NGC]HAL_PIN_VARS=1)
(debug,STOP)
M2
o1 endif

M68 E#<SWITCHKINS_PIN> Q#<kinstype> ; set kinstype value
M66 E0 L0 ; force synch
G12.1 P#<kinstype> ; select kinstype, syncs interp and motion

o2 if [[#<_task> EQ 1] AND [#<_hal[motion.switchkins-type]> NE #<kinstype>]]
(debug,M428: Wrong motion.switchkins-type)
(debug,or missing hal net to analog-out-0x)
o2 if [[#<_task> EQ 1] AND [#<_kins_type> NE #<kinstype>]]
(debug,M428: Wrong kinematics type)
(debug,STOP)
M2
o2 else
o2 endif

o<428remap>endsub
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
;M429 by remap: kinstype==0 Identity kinematics
o<429remap>sub
#<kinstype> = 0
#<SWITCHKINS_PIN> = 3 ; set N as required: motion.analog-out-0N

o1 if [exists [#<_hal[motion.switchkins-type]>]]
o1 else
(debug,M429:Missing [RS274NGC]HAL_PIN_VARS=1)
(debug,STOP)
M2
o1 endif

M68 E#<SWITCHKINS_PIN> Q#<kinstype> ; set kinstype value
M66 E0 L0 ; force synch
G13.1 ; back to kinstype 0, syncs interp and motion

o2 if [[#<_task> EQ 1] AND [#<_hal[motion.switchkins-type]> NE #<kinstype>]]
(debug,M429:Wrong motion.switchkins-type)
(debug,or missing hal net to analog-out-0x)
o2 if [[#<_task> EQ 1] AND [#<_kins_type> NE #<kinstype>]]
(debug,M429: Wrong kinematics type)
(debug,STOP)
M2
o2 else
o2 endif

o<429remap>endsub
10 changes: 4 additions & 6 deletions configs/sim/axis/vismach/5axis/table-dual-rotary/xyzab-tdr.ini
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ SUBROUTINE_PATH = ./remap_subs

[KINS]
#NOTE:
# switchkins-type == 0 is identity kins
# switchkins-type == 1 is xyzab-tdr-kins
# kinstype 0 is identity kins
# kinstype 1 is xyzab-tdr-kins

KINEMATICS = xyzab_tdr_kins
JOINTS = 5
Expand All @@ -36,8 +36,6 @@ KINEMATICS = xyzab_tdr_kins
HALFILE = LIB:basic_sim.tcl
POSTGUI_HALFILE = xyzab-tdr-postgui.hal

# net for control of motion.switchkins-type
HALCMD = net :kinstype-select <= motion.analog-out-03 => motion.switchkins-type

# Values '(x,z)-offsets' for geometric offset of the rotary-assembly and the
# values '(x,y,z)-rot-point' that describe the position of the
Expand Down Expand Up @@ -76,8 +74,8 @@ HALCMD = sets :x-offset -20
HALCMD = sets :z-offset -10

[HALUI]
# M429:identity kins (motion.switchkins-type==0 startupDEFAULT)
# M428:xyzab-tdr kins (motion.switchkins-type==1)
# M429:identity kins (kinstype 0, startupDEFAULT)
# M428:xyzab-tdr kins (kinstype 1)
MDI_COMMAND = M429
MDI_COMMAND = M428

Expand Down
3 changes: 0 additions & 3 deletions configs/sim/axis/vismach/5axis/table-rotary-tilting/README
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ Demonstrations:
***********************************************
Note: IMPORTANT ini file requirements:

[HAL]
HALCMD = net :kinstype-select <= motion.analog-out-0N => motion.switchkins-type

[RS274NGC]
SUBROUTINE_PATH = ./remap_subs
REMAP = M428 modalgroup=10 ngc=428remap
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
;M428 by remap: kinstype==1 (xyzac,xyzbc) (note: sparm=identityfirst)
o<428remap>sub
#<kinstype> = 1 ; xyzac,xyzbc
#<SWITCHKINS_PIN> = 3 ; set N as required: motion.analog-out-0N

o1 if [exists [#<_hal[motion.switchkins-type]>]]
o1 else
(debug,M428:Missing [RS274NGC]HAL_PIN_VARS=1)
(debug,STOP)
M2
o1 endif

M68 E#<SWITCHKINS_PIN> Q#<kinstype> ; set kinstype value
M66 E0 L0 ; force synch
G12.1 P#<kinstype> ; select kinstype, syncs interp and motion

o2 if [[#<_task> EQ 1] AND [#<_hal[motion.switchkins-type]> NE #<kinstype>]]
(debug,M428: Wrong motion.switchkins-type)
(debug,or missing hal net to analog-out-0x)
o2 if [[#<_task> EQ 1] AND [#<_kins_type> NE #<kinstype>]]
(debug,M428: Wrong kinematics type)
(debug,STOP)
M2
o2 else
o2 endif

o<428remap>endsub
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
;M429 by remap: kinstype==0 Identity kinematics
o<429remap>sub
#<kinstype> = 0
#<SWITCHKINS_PIN> = 3 ; set N as required: motion.analog-out-0N

o1 if [exists [#<_hal[motion.switchkins-type]>]]
o1 else
(debug,M429:Missing [RS274NGC]HAL_PIN_VARS=1)
(debug,STOP)
M2
o1 endif

M68 E#<SWITCHKINS_PIN> Q#<kinstype> ; set kinstype value
M66 E0 L0 ; force synch
G13.1 ; back to kinstype 0, syncs interp and motion

o2 if [[#<_task> EQ 1] AND [#<_hal[motion.switchkins-type]> NE #<kinstype>]]
(debug,M429:Wrong motion.switchkins-type)
(debug,or missing hal net to analog-out-0x)
o2 if [[#<_task> EQ 1] AND [#<_kins_type> NE #<kinstype>]]
(debug,M429:Wrong kinematics type)
(debug,STOP)
M2
o2 else
o2 endif

o<429remap>endsub
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
;M430 by remap: kinstype==2 userk kins
o<430remap>sub
#<kinstype> = 2
#<SWITCHKINS_PIN> = 3 ; set N as required: motion.analog-out-0N

o1 if [exists [#<_hal[motion.switchkins-type]>]]
o1 else
(debug,M430:Missing [RS274NGC]HAL_PIN_VARS=1)
(debug,STOP)
M2
o1 endif

M68 E#<SWITCHKINS_PIN> Q#<kinstype> ; set kinstype value
M66 E0 L0 ; force synch
G12.1 P#<kinstype> ; select kinstype, syncs interp and motion

o2 if [[#<_task> EQ 1] AND [#<_hal[motion.switchkins-type]> NE #<kinstype>]]
(debug,M430:Wrong motion.switchkins-type)
(debug,or missing hal net to analog-out-0x)
o2 if [[#<_task> EQ 1] AND [#<_kins_type> NE #<kinstype>]]
(debug,M430:Wrong kinematics type)
(debug,STOP)
M2
o2 else
o2 endif

o<430remap>endsub
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
pin+motion.analog-out-03
pin+motion.switchkins-type
pin+motion.kins-type

pin+joint.0.pos-cmd
pin+joint.1.pos-cmd
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ SUBROUTINE_PATH = ./remap_subs

[KINS]
#NOTE: for backwrds compatibility !!!!!!!!!!!!!!!!!!!
# default switchkins-type == 0 is xyzac-trt-kins
# here switchkins-type == 0 is identity kins
# default kinstype 0 is xyzac-trt-kins
# here kinstype 0 is identity kins
KINEMATICS = xyzac-trt-kins sparm=identityfirst
JOINTS = 5

Expand All @@ -48,8 +48,6 @@ KINEMATICS = xyzac-trt-kins sparm=identityfirst
HALFILE = LIB:basic_sim.tcl
POSTGUI_HALFILE = switchkins_postgui.hal

# net for control of motion.switchkins-type
HALCMD = net :kinstype-select <= motion.analog-out-03 => motion.switchkins-type

# vismach xyzac-trt-gui items
HALCMD = loadusr -W xyzac-trt-gui
Expand All @@ -73,9 +71,9 @@ HALCMD = setp xyzac-trt-kins.conventional-directions 0

[HALUI]
# NOTE: kinstype==0 is identity kins because sparm=identityfirst
# M429:identity kins (motion.switchkins-type==0 startupDEFAULT)
# M428:xyzac kins (motion.switchkins-type==1)
# M430:userk kins (motion.switchkins-type==2)
# M429:identity kins (kinstype 0, startupDEFAULT)
# M428:xyzac kins (kinstype 1)
# M430:userk kins (kinstype 2)
MDI_COMMAND = M429
MDI_COMMAND = M428
MDI_COMMAND = M430
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ Uses remapped user m codes for kins switch:
M428: XYZAC (TCP)
M430: userk Kinematics

A hal net is required to connect the
analog out pin N, Example (for N=3):

net :kinstype-select <= motion.analog-out-03
net :kinstype-select => motion.switchkins-type
The kinematics type is selected with
G12.1 and G13.1, no hal connection is
required.

Hal Input pins:
xyzac-trt-kins.y-offset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ SUBROUTINE_PATH = ./remap_subs

[KINS]
#NOTE: for backwrds compatibility !!!!!!!!!!!!!!!!!!!
# default switchkins-type == 0 is xyzbc-trt-kins
# here switchkins-type == 0 is identity kins
# default kinstype 0 is xyzbc-trt-kins
# here kinstype 0 is identity kins
KINEMATICS = xyzbc-trt-kins sparm=identityfirst
JOINTS = 5

Expand All @@ -48,8 +48,6 @@ KINEMATICS = xyzbc-trt-kins sparm=identityfirst
HALFILE = LIB:basic_sim.tcl
POSTGUI_HALFILE = switchkins_postgui.hal

# net for control of motion.switchkins-type
HALCMD = net :kinstype-select <= motion.analog-out-03 => motion.switchkins-type

# vismach xyzbc-trt-gui items
HALCMD = loadusr -W xyzbc-trt-gui
Expand All @@ -73,9 +71,9 @@ HALCMD = setp xyzbc-trt-kins.conventional-directions 0

[HALUI]
# NOTE: kinstype==0 is identity kins because sparm=identityfirst
# M429:identity kins (motion.switchkins-type==0 startupDEFAULT)
# M428:xyzbc kins (motion.switchkins-type==1)
# M430:userk kins (motion.switchkins-type==2)
# M429:identity kins (kinstype 0, startupDEFAULT)
# M428:xyzbc kins (kinstype 1)
# M430:userk kins (kinstype 2)
MDI_COMMAND = M429
MDI_COMMAND = M428
MDI_COMMAND = M430
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ Uses remapped user m codes for kins switch:
M428: XYZBC (TCP)
M430: userk Kinematics

A hal net is required to connect the
analog out pin N, Example (for N=3):

net :kinstype-select <= motion.analog-out-03
net :kinstype-select => motion.switchkins-type
The kinematics type is selected with
G12.1 and G13.1, no hal connection is
required.

Hal Input pins:
xyzbc-trt-kins.x-offset
Expand Down
Loading
Loading