A set of patches posted to the Linux kernel mailing list today propose the introduction of a Linux Motion Control “LMC” subsystem for drivers that could control devices like CNC machines and 3D printers.
The Linux Motion Control subsystem is envisioned as an area for hardware devices that control mechanical motion such as different types of motors and actuators.
David Jander who sent out the request for comments (RFC) patch series explained of this Linux Motion Control subsystem:
“This subsystem defines a new UAPI for motion devices on the user-space side, as well as common functionality for hardware device drivers on the driver side.
The UAPI is based on a ioctl() interface on character devices representing a specific hardware device. The hardware device can control one or more actuators (motors), which are identified as channels in the UAPI. It is possible to execute motions on individual channels, or combined affecting several selected (or all) channels [simultaneously]. Examples of coordinated movements of several channels could be the individual axes of a 3D printer or CNC machine for example.
On the hardware side, this initial set of patches also includes two drivers for two different kinds of motors. One is a stepper motor controller device that containes a ramp generator capable of autonomously executing controlled motions following a multi-point acceleration profile (TMC5240), as well as a simple DC motor controller driver that can control DC motors via a half-bridge or full H-bridge driver such as the TI DRV8873 for example.”
The cover letter goes on to interesting possibilities for the Linux Motion Control when paired with the Industrial I/O (IIO) and Linux real-time kernel “PREEMPT_RT” capabilities:
“Towards the IIO subsystem, LMC supports generating iio trigger events that fire at certain motion events, such as passing a pre-programmed position or when reaching the motion target position, depending on the capabilities of the hardware device. This enables for example triggering an ADC measurement at a certain position during a movement.
In the future, making use of PREEMPT_RT, even dumb STEP/DIR type stepper motor controller drivers may be implemented entirely in the kernel, depending on some characteristics of the hardware (latency jittter, interrupt latency and CPU speed mainly).”
LMC is already be used to control some unnamed machines with up to 16 stepper motors and up to four DC motors simultaneously.
The LMC subsystem infrastructure and two example motion drivers currently clocks in at a combined 4K lines of C code. Those interested in learning more about this Linux Motion Control subsystem proposal can find it on the LKML.