Scroll to navigation

MOTION(9) HAL Component MOTION(9)

NAME

motion - accepts NML motion commands, interacts with HAL in realtime

SYNOPSIS

loadrt motmod [base_period_nsec=period] [base_thread_fp=0 or 1] [servo_period_nsec=period] [traj_period_nsec=period] [num_joints=[1-16]] [num_dio=[1-64]] [num_aio=[1-64]] [num_misc_error=[0-64] | names_misc_errors] [num_spindles=[1-8]] [unlock_joints_mask=jointmask] [num_extrajoints=[0-16]]

The limits for the following items are compile-time settings:





This parameter is mutually exclusive with num_misc_error. If using num_misc_error the additional error input pins will have names like motion.misc-error-00 whereas names_misc_errors=overtemp,undertemp will create hal pins motion.err-overtemp and motion.err-undertemp

Optionally the number of Digital I/O is set with num_dio. The number of Analog I/O is set with num_aio. The default is 4 each.

Pin names starting with "joint" or "axis" are are read and updated by the motion-controller function.

DESCRIPTION

By default, the base thread does not support floating point. Software stepping, software encoder counting, and software pwm do not use floating point. base_thread_fp can be used to enable floating point in the base thread (for example for brushless DC motor control).

These pins and parameters are created by the realtime motmod module. This module provides a HAL interface for LinuxCNC's motion planner. Basically motmod takes in a list of waypoints and generates a nice blended and constraint-limited stream of joint positions to be fed to the motor drives.

The optional num_extrajoints parameter specifies a quantity of joints that participate in homing but are not used by kinematics transformations. After homing, control of an 'extra' joint is transferred to a posthome command HAL pin (joint.N.posthome-cmd) and the motor feedback value is ignored. 'Extra' joints must be managed by independent motion planners/controllers (typically using limit3 HAL components). Extra joints maybe unhomed only when motion is disabled.

The maximum num_extrajoints value is equal to the num_joints value. (Note that using the maximum value would allow no operation in world coordinates). The num_joints value must be equal to the sum of the number of joints used for kinematics calculations plus the number of 'extra' joints.

The num_joints parameter is conventionally set using the INI file setting [KINS]JOINTS=value. The num_extrajoints is set by the additional motmod parameter [EMCMOT]motmod num_extrajoints=value. Hal pin numbering for all joints is zero based [0 ... num_joints-1]. When specified, 'extra' joints are assigned the last num_extrajoints in the numbering sequence. For example, specifying [KINS]JOINTS=5 and [EMCMOT]motmod num_extrajoints=2 for a 3 joint trivkins configuration [KINS] KINEMATICS=trivkins coordinates=xyz uses joints 0,1,2 for the kinematic joints and joints 3,4 for the 'extra' joints.

MOTION PINS

Time (in CPU clocks) for the motion module motion-command-handler

Time (in CPU clocks) for the motion module motion-controller

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. Negative values are valid and will run the G-code path in reverse.

These pins are used by M66 Enn wait-for-input mode.

These pins are used by M67-68.

TRUE when motion has encountered an error, such as exceeding a soft limit

TRUE when motion is in "coordinated mode", as opposed to "teleop mode"

Current cartesian velocity

These pins are used by M66 Pnn wait-for-input mode.

These pins are controlled by the M62 through M65 words.

Distance remaining in the current move

If this bit 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 bit TRUE.

Indicates external offsets are active (non-zero)

Indicates motion with external offsets was limited by a soft limit constraint ([AXIS_L]MIN_LIMIT,MAX_LIMIT).

When Feed Stop Control is enabled with M53 P1, and this bit is TRUE, the feed rate is set to 0.

Note: feed-hold applies to G-code commands -- not jogs.

When this pin is TRUE, machine motion is inhibited for G-code commands.

If the machine is performing a spindle synchronized move when this pin goes TRUE, the spindle synchronized motion will finish, and any following moves will be inhibited (this is to prevent damage to the machine, the tool, or the work piece).

If the machine is in the middle of a (non-spindle synchronized) move when this pin goes TRUE, the machine will decelerate to a stop at the maximum allowed acceleration rate.

Motion resumes when this pin goes FALSE.

Note: feed-inhibit applies to G-code commands -- not jogs.

Current feed rate in G-code program units per minute for motion.motion-type feed(2) and arc(3). Value is the G-code program F value multiplied by the current feed override value and the motion.adaptive-feed setting (if M52 active). Value is zero if motion.feed-hold or motion.feed-inhibit are asserted. If units (G20 or G21) are not specified in the G-code file then units will be the last units used.

Current feed rate in inches per minute for motion.motion-type feed(2) and arc(3). Value is the inch equivalent of the G-code program F value multiplied by the current feed override value and the motion.adaptive-feed setting (if M52 active). Value is zero if motion.feed-hold or motion.feed-inhibit are asserted.

Current feed rate in inches per second for motion.motion-type feed(2) and arc(3). Value is the inch equivalent of the G-code program F value multiplied by the current feed override value and the motion.adaptive-feed setting (if M52 active). Value is zero if motion.feed-hold or motion.feed-inhibit are asserted.

Current feed rate in mm per minute for motion.motion-type feed(2) and arc(3). Value is the mm equivalent of the G-code program F value multiplied by the current feed override value and the motion.adaptive-feed setting (if M52 active). Value is zero if motion.feed-hold or motion.feed-inhibit are asserted.

Current feed rate in mm per second for motion.motion-type feed(2) and arc(3). Value is the mm equivalent of the G-code program F value multiplied by the current feed override value and the motion.adaptive-feed setting (if M52 active). Value is zero if motion.feed-hold or motion.feed-inhibit are asserted.

If this bit is TRUE, initiation of any joint homing move (including "Home All") is disallowed and an error is reported. By default, homing is allowed in joint mode whenever motion is enabled.

TRUE if all active joints is homed.

If this bit is TRUE, jogging of any joint or axis is disallowed and an error is reported.

If any jog is active when the pin state changes to TRUE then that jog will be stopped following the associated acceleration values.

If any jog is active when the pin state changes to TRUE then that jog will be stopped immediately.

TRUE if any joint or axis is jogging.

TRUE if the machine is in position (ie, not currently moving towards the commanded position).

Extra error inputs for faults such as over-temperature sensors, low coolant warnings, custom HAL component errors. If driven TRUE this will disable a machine. Similar to spindle.amp-fault-in.

These values are from src/emc/nml_intf/motion_types.h.
0: Idle (no motion)

1: Traverse

2: Linear feed

3: Arc feed

4: Tool change

5: Probing

6: Rotary unlock for traverse

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.

The current program line while executing. Zero if not running or between lines while single stepping.

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.

The number of CPU clocks between invocations of the servo thread. Typically, this number divided by the CPU speed gives the time in seconds, and can be used to determine whether the realtime motion controller is meeting its timing constraints

Kinematics modules that define the functions kinematicsSwitchable() and kinematicsSwitch() receive the integer value of this pin to select the machine kinematics functions. Extra G-code commands may be required to synchronize task and motion before and after changes to the pin value.

Motion mode is teleop (axis coordinate jogging available).

Current tool offset for each axis where (L is the axis letter, one of: x y z a b c u v w)

Trajectory planning is reversed (reverse run)

AXIS PINS

(L is the axis letter, one of: x y z a b c u v w)

Current external offset.

Clear external offset request

Counts input for external offset. The eoffset-counts are transferred to an internal register. The applied external offset is the product of the register counts and the eoffset-scale value. The register is reset to zero at each machine startup. If the machine is turned off with an external offset active, the eoffset-counts pin should be set to zero before restarting.

Enable for external offset (also requires INI file setting for [AXIS_L]OFFSET_AV_RATIO)

Debug pin for requested external offset.

Scale for external offset.

Sets acceleration for wheel jogging to a fraction of the INI max_acceleration for the axis. Values greater than 1 or less than zero are ignored.

Connect to the "counts" pin of an external encoder to use a physical jog wheel.

When TRUE (and in manual mode), any change to "jog-counts" will result in motion. When false, "jog-counts" is ignored.

Sets the distance moved for each count on "jog-counts", in machine units.

When FALSE (the default), the jogwheel operates in position mode. The axis will move exactly jog-scale units for each count, regardless of how long that might take. When TRUE, the wheel operates in velocity mode - motion stops when the wheel stops, even if that means the commanded motion is not completed.

(free planner axis jogging active (keyboard or halui))

The axis commanded position. There may be several offsets between the axis and motor coordinates: backlash compensation, screw error compensation, and home offsets. External offsets are reported separately (axis.L.eoffset).

TRUE when the "teleop planner" is enabled for this axis.

The axis's commanded velocity.

The velocity limit for the teleop planner.

JOINT PINS

N is the joint number (0 ... num_joints-1))

(Note: pins marked (DEBUG) serve as debugging aids and are subject to change or removal at any time.)

The joint's commanded acceleration.

TRUE when this joint is active.

TRUE if the amplifier for this joint should be enabled.

Should be driven TRUE if an external fault is detected with the amplifier for this joint.

Backlash or screw compensation raw value.

Backlash or screw compensation filtered value (respecting motion limits).

Backlash or screw compensation velocity.

TRUE when this joint has encountered an error, such as a limit switch closing.

The actual following error.

The following error limit.

TRUE when this joint has exceeded the following error limit.

The "free planner" commanded position for this joint.

TRUE when the "free planner" is enabled for this joint.

The velocity limit for the free planner.

homing state machine state

Should be driven TRUE if the home switch for this joint is closed.

TRUE if the joint has been homed.

TRUE if the joint is currently homing.

TRUE if the joint is using the "free planner" and has come to a stop.

Should be attached to the index-enable pin of the joint's encoder to enable homing to index pulse.

Indicates joint is unlocked (see JOINT UNLOCK PINS).

Sets acceleration for wheel jogging to a fraction of the INI max_acceleration for the joint. Values greater than 1 or less than zero are ignored.

Connect to the "counts" pin of an external encoder to use a physical jog wheel.

When TRUE (and in manual mode), any change to "jog-counts" will result in motion. When false, "jog-counts" is ignored.

Sets the distance moved for each count on "jog-counts", in machine units.

When FALSE (the default), the jogwheel operates in position mode. The joint will move exactly jog-scale units for each count, regardless of how long that might take. When TRUE, the wheel operates in velocity mode - motion stops when the wheel stops, even if that means the commanded motion is not completed.

(free planner joint jogging active (keyboard or halui))

joint motor offset established when joint is homed.

The commanded position for this joint.

The actual position for this joint.

The negative hard limit for the joint

Should be driven TRUE if the negative limit switch for this joint is tripped.

The joint (as opposed to motor) commanded position. There may be several offsets between the joint and motor coordinates: backlash compensation, screw error compensation, and home offsets.

The joint feedback position. This value is computed from the actual motor position minus joint offsets. Useful for machine visualization.

The positive hard limit for the joint.

Should be driven TRUE if the positive limit switch for this joint is tripped.

TRUE if the axis is a locked joint (typically a rotary) and a move is commanded (see JOINT UNLOCK PINS).

The joint's commanded velocity.

JOINT posthome pins

Each joint designated as an 'extra' joint is provided with a HAL pin joint.N.posthome-cmd. The pin value is ignored prior to homing. After homing, the pin value is augmented by the motor offset value and routed to the joint.N.motor-pos-cmd.

JOINT unlock pins

The joint pins used for unlocking a joint (joint.N.unlock, joint.N.is-unlocked), are created according to the unlock_joints_mask=jointmask parameter for motmod. These pins may be required for locking indexers (typically a rotary joint)

The jointmask bits are: (lsb)0:joint0, 1:joint1, 2:joint2, ...

SPINDLE PINS

(M is the spindle number (0 ... num_spindles-1))

Should be driven TRUE if an external fault is detected with the amplifier for this spindle.

Motion will pause until this pin is TRUE, under the following conditions: before the first feed move after each spindle start or speed change; before the start of every chain of spindle-synchronized moves; and if in CSS mode, at every rapid->feed transition.

TRUE when the spindle brake should be applied.

TRUE when the spindle should rotate forward.

For correct operation of spindle synchronized moves, this signal must be hooked to the index-enable pin of the spindle encoder.

When TRUE, the spindle speed is set and held to 0.

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 orient complete pin. Cleared by any of M3,M4,M5.

TRUE when spindle should rotate.

Indicates start of spindle orient cycle. Set by M19. Cleared by any of M3,M4,M5.

If spindle-orient-fault is not zero during spindle-orient true, the M19 command fails with an error message.

Desired spindle orientation for M19. Value of the M19 R word parameter plus the value of the [RS274NGC]ORIENT_OFFSET INI parameter.

Fault code input for orient cycle. Any value other than zero will cause the orient cycle to abort.

Desired spindle rotation mode. Reflects M19 P parameter word.

TRUE when the spindle should rotate backward.

For correct operation of spindle synchronized moves, this signal must be hooked to the position pin of the spindle encoder.

Commanded spindle speed in units of revolutions per second.

Actual spindle speed feedback in revolutions per second; used for G96 (constant surface speed) and G95 (feed per revolution) modes.

Desired spindle speed in rotations per minute.

Desired spindle speed in rotations per minute, always positive regardless of spindle direction.

Desired spindle speed in rotations per second.

Desired spindle speed in rotations per second, always positive regardless of spindle direction.

MOTION PARAMETERS

Many of the parameters serve as debugging aids, and are subject to change or removal at any time.

Show information about the execution time of these HAL functions in CPU clocks.

Show information about the execution time of these HAL functions in CPU clocks.

These values are used for debugging purposes.

FUNCTIONS

Generally, these functions are both added to the servo-thread in the order shown.

Receive and process incoming motion commands. The pin named motion-command-handler.time and parameters motion-command-handler.tmax,tmax-increasedare created for this function.

Runs the LinuxCNC motion controller. The pin named motion-controller.time and parameters motion-controller.tmax,tmax-increased are created for this function.

BUGS

This manual page is incomplete.

SEE ALSO

iocontrol(1), milltask(1), spindle(9)

LinuxCNC Documentation