LinuxCNC Documentation

SYNOPSIS

loadrt switchkinscomp [count=N|names=name1[,name2…​]]

DESCRIPTION

Example of a switchable kinematics module buildable with halcompile.

The switchkinscomp.comp file (src/hal/components/switchkinscomp.comp) illustrates a method to use halcompile to build a kinematics module on top of the switchkins implementation used by the in-tree kinematics modules, so an out-of-tree module gets the same kinematics switching, the same kinstype.is-N pins, the same coordinates= identity mapping, and the same G-code and HAL controls, without reimplementing any of it.

The example builds as it stands, its type 1 being an X offset to replace with the kinematics wanted. The switchkins implementation is the switchkins_core module, which the HAL file loads first; this component only registers its types with it.

The kinematics are written as functions of a parameter block, see kins_module.h and the Kinematics Conventions chapter: the geometry is declared once in a table, one HAL pin is made per entry, and the maths reads the block where it would have read a pin. The same maths can then be evaluated outside realtime.

To avoid updates that overwrite switchkinscomp.comp, best practice is to rename the file and its component name (example: user_switchkins.comp creates module: user_switchkins).

The (renamed) component can be built and installed with halcompile and then used as the kinematics module by inifile setting:

[KINS]
KINEMATICS = user_switchkins
JOINTS = 3

with switchkins_core loaded ahead of it in the HAL file:

loadrt switchkins_core
loadrt [KINS]KINEMATICS

Note: If using a deb install:

  1. halcompile and the switchkins header are provided by the deb package linuxcnc-dev

  2. This source file for BRANCHNAME (master, 2.9, etc) is downloadable from github:

For information on switchable kinematics see the switchkins document chapter (docs/src/motion/switchkins.txt).

PINS

switchkinscomp.N.is-module bool out (default: 1)

LICENSE

GPL