See also the man pages motion(9).
1. Рух
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. Kins слід завантажити перед рухом.
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 мкс) є досить консервативним значенням. Найменше значення, яке можна використовувати, пов’язане з результатом тесту затримки, необхідною довжиною кроку та швидкістю процесора. Вибір занадто низького значення «base_period_nsec» може призвести до появи повідомлення «Несподівана затримка в реальному часі», блокування або спонтанного перезавантаження. |
-
servo_period_nsec = 1000000 - це період завдання «Серво» в наносекундах. Це значення буде округлено до цілого кратного «base_period_nsec». Цей період використовується навіть у системах на основі крокових двигунів.
Це швидкість, з якою обчислюються нові положення двигуна, перевіряється похибка, оновлюються вихідні значення PID тощо. Більшість систем не потребують зміни цього значення. Це швидкість оновлення планувальника руху низького рівня.
-
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 selects joints 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: Траверс
-
2: Лінійна подача
-
3: Подача дуги
-
4: Зміна інструменту
-
5: Зондування
-
6: Індексування обертової осі
-
-
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. Шпиндель
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-oriented.
Motion підтверджує це, скасовуючи сигнал на виводі spindle.__N__.orient і подаючи сигнал на виводі spindle.__N__.locked, щоб вказати режим «орієнтація завершена». Він також подає сигнал на виводі spindle.__N__.brake. Тепер шпиндель перебуває в режимі «орієнтація завершена».
Якщо під час виконання spindle.__N__.orient є істинним, а 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» у режимі реального часу. [У машинах з «тривіальною кінематикою» існує однозначна відповідність між шарнірами та осями.] Вони зчитуються та оновлюються функцією «motion-controller».
Дивіться сторінку довідки з руху motion(9) для отримання детальної інформації про виводи та параметри.
4. iControl
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
|
Значення виводів traje_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-подібної кривої (вибірка здійснюється безперервно, можна змінювати під час виконання):
-
ini.traj_planner_type - (sint, in) [TRAJ]PLANNER_TYPE
-
ini.traj_max_jerk - (real, in) [TRAJ]MAX_LINEAR_JERK
Штифти обмеження ривків на осі (де L is x, y, z, a, b, c, u, v, або w):
-
ini.L.max_jerk - (real, in) [AXIS__L_]MAX_JERK
Штифти обмеження ривка для кожного шарніра (де N – номер шарніра 0-8):
-
ini.N.max_jerk - (real, in) [JOINT__N_]MAX_JERK