The Road to CNC (part 2: custom kinematics)

As I kept reading about LinuxCNC, I figured I’d try it out with the CoreXY Laser Engraver I made a while back.

LinuxCNC supports a number of typical machine kinematics out of the box. (Kinematics are included for 3-axis mills, scaras, and pumas.) A CoreXY isn’t one of them, though, so I needed to write a new kinematics file for CoreXY gantries.

To add custom kinematics, I wrote a corexykins.c based on the “trivial kinematics” file, trivkins.c, and followed OOOVincentOOO’s guidelines on the forums for installation. The actual changes were staggeringly simple–only about 5 lines were changed!

To load my new configuration, I ran the StepGen Configuration Wizard, which output the needed *.ini and *.hal files. I had to edit these files manually in two places, though. In the *.hal file, to load the new kinematics, I switched the line:

loadrt trivkins

to

loadrt corexykins

Lastly, in the *.ini file, I also needed to bump up the FERROR and MIN_ERROR from 0.05 to 0.5; otherwise LinuxCNC would throw the error

 

joint 0 following error
joint 1 following error

when switching from joint mode to world mode, at which point it actually uses the inverse kinematics equations to see if the tool’s current location matches where the forward kinematics actually brought the tool. (I’m assuming that either rounding error or the fact that my pc’s software stepping can’t keep up with the desired input speed could be the reasons for this error.)

For more references on writing up custom kinematics (with examples), here’s a few links.

Leave a Reply

Your email address will not be published. Required fields are marked *