LinuxCNC Documentation

See also the man pages motion(9).

1. Motion

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

Este módulo proporciona una interfaz HAL para el planificador de movimiento de LinuxCNC.

Básicamente motmod toma una lista de puntos de camino y genera un flujo bien balanceado y restringido de posiciones de articulaciones para alimentar a los controladores de motor.

Opcionalmente, el número de E/S digitales se establece con num_dio. El número de E/S analógicas se establece con num_aio. El valor predeterminado es 4 en cada uno. El número de husillos se establece con num_spindles, el predeterminado es 1.

Los nombres de pines y parámetros, que comienzan con axis.L y joint.N son leídos y actualizados por la función motion-controller.

Motion se carga con el comando motmod. Antes de motion, debe ser cargado un modulo de cinematica.

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 - es el período de la tarea Base en nanosegundos. Este es el hilo más rápido en la máquina.

Note
En sistemas basados en servo, generalmente no hay razón para que base_period_nsec sea mas rapida que servo_period_nsec. En máquinas con generación por pasos de software, base_period_nsec determina la cantidad máxima de pasos por segundo. En ausencia de necesidad de pasos largos y requisitos de espacio, la tasa de pasos máxima absoluta es de un paso por base_period_nsec. Por lo tanto, para base_period_nsec = 50000 (0,05 m´s) se tendria una tasa de paso máxima absoluta de (1000/0,05) 20,000 pasos por segundo. 50,000 ns (50 µs) es un valor bastante conservador. El menor valor utilizable está relacionado con el resultado de la prueba de latencia, el ttiemp de paso necesario, y la velocidad del procesador. Elegir un base_period_nsec que sea demasiado rapido puede conducir a un mensaje de "retraso en tiempo real inesperado", bloqueos o reinicios espontáneos.
  • servo_period_nsec = 1000000 - Este es el período de la tarea Servo en nanosegundos. Este valor se redondeará a un múltiplo entero de base_period_nsec. Este período se usa incluso en sistemas basados en motores paso a paso.

    Esta es la velocidad a la que se calculan las nuevas posiciones de los motores, se verifica el error de seguimiento, se actualizan los valores de salida PID, y así sucesivamente. La mayoría de los sistemas no necesitarán cambiar este valor. Es la tasa de actualización del planificador de movimiento de bajo nivel.

  • traj_period_nsec = 100000 - Este es el periodo de la tarea Planificador de trayectoria en nanosegundos. Este valor se redondeará a un número entero múltiplo de servo_period_nsec. Excepto para máquinas con cinemáticas inusuales (p. ej., hexápodos) no hay razón para que este valor sea más alto que servo_period_nsec.

1.1. Opciones

Si la cantidad de E/S digital necesaria es mayor que el valor predeterminado de 4, puede agregar hasta 64 E/S digitales usando la opción num_dio al cargar motmod.

Si la cantidad de E/S analógica necesaria es mayor que el valor predeterminado de 4, puede agregar hasta 16 E/S analógicas usando la opción num_aio al cargar motmod.

El parámetro unlock_joints_mask se usa para crear pines para una articulación utilizada como indexador con bloqueo (típicamente rotativas). Los bits de máscara seleccionan la(s) articulación(es). El bit menos significativo de la máscara selecciona la articulación 0. Ejemplo:

unlock_joints_mask=0x38 selecciona las articulaciones 3, 4 y 5

1.2. Pines

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: Idle (sin movimiento)

    • 1: Atravesar

    • 2: Avance lineal

    • 3: Avance de arco

    • 4: Cambio de herramienta

    • 5: Sondeo

    • 6: Indexación de eje rotativo

  • 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. Parámetros

Muchos de estos parámetros sirven como ayudas para la depuración, y están sujetos a cambio o eliminación en cualquier momento.

  • 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. Funciones

En general, estas funciones se agregan al hilo servo en el orden mostrado.

  • motion-command-handler - Recibe y procesa comandos de movimiento

  • motion-controller - Ejecuta el controlador de movimiento LinuxCNC

2. Husillo

LinuxCNC puede controlar hasta ocho husillos. El movimiento producirá los pines siguientes: El N (entero entre 0 y 7) sustituye el número de husillo.

2.1. Pines

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

    • antes del primer movimiento de alimentación, después de cada arranque de husillo o cambio de velocidad;

    • antes del inicio de cada cadena de movimientos sincronizados con el husillo;

    • si está en modo CSS, en cada transición de velocidad rapida a velocidad de alimentación. Esta entrada se puede usar para asegurar que el husillo esté a su velocidad antes de comenzar un corte, o que un husillo de torno en modo CSS se ha ralentizado después de un pase de refrentado grande a pequeño antes de comenzar el próximo pase en el diámetro grande. Muchos VFD tienen una salida a velocidad. De lo contrario, es fácil generar esta señal con el componente HAL near mediante la comparación de las velocidades solicitadas y reales del eje.

  • 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.

Uso del pin HAL de orientacion del husillo M19

Conceptualmente, el husillo está en uno de los modos siguientes:

  • modo de rotación (predeterminado)

  • modo de busqueda de orientación deseada

  • modo de orientación completada.

Cuando se ejecuta un M19, el husillo cambia a buscando orientación deseada, y se activa el pin HAL spindle.__N__.orient. La posición objetivo deseada se especifica mediante los pines spindle.__N__.orient-angle y spindle.__N__.orient-fwd, y se controla con los parámetros R y P de M19.

Se espera que la lógica de soporte HAL reaccione a spindle.__N__.orient moviendo el husillo a la posición deseada. Cuando esto se completa, se espera que la lógica HAL lo reconozca activando el pin spindle.__N__.is-oriented.

A continuación, motion reconoce esto desactivando el pin spindle.__N__.orient y activando el pin spindle.__N__.locked para indicar el modo orientación completa. También activa el pin spindle.__N__.brake. El husillo queda en modo orientación completa.

Si mientras que spindle.__N__.orient es verdadero, spindle.__N__.is-oriented no ha sido aun activado y el pin spindle.__N__.orient-fault tiene un valor diferente a cero, el comando M19 se cancela, se muestra un mensaje que incluye el código de fallo, y la cola de movimiento se vacía. El husillo vuelve a modo de rotación.

Además, cualquiera de los comandos M3, M4 o M5 cancela los modos de búsqueda de orientación deseada u orientación completa. Esto queda indicado al desactivar los pines spindle-orient y spindle-locked.

El pin spindle-orient-mode refleja la palabra P M19 y debe ser interpretado de la siguiente manera:

  • 0: girar en sentido horario o antihorario, el que obtenga el movimiento angular más pequeño

  • 1: girar siempre en el sentido horario

  • 2: girar siempre en sentido antihorario

Se puede usar con el componente HAL orient que proporciona un PID basado en la posición del codificador del husillo, spindle-orient-angle y spindle-orient-mode.

3. Pines y parámetros de ejes y articulaciones

Estos pines y parámetros son creados por el modulo motmod en tiempo real. [En las máquinas de cinemática trivial, hay una correspondencia uno-a-uno entre articulaciones y ejes.] Son leídos y actualizados por la función motion-controller.

Consulte la página del manual motion(9) para obtener detalles sobre los pines y parámetros.

4. iocontrol

iocontrol - acepta comandos de E/S en tiempo no-real mediante NML, interactúa con HAL.

Los pines HAL de iocontrol se activan y desactivan en un contexto de tiempo no-real. Si tiene requisitos de tiempo estrictos o simplemente necesita más E/S, considere usar en su lugar la E/S sincronizada de tiempo real proporcionada por motion.

4.1. Pines

  • 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. Configuraciones de INI

Muchas configuraciones INI están disponibles como pines HAL de entrada.

5.1. Pines

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
Los pines min_limit y max_limit por eje se respetan continuamente después de homing. Los pines ferror y min_ferror por eje se respetan cuando la máquina está encendida y no en posición. Los pines max_velocity y max_acceleration por eje se muestrean cuando la máquina está encendida y motion_state es libre (homing o trote) pero no son muestreados cuando se está ejecutando un programa (modo automático) o en modo mdi. Por consiguiente, cambiar los valores de pin cuando un programa se está ejecutando no tendrá efecto hasta el programa se detiene y motion_state vuelve a estar libre.
  • 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
Los pines traj_arc_blend se muestrean continuamente, pero cambiar los valores de pin mientras se ejecuta un programa puede no tener efecto inmediato debido a la cola de comandos.
  • 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

Pines de planificación de trayectoria de curva S (muestreados continuamente, pueden cambiar en tiempo de ejecución):

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

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

Pines de límite de sacudida por eje (donde L es x, y, z, a, b, c, u, v o w):

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

Pines de límite de sacudida por articulación (donde N es el número de articulación 0-8):

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