See also the man pages motion(9).
1. Motion
These pins and parameters are created by the realtime motmod module.
Этот модуль предоставляет интерфейс HAL для планировщика движения LinuxCNC.
По сути, motmod принимает список путевых точек и генерирует хорошо смешанный и ограниченный поток положений сочленений для подачи на приводы двигателей.
Дополнительно количество цифровых входов/выходов устанавливается с помощью num_dio. Количество аналоговых входов/выходов устанавливается с помощью num_aio, по умолчанию 4 для каждого. Количество шпинделей задается с помощью num_spindles, по умолчанию 1.
Имена контактов и параметров, начинающиеся с axis.L и joint.N, считываются и обновляются функцией контроллера движения.
Движение загружается командой motmod. Кинематики должны быть загружены перед движением.
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 - период потока Base в наносекундах. Это самый быстрый поток в станке.
|
Note
|
В системах на основе сервоприводов обычно нет причин для того, чтобы «base_period_nsec» был меньше, чем «servo_period_nsec». На станках с программной генерацией импульсов «base_period_nsec» определяет максимальное количество импульсов в секунду. При отсутствии требований к длине длительности импульса и длительности паузы абсолютная максимальная скорость импульса составляет один импульс за base_period_nsec. Таким образом, «base_period_nsec», показанный выше, дает абсолютную максимальную скорость импульсов 20 000 импульсов в секунду. 50 000 нс (50 мкс) — довольно консервативное значение. Наименьшее используемое значение связано с результатом Latency Test, необходимой длиной импульса и скоростью процессора. Выбор слишком малого значения «base_period_nsec» может привести к появлению сообщения «Неожиданная задержка в реальном времени», зависаниям или самопроизвольным перезагрузкам. |
-
servo_period_nsec = 1000000 — это период задачи Servo в наносекундах. Это значение будет округлено до целого числа, кратного base_period_nsec. Этот период используется даже в системах на основе шаговых двигателей.
Это скорость, с которой вычисляются новые положения двигателя, проверяется ошибка рассогласования, обновляются выходные значения ПИД-регулятора и т. д. В большинстве систем нет необходимости изменять это значение. Это частота обновления низкоуровневого планировщика движения.
-
traj_period_nsec = 100000 - это период задачи Планировщик траектории в наносекундах. Это значение будет округлено до целого числа, кратного servo_period_nsec. За исключением станков с необычной кинематикой (например, гексаподы), нет причин делать это значение больше, чем servo_period_nsec.
1.1. Варианты
Если количество необходимых цифровых входов/выходов превышает установленное по умолчанию 4, вы можете добавить до 64 цифровых входов/выходов, используя опцию num_dio при загрузке motmod.
Если количество необходимых аналоговых входов/выходов больше, чем 4 по умолчанию, вы можете добавить до 16 аналоговых входов/выходов, используя опцию num_aio при загрузке motmod.
Параметр unlock_joints_mask используется для создания контактов для сочленения, используемого в качестве индексатора блокировки (обычно поворотного). Биты маски выбирают сочленение(я). Младший бит маски выбирает сочленение 0. Пример:
unlock_joints_mask=0x38 выбирает сочленения 3,4,5
1.2. Контакты
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: холостой ход (нет движения)
-
1: Traverse
-
2: Linear feed
-
3: Arc feed
-
4: Tool change
-
5: Probing
-
6: Rotary axis indexing
-
-
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. Параметры
Многие из этих параметров служат в качестве вспомогательных средств отладки и подлежат изменению или удалению в любое время.
-
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. Функции
Обычно обе эти функции добавляются в сервопоток в указанном порядке.
-
motion-command-handler - Получает и обрабатывает команды движения
-
motion-controller - Запускает контроллер движения LinuxCNC
2. Spindle
LinuxCNC может осуществлять управление до восьми шпинделей. Модуль движения создаст следующие контакты: N (целое число от 0 до 7) заменяет номер шпинделя.
2.1. Контакты
-
spindle.N.at-speed - (bool, in) Motion will pause until this pin is TRUE, under the following conditions:
-
перед первым ходом подачи после каждого запуска шпинделя или изменения скорости;
-
перед началом каждой цепочки синхронизированных со шпинделем ходов;
-
и если в режиме CSS, то при каждом быстром переходе на подачу. Этот ввод можно использовать, чтобы убедиться, что шпиндель набрал нужную скорость перед началом резки или что шпиндель токарного станка в режиме CSS замедлился после прохода снятия от большого к малому перед началом следующего прохода на большем диаметре. Многие VFD имеют выход at speed. В противном случае этот сигнал легко сгенерировать с помощью компонента HAL near, сравнивая запрашиваемую и фактическую скорость шпинделя.
-
-
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.
Концептуально шпиндель находится в одном из следующих режимов:
-
режим вращения (по умолчанию)
-
поиск нужного режима ориентации
-
режим завершения ориентации.
Когда выполняется M19, шпиндель переключается на поиск желаемой ориентации, и подключается контакт HAL spindle.__N__.orient. Желаемая целевая позиция задается контактами spindle.__N__.orient-angle и spindle.__N__.orient-fwd и управляется параметрами M19 R и P.
Ожидается, что логика поддержки HAL будет реагировать на spindle.__N__.orient, перемещая шпиндель в желаемое положение. Когда это будет завершено, ожидается, что логика HAL подтвердит это, установив активным вывод spindle.__N__.is-ориентированный.
Затем Motion подтверждает это, делая неактивным контакт spindle.__N__.orient и делая активным контакт spindle.__N__.locked, чтобы показать режим orientation complete. Он также делает активным контакт spindle.__N__.brake. Шпиндель теперь находится в режиме orientation complete.
Если, пока spindle.__N__.orient является true, а spindle.__N__.is-oriented еще не установлен активным, контакт spindle.__N__.orient-fault имеет значение, отличное от нуля, команда M19 прерывается, отображается сообщение, включающее код неисправности, и очередь движений очищается. Шпиндель возвращается в режим вращения.
Кроме того, любая из команд M3, M4 или M5 отменяет режим поиска нужной ориентации или ориентация завершена. На это указывает отключение контактов spindle-orient и spindle-locked.
Контакт spindle-orient-mode отражает слово M19 P и интерпретируется следующим образом:
-
0: вращение по часовой стрелке или против часовой стрелки для наименьшего углового перемещения
-
1: всегда вращать по часовой стрелке
-
2: всегда вращать против часовой стрелки
Его можно использовать с компонентом HAL orient, который предоставляет значение команды PID на основе положения энкодера шпинделя, угла ориентации шпинделя и режима ориентации шпинделя.
3. Контакты осей и сочленений и параметры
Эти контакты и параметры создаются модулем реального времени motmod. [В станках с trivial kinematics между сочленениями и осями существует соответствие один-к-одному.] Они считываются и обновляются функцией motion-controller.
Подробную информацию о контактах и параметрах см. на странице руководства по движению «motion(9)».
4. iocontrol
iocontrol - принимает команды ввода-вывода не в реальном времени через NML, взаимодействует с HAL.
Контакты HAL iocontrol включаются и выключаются не в режиме реального времени. Если у вас строгие требования к синхронизации или вам просто нужно больше операций ввода-вывода, рассмотрите возможность использования вместо этого синхронизированного ввода-вывода в реальном времени, предоставляемого motion.
4.1. Контакты
-
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
Ряд настроек INI доступен как входные контакты HAL.
5.1. Контакты
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
|
Контакты min_limit и max_limit для каждой оси учитываются постоянно после возврата в исходное положение. Выводы ferror и min_ferror по каждой оси учитываются, когда станок включен и не находится в нужном положении. Контакты max_velocity и max_acceleration для каждой оси сэмплируются, когда станок включен и motion_state свободен (возврат в исходное положение или медленная подача), но не выбираются во время работы программы (автоматический режим) или в режиме MDI. Следовательно, изменение значений контактов во время работы программы не будет иметь эффекта до тех пор, пока программа не будет остановлена и motion_state снова не станет свободным. |
-
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
|
Выборка контактов traj_arc_blend происходит непрерывно, но изменение значений контактов во время работы программы может не иметь немедленного эффекта из-за очереди команд. |
-
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-curve trajectory planning pins (sampled continuously, can be changed at runtime):
-
ini.traj_planner_type - (sint, in) [TRAJ]PLANNER_TYPE
-
ini.traj_max_jerk - (real, in) [TRAJ]MAX_LINEAR_JERK
Per-axis jerk limit pins (where L is x, y, z, a, b, c, u, v, or w):
-
ini.L.max_jerk - (real, in) [AXIS__L_]MAX_JERK
Per-joint jerk limit pins (where N is the joint number 0-8):
-
ini.N.max_jerk - (real, in) [JOINT__N_]MAX_JERK