Can a Kinematics module accept an external position
command for a stand alone axis?
A kinematics module can read or write hal pins at the
servo-thread interval for its kinematics functions -- so you
could write a custom kinematics module to accept
inputs to modify the C axis value for the calculation of its
corresponding identity joint in the kinematicsInverse()
function.
The master branch (or recent 2.8.1) includes an example
kinematics module that can be built and installed with
halcompile and illustrates the creation of hal pins.
The template provided is a simple identity kins
(3joints 0,1,2==x,y,z) but extension to
(4joints 0,1,2,3==x,y,z,c) would be straightforward.
You must always be careful that the forward and inverse
kins are consistent but for your application, you may
be able to modify the joint3 value in the kinematicsInverse()
function according to an input from a hal pin read each cycle.
If your gcode uses the C axis, but you want to modify it in
the kinematics, it would require something like:
Code:
kinematicsInverse()
...
j[3] = pos->c + hal_pin_c_correction; //add correction
//for joint 3 motor
kinematicsForward()
...
pos->c = j[3] - hal_pin_c_correction; // remove correction
...
The ordering of addf's for your computation will be critical
to avoid following errors. It might be best to incorporate
your calculations in the kinematicsInverse() function. You
would need to save the calculated correction in a static
variable and apply its removal in the kinematicsForward()
calculation.
userkins man page:
linuxcnc.org/docs/2.8/html/man/man9/userkins.9.html
userkins template code:
github.com/LinuxCNC/linuxcnc/raw/2.8/src...onents/userkins.comp
halcompile man page:
linuxcnc.org/docs/2.8/html/man/man1/halcompile.1.html