Skip to content

Motion Planning Overview

TheRealBeef edited this page Oct 22, 2023 · 1 revision

LinuxCNC Motion Planning Overview

  • Real-time Operation: Contrary to misconceptions, the LinuxCNC motion planner operates in real-time. The confusion might arise from equating the interpreter's processing of gcode program commands with the trajectory planner's processing of canonical commands.

  • Interpreter and Canonical Messages:

    • The interpreter in the task program (typically: [TASK]TASK=milltask) processes gcode commands in userspace.
    • These commands are converted into canonical (canon) messages.
    • These messages are then sent to the realtime motion module (typically: [EMCMOT]EMCMOT=motmod).
    • Reference for canon: canon.hh
  • Realtime Motion Module:

    • The realtime motion module calls the trajectory planner (tpmod by default) at the servo rate.
    • It computes new positions based on machine configuration, the queue of canon messages, current position, instantaneous requests (like adaptive_feed), and more.
    • Reference for tpRunCycle invocation: control.c#L1327
  • Trajectory Planner Functions:

    • Functions in the trajectory planner are prefixed with tp[A-Z]*.
    • The interface for the trajectory planner is defined in tp.h and tc.h.
    • Reference: tc.h
  • Custom Trajectory Planners:

    • Users can create custom trajectory planning modules using halcompile.
    • Instructions can be found in tpcomp.comp.
    • All tp interface functions must be provided in custom planners.
    • Custom planners can add or remove specific functionalities. For example, a planner could focus on 3D planning but limit jerk for only 2 axes.
Clone this wiki locally