LinuxCNC Documentation

See also the man pages motion(9).

1. Bewegung (engl. motion)

These pins and parameters are created by the realtime motmod module.

Dieses Modul bietet eine HAL-Schnittstelle für den Bewegungsplaner (engl. motion planner) von LinuxCNC.

Im Grunde genommen nimmt motmod eine Liste von Wegpunkten auf und erzeugt daraus einen schönen ineinander übergehenden und durch Einschränkungen begrenzten Strom von Gelenkpositionen, der an die Motorantriebe weitergeleitet wird.

Optional wird die Anzahl der digitalen E/A (engl. I/O) mit num_dio eingestellt. Die Anzahl der analogen E/A wird mit num_aio festgelegt, Standard ist jeweils 4. Die Anzahl der Spindeln wird mit num_spindles eingestellt, Voreinstellung ist 1.

Pin- und Parameternamen, die mit axis.L und joint.N beginnen, werden von der Motion-Controller-Funktion gelesen und aktualisiert.

Motion wird mit dem Befehl motmod geladen. Ein kins sollte vor motion geladen werden.

loadrt motmod base_period_nsec=['period'] servo_period_nsec=['period']
              traj_period_nsec=['period'] num_joints=['0-9']
              num_dio=['1-64'] num_aio=['1-16'] unlock_joints_mask=['0xNN']
              num_spindles=['1-8']
  • base_period_nsec = 50000 - die Basis-Task Period in Nanosekunden. Dies ist der schnellste Thread der Maschine.

Note
Bei Servo-basierten Systemen gibt es im Allgemeinen keinen Grund dafür, dass base_period_nsec kleiner ist als servo_period_nsec. Bei Maschinen mit Software-Schrittgenerierung bestimmt die base_period_nsec die maximale Anzahl der Schritte pro Sekunde. Wenn keine großen Schrittlängen und Schrittabstände erforderlich sind, beträgt die absolut maximale Schrittrate einen Schritt pro base_period_nsec. Somit ergibt die oben gezeigte base_period_nsec eine absolute maximale Schrittrate von 20.000 Schritten pro Sekunde. 50.000 ns (50 µs) ist ein recht konservativer Wert. Der kleinste brauchbare Wert hängt mit dem Ergebnis des Latenztests, der erforderlichen Schrittlänge und der Prozessorgeschwindigkeit zusammen. Die Wahl einer zu niedrigen base_period_nsec kann zu der Meldung "Unerwartete Echtzeitverzögerung", zu Blockierungen oder spontanen Reboots führen.
  • servo_period_nsec = 1000000 - Dies ist die Servo task period in Nanosekunden. Dieser Wert wird auf ein ganzzahliges Vielfaches von base_period_nsec gerundet. Diese Periode wird auch bei Systemen verwendet, die auf Schrittmotoren basieren.

    Dies ist die Rate, mit der neue Motorpositionen berechnet werden, Schleppfehler überprüft werden, PID-Ausgangswerte aktualisiert werden und so weiter. Die meisten Systeme werden diesen Wert nicht ändern müssen. Es ist die Aktualisierungsrate des Low-Level-Bewegungsplaners.

  • traj_period_nsec = 100000 - Dies ist die Trajectory Planner Aufgabenperiode in Nanosekunden. Dieser Wert wird auf ein ganzzahliges Vielfaches von servo_period_nsec gerundet. Außer bei Maschinen mit ungewöhnlicher Kinematik (z.B. Hexapods) gibt es keinen Grund, diesen Wert größer als servo_period_nsec zu machen.

1.1. Optionen

Wenn Sie mehr als die standardmäßige Anzahl von 4 digitalen E/A benötigen, können Sie bis zu 64 digitale E/A hinzufügen, indem Sie die Option num_dio beim Laden von motmod verwenden.

Wenn mehr als die voreingestellte Anzahl von 4 analogen E/A benötigt wird, können Sie bis zu 16 analoge E/A hinzufügen, indem Sie die Option num_aio beim Laden von motmod verwenden.

Der Parameter unlock_joints_mask wird verwendet, um Pins für ein Gelenk zu erzeugen, das als verriegelnder Indexer verwendet wird (normalerweise ein Drehgelenk). Die Maskenbits wählen das/die Gelenk(e) aus. Das LSB der Maske wählt das Gelenk 0. Beispiel:

unlock_joints_mask=0x38 wählt die Gelenke 3,4,5 aus

1.2. Pins

These pins, parameters, and functions are created by the realtime motmod module.

  • motion.adaptive-feed - (real, in) When adaptive feed is enabled with M52 P1 , the commanded velocity is multiplied by this value. This effect is multiplicative with the NML-level feed override value and motion.feed-hold. As of version 2.9 of LinuxCNC it is possible to use a negative adaptive feed value to run the G-code path in reverse.

  • motion.analog-in-00 - (real, in) These pins (00, 01, 02, 03 or more if configured) are controlled by M66.

  • motion.analog-out-00 - (real, out) These pins (00, 01, 02, 03 or more if configured) are controlled by M67 or M68.

  • motion.coord-error - (bool, out) TRUE when motion has encountered an error, such as exceeding a soft limit

  • motion.coord-mode - (bool, out) TRUE when motion is in coordinated mode, as opposed to teleop mode

  • motion.current-vel - (real, out) The current tool velocity in user units per second.

  • motion.digital-in-00 - (bool, in) These pins (00, 01, 02, 03 or more if configured) are controlled by M62-65.

  • motion.digital-out-00 - (bool, out) These pins (00, 01, 02, 03 or more if configured) are controlled by the M62-65.

  • motion.distance-to-go - (real, out) The distance remaining in the current move.

  • motion.enable - (bool, in) If this input is driven FALSE, motion stops, the machine is placed in the machine off state, and a message is displayed for the operator. For normal motion, drive this input TRUE.

  • motion.feed-hold - (bool, in) When Feed Stop Control is enabled with M53 P1, and this input is TRUE, the feed rate is set to 0.

  • motion.feed-inhibit - (bool, in) When this input is TRUE, the feed rate is set to 0. This will be delayed during spindle synch moves till the end of the move.

  • motion.in-position - (bool, out) TRUE if the machine is in position.

  • motion.motion-enabled - (bool, out) TRUE when in machine on state.

  • motion.motion-type - (sint, out) These values are from src/emc/nml_intf/motion_types.h

    • 0: Leerlauf (engl. "idle", d.h. keine Bewegung)

    • 1: Traverse (direkte Bewegung)

    • 2: Linearer Vorschub

    • 3: Kreisbogenvorschub

    • 4: Werkzeugwechsel

    • 5: Antasten

    • 6: Indexierung der Drehachse

  • motion.on-soft-limit - (bool, out) TRUE when the machine is on a soft limit.

  • motion.probe-input - (bool, in) G38.n uses the value on this pin to determine when the probe has made contact. TRUE for probe contact closed (touching), FALSE for probe contact open.

  • motion.program-line - (sint, out) The current program line while executing. Zero if not running or between lines while single stepping.

  • motion.requested-vel - (real, out) The current requested velocity in user units per second. This value is the F-word setting from the G-code file, possibly reduced to accommodate machine velocity and acceleration limits. The value on this pin does not reflect the feed override or any other adjustments.

  • motion.teleop-mode - (bool, out) TRUE when motion is in teleop mode, as opposed to coordinated mode

  • motion.tooloffset.x …​ motion.tooloffset.w - (real, out, one per axis) shows the tool offset in effect; it could come from the tool table (G43 active), or it could come from the G-code (G43.1 active)

  • motion.on-soft-limit - (bool, out) TRUE when the machine is on a soft limit.

  • motion.probe-input - (bool, in) G38.n uses the value on this pin to determine when the probe has made contact. TRUE for probe contact closed (touching), FALSE for probe contact open.

  • motion.program-line - (sint, out) The current program line while executing. Zero if not running or between lines while single stepping.

  • motion.requested-vel - (real, out) The current requested velocity in user units per second. This value is the F-word setting from the G-code file, possibly reduced to accommodate machine velocity and acceleration limits. The value on this pin does not reflect the feed override or any other adjustments.

  • motion.teleop-mode - (bool, out) TRUE when motion is in teleop mode, as opposed to coordinated mode

  • motion.tooloffset.x …​ motion.tooloffset.w - (real, out, one per axis) shows the tool offset in effect; it could come from the tool table (G43 active), or it could come from the G-code (G43.1 active)

1.3. Parameter

Viele dieser Parameter dienen als Hilfsmittel zur Fehlersuche und können jederzeit geändert oder entfernt werden.

  • motion-command-handler.time - (sint, RO)

  • motion-command-handler.tmax - (sint, RW)

  • motion-controller.time - (sint, RO)

  • motion-controller.tmax - (sint, RW)

  • motion.debug-bool-0 - (bool, RO) This is used for debugging purposes.

  • motion.debug-bool-1 - (bool, RO) This is used for debugging purposes.

  • motion.debug-real-0 - (real, RO) This is used for debugging purposes.

  • motion.debug-real-1 - (real, RO) This is used for debugging purposes.

  • motion.debug-real-2 - (real, RO) This is used for debugging purposes.

  • motion.debug-real-3 - (real, RO) This is used for debugging purposes.

  • motion.debug-sint-0 - (sint, RO) This is used for debugging purposes.

  • motion.debug-sint-1 - (sint, RO) This is used for debugging purposes.

  • motion.servo.last-period - (uint, RO) The time in ns between invocations of the servo thread. This number can be used to determine whether the realtime motion controller is meeting its timing constraints

1.4. Funktionen

Im Allgemeinen werden diese beiden Funktionen in der angegebenen Reihenfolge zum Servo-Thread hinzugefügt.

  • motion-command-handler - Empfängt und verarbeitet Bewegungsbefehle aus dem Benutzerbereich

  • motion-controller - Führt die LinuxCNC Bewegungssteuerung aus

2. Spindel

LinuxCNC kann bis zu acht Spindeln steuern. Motion wird die folgenden Pins anlegen: Das N (ganze Zahl zwischen 0 und 7) entspricht der Spindel-Nummer.

2.1. Pins

  • spindle.N.at-speed - (bool, in) Motion will pause until this pin is TRUE, under the following conditions:

    • vor der ersten Vorschubbewegung nach jedem Spindelstart oder Drehzahlwechsel;

    • vor dem Beginn jeder Kette von spindelsynchronisierten Bewegungen;

    • und im CSS-Modus bei jedem Übergang von Eilgang zu Vorschub. Dieser Eingang kann verwendet werden, um sicherzustellen, dass die Spindel vor dem Beginn eines Schnittes die volle Drehzahl erreicht hat oder dass eine Drehmaschinenspindel im CSS-Modus nach einem Durchgang vom großen zum kleinen Plandurchmesser abgebremst hat, bevor der nächste Durchgang am großen Durchmesser beginnt. Viele VFDs haben einen bei Drehzahl Ausgang. Andernfalls ist es einfach, dieses Signal mit der Komponente HAL near zu erzeugen, indem man die gewünschte und die tatsächliche Spindeldrehzahl vergleicht.

  • spindle.N.brake - (bool, out) TRUE when the spindle brake should be applied.

  • spindle.N.forward - (bool, out) TRUE when the spindle should rotate forward.

  • spindle.N.index-enable - (bool, I/O) For correct operation of spindle synchronized moves, this pin must be hooked to the index-enable pin of the spindle encoder.

  • spindle.N.inhibit - (bool, in) When this input is TRUE, the spindle speed is set to 0.

  • spindle.N.on - (bool, out) TRUE when spindle should rotate.

  • spindle.N.reverse - (bool, out) TRUE when the spindle should rotate backward

  • spindle.N.revs - (real, in) For correct operation of spindle synchronized moves, this signal must be hooked to the position pin of the spindle encoder. The spindle encoder position should be scaled such that spindle-revs increases by 1.0 for each rotation of the spindle in the clockwise (M3) direction.

  • spindle.N.speed-in - (real, in) Feedback of actual spindle speed in rotations per second. This is used by feed-per-revolution motion (G95). If your spindle encoder driver does not have a velocity output, you can generate a suitable one by sending the spindle position through a ddt component. If you do not have a spindle encoder, you can loop back spindle.N.speed-out-rps.

  • spindle.N.speed-out - (real, out) Commanded spindle speed in rotations per minute. Positive for spindle forward (M3), negative for spindle reverse (M4).

  • spindle.N.speed-out-abs - (real, out) Commanded spindle speed in rotations per minute. This will always be a positive number.

  • spindle.N.speed-out-rps - (real, out) Commanded spindle speed in rotations per second. Positive for spindle forward (M3), negative for spindle reverse (M4).

  • spindle.N.speed-out-rps-abs - (real, out) Commanded spindle speed in rotations per second. This will always be a positive number.

  • spindle.N.orient-angle - (real, out) Desired spindle orientation for M19. Value of the M19 R word parameter plus the value of the [RS274NGC]ORIENT_OFFSET INI parameter.

  • spindle.N.orient-mode - (sint, out) Desired spindle rotation mode M19. Default 0.

  • spindle.N.orient - (bool, out) Indicates start of spindle orient cycle. Set by M19. Cleared by any of M3, M4, or M5. If spindle-orient-fault is not zero during spindle-orient true, the M19 command fails with an error message.

  • spindle.N.is-oriented - (bool, in) Acknowledge pin for spindle-orient. Completes orient cycle. If spindle-orient was true when spindle-is-oriented was asserted, the spindle-orient pin is cleared and the spindle-locked pin is asserted. Also, the spindle-brake pin is asserted.

  • spindle.N.orient-fault - (sint, in) Fault code input for orient cycle. Any value other than zero will cause the orient cycle to abort.

  • spindle.N.lock - (bool, out) Spindle orient complete pin. Cleared by any of M3, M4, or M5.

Verwendung des HAL-Pins für die M19-Spindel-Orientierung

Konzeptionell befindet sich die Spindel in einem der folgenden Modi:

  • Rotationsmodus (die Standardeinstellung)

  • Suchend nach der gewünschten Orientierung

  • Orientierung-durchgeführt-Modus.

Wenn ein M19 ausgeführt wird, wechselt die Spindel in den Modus Suche nach gewünschter Orientierung, und der HAL-Pin spindle.__N__.orient wird aktiviert. Die gewünschte Zielposition wird durch die Pins "spindle.N.orient-angle" und "spindle.N.orient-fwd" festgelegt und durch die M19-Parameter R und P gesteuert.

Es wird erwartet, dass die HAL-Unterstützungslogik auf spindle.__N__.orient reagiert, indem sie die Spindel in die gewünschte Position bewegt. Wenn dies abgeschlossen ist, wird erwartet, dass die HAL-Logik dies durch die Bestätigung des Pins "Spindle.N.is-oriented" .

Motion quittiert dies durch Deaktivierung des Pins "Spindle.N.orient" und aktiviert den Pin "Spindle.N.locked", um den Modus "Orientierung abgeschlossen" anzuzeigen. Außerdem wird der Pin "spindle.N.brake" angehoben. Die Spindel befindet sich nun im Modus Orientierung abgeschlossen.

Wenn der Pin "spindle.N.orient-fault" einen Wert ungleich Null hat, während "spindle.N.orient" wahr ist und "spindle.N.is oriented" noch nicht aktiviert ist, wird der M19-Befehl abgebrochen, eine Meldung mit dem Fehlercode angezeigt und die Bewegungswarteschlange geleert. Die Spindel kehrt in den Rotationsmodus zurück.

Außerdem kann jeder der Befehle M3, M4 oder M5 entweder den Modus Suche nach gewünschter Orientierung oder Orientierung abgeschlossen abbrechen. Dies wird durch das Deassertieren der Pins spindle-orient und spindle-locked angezeigt.

Der Pin "spindle-orient-mode" spiegelt das M19 P-Wort wider und ist wie folgt zu interpretieren:

  • 0: Drehen im oder gegen den Uhrzeigersinn für kleinste Winkelbewegung

  • 1: immer rot

  • 2: immer gegen den Uhrzeigersinn drehen

Sie kann mit der HAL-Komponente "orient" verwendet werden, die einen PID-Befehlswert auf der Grundlage der Spindelgeberposition, des spindle-orient-angle ("Spindelorientierungswinkel") and spindle-orient-mode ("Spindelorientierungsmodus") liefert.

3. Achs- und Gelenkpins und Parameter

Diese Pins und Parameter werden durch das Echtzeitmodul motmod angelegt. [In trivial kinematics Maschinen gibt es eine Eins-zu-Eins-Entsprechung zwischen Gelenken und Achsen.] Sie werden von der Funktion motion-controller gelesen und aktualisiert.

Einzelheiten zu den Pins und Parametern finden Sie in der Motion-Manpage motion(9).

4. iocontrol

iocontrol - nimmt Nicht-Echtzeit-E/A-Befehle via NML entgegen, interagiert mit HAL.

Die HAL-Pins von iocontrol werden im Nicht-Echtzeit-Kontext ein- und ausgeschaltet. Wenn Sie strenge Timing-Anforderungen haben oder einfach mehr E/A benötigen, sollten Sie stattdessen die echtzeitsynchronisierte E/A verwenden, die von motion bereitgestellt wird.

4.1. Pins

  • iocontrol.0.coolant-flood (bool, out) TRUE when flood coolant is requested.

  • iocontrol.0.coolant-mist (bool, out) TRUE when mist coolant is requested.

  • iocontrol.0.emc-enable-in (bool, in) Should be driven FALSE when an external E-Stop condition exists.

  • iocontrol.0.tool-change (bool, out) TRUE when a tool change is requested.

  • iocontrol.0.tool-changed (bool, in) Should be driven TRUE when a tool change is completed.

  • iocontrol.0.tool-number (sint, out) The current tool number.

  • iocontrol.0.tool-prep-number (sint, out) The number of the next tool, from the RS274NGC T-word.

  • iocontrol.0.tool-prepare (bool, out) TRUE when a tool prepare is requested.

  • iocontrol.0.tool-prepared (bool, in) Should be driven TRUE when a tool prepare is completed.

  • iocontrol.0.user-enable-out (bool, out) FALSE when an internal E-Stop condition exists.

  • iocontrol.0.user-request-enable (bool, out) TRUE when the user has requested that E-Stop be cleared.

5. INI-Einstellungen

Eine Reihe von INI-Einstellungen werden als HAL Eingangspins zur Verfügung gestellt.

5.1. Pins

N refers to a joint number, L refers to an axis letter.

  • ini.N.ferror - (real, in) [JOINT_N]FERROR

  • ini.N.min_ferror - (real, in) [JOINT_N]MIN_FERROR

  • ini.N.backlash - (real, in) [JOINT_N]BACKLASH

  • ini.N.min_limit - (real, in) [JOINT_N]MIN_LIMIT

  • ini.N.max_limit - (real, in) [JOINT_N]MAX_LIMIT

  • ini.N.max_velocity - (real, in) [JOINT_N]MAX_VELOCITY

  • ini.N.max_acceleration - (real, in) [JOINT_N]MAX_ACCELERATION

  • ini.N.home - (real, in) [JOINT_N]HOME

  • ini.N.home_offset - (real, in) [JOINT_N]HOME_OFFSET

  • ini.N.home_offset - (sint, in) [JOINT_N]HOME_SEQUENCE

  • ini.L.min_limit - (real, in) [AXIS_L]MIN_LIMIT

  • ini.L.max_limit - (real, in) [AXIS_L]MAX_LIMIT

  • ini.L.max_velocity - (real, in) [AXIS_L]MAX_VELOCITY

  • ini.L.max_acceleration - (real, in) [AXIS_L]MAX_ACCELERATION

Note
Die achsspezifischen Pins min_limit und max_limit werden nach der Referenzfahrt kontinuierlich berücksichtigt. Die achsspezifischen Pins ferror und min_ferror werden berücksichtigt, wenn die Maschine eingeschaltet ist und sich nicht in Position befindet. Die achsspezifischen Pins max_velocity und max_acceleration werden abgetastet, wenn die Maschine eingeschaltet und der motion_state frei ist (Referenzfahrt oder Jogging), aber nicht, wenn ein Programm läuft (Auto-Modus) oder im MDI-Modus. Folglich hat eine Änderung der Pin-Werte bei laufendem Programm erst dann Auswirkungen, wenn das Programm gestoppt wird und der motion_state wieder frei ist.
  • ini.traj_arc_blend_enable - (bool, in) [TRAJ]ARC_BLEND_ENABLE

  • ini.traj_arc_blend_fallback_enable - (bool, in) [TRAJ]ARC_BLEND_FALLBACK_ENABLE

  • ini.traj_arc_blend_gap_cycles - (real, in) [TRAJ]ARC_BLEND_GAP_CYCLES

  • ini.traj_arc_blend_optimization_depth - (real, in) [TRAJ]ARC_BLEND_OPTIMIZATION_DEPTH

  • ini.traj_arc_blend_ramp_freq - (real, in) [TRAJ]ARC_BLEND_RAMP_FREQ

Note
The traj_arc_blend pins are sampled continuously but changing pin values while a program is running may not have immediate effect due to queueing of commands.
  • ini.traj_default_acceleration - (real, in) [TRAJ]DEFAULT_ACCELERATION

  • ini.traj_default_velocity - (real, in) [TRAJ]DEFAULT_VELOCITY

  • ini.traj_max_acceleration - (real, in) [TRAJ]MAX_ACCELERATION

S-Kurven Trajektorenplanungs-Pins (werden kontinuierlich gesampelt, können sich zur Laufzeit ändern):

  • ini.traj_planner_type - (sint, in) [TRAJ]PLANNER_TYPE

  • ini.traj_max_jerk - (real, in) [TRAJ]MAX_LINEAR_JERK

Pro-Achse Jerk-Begrenzungs-Pins (wobei L aus {x, y, z, a, b, c, u, v, or w}):

  • ini.L.max_jerk - (real, in) [AXIS__L_]MAX_JERK

Joint-spezifische Pins zur Begrenzung des Jerks (N spezifiziert die Joint-Nummer 0 bis 8):

  • ini.N.max_jerk - (real, in) [JOINT__N_]MAX_JERK