MOTION

NAME
SYNOPSIS
DESCRIPTION
AXIS PINS
JOINT PINS
UNLOCK PINS
DEBUGGING PINS
MOTION PINS
PARAMETERS
FUNCTIONS
BUGS
SEE ALSO

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-9]] [num_dio=[1-64]] [num_aio=[1-64]] [unlock_joints_mask=jointmask]

The maximum number of joints available is set by EMCMOT_MAX_JOINTS. The maximum number of digital inputs is set by EMCMOT_MAX_DIO. The maximum number of analog inputs is set by EMCMOT_MAX_AIO.

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.

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.

AXIS PINS

(L is the axis letter, one of: X Y Z A B C U V W)
axis.
L.jog-counts IN S32

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

axis.L.jog-enable IN BIT

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

axis.L.jog-scale IN FLOAT

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

axis.L.jog-vel-mode IN BIT

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.

axis.L.pos-cmd OUT FLOAT

The axis commanded position. There may be several offsets between the axis and motor coordinates: backlash compensation, screw error compensation, and home offsets.

axis.L.kb-jog-active OUT BIT

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

axis.L.teleop-pos-cmd OUT FLOAT
axis.
L.teleop-tp-enable OUT BIT

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

axis.L.teleop-vel-lim OUT FLOAT

The velocity limit for the teleop planner

axis.N.teleop-vel-cmd OUT FLOAT

The axis’s commanded velocity

axis.L.wheel-jog-active OUT BIT

JOINT PINS

(N is the joint number (0 ... num_joints-1))
joint.
N.amp-enable-out OUT BIT

TRUE if the amplifier for this joint should be enabled

joint.N.amp-fault-in IN BIT

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

joint.N.home-sw-in IN BIT

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

joint.N.homing OUT BIT

TRUE if the joint is currently homing

joint.N.index-enable IO BIT

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

joint.N.is-unlocked IN BIT

If the axis is a locked rotary the unlocked sensor should be connected to this pin

joint.N.jog-counts IN S32

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

joint.N.jog-enable IN BIT

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

joint.N.jog-scale IN FLOAT

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

joint.N.jog-vel-mode IN BIT

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.

joint.N.joint-pos-cmd OUT FLOAT

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.

joint.N.joint-pos-fb OUT FLOAT

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

joint.N.motor-pos-cmd OUT FLOAT

The commanded position for this joint.

joint.N.motor-pos-fb IN FLOAT

The actual position for this joint.

joint.N.neg-lim-sw-in IN BIT

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

joint.N.pos-lim-sw-in IN BIT

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

joint.N.unlock OUT BIT

TRUE if the axis is a locked rotary and a move is commanded.

motion.adaptive-feed IN FLOAT

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.

motion.analog-in-NN IN FLOAT

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

motion.analog-out-NN OUT FLOAT

These pins are used by M67-68.

motion.coord-error OUT BIT

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

motion.coord-mode OUT BIT

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

motion.current-vel OUT FLOAT

Current cartesian velocity

motion.digital-in-NN IN BIT

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

motion.digital-out-NN OUT BIT

These pins are controlled by the M62 through M65 words.

motion.distance-to-go OUT FLOAT

Distance remaining in the current move

motion.homing-inhibit IN BIT

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.

motion.enable IN BIT

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.

motion.feed-hold IN BIT

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

motion.feed-inhibit IN BIT

When this pin is TRUE, machine motion is inhibited (this includes jogs, programmed feeds, and programmed rapids, aka traverse moves).

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.

motion.in-position OUT BIT

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

motion.probe-input IN BIT

G38.x 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 OUT S32
motion.requested-vel
OUT FLOAT

The requested velocity with no adjustments for feed override

motion.spindle-at-speed IN BIT

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.

motion.spindle-brake OUT BIT

TRUE when the spindle brake should be applied

motion.spindle-forward OUT BIT

TRUE when the spindle should rotate forward

motion.spindle-index-enable I/O BIT

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

motion.spindle-inhibit IN BIT

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

motion.spindle-on OUT BIT

TRUE when spindle should rotate

motion.spindle-reverse OUT BIT

TRUE when the spindle should rotate backward

motion.spindle-revs IN FLOAT

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

motion.spindle-speed-in IN FLOAT

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

motion.spindle-speed-out OUT FLOAT

Desired spindle speed in rotations per minute

motion.spindle-speed-out-abs OUT FLOAT

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

motion.spindle-speed-out-rps OUT float

Desired spindle speed in rotations per second

motion.spindle-speed-out-rps-abs OUT float

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

motion.spindle-orient-angle OUT FLOAT

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

motion.spindle-orient-mode OUT BIT

Desired spindle rotation mode. Reflects M19 P parameter word.

motion.spindle-orient OUT BIT

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.

motion.spindle-is-oriented IN BIT

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.

motion.spindle-orient-fault IN S32

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

motion.spindle-locked OUT BIT

Spindle orient complete pin. Cleared by any of M3,M4,M5.

motion.teleop-mode OUT bit
motion.tooloffset.x
OUT FLOAT
motion.tooloffset.y
OUT FLOAT
motion.tooloffset.z
OUT FLOAT
motion.tooloffset.a
OUT FLOAT
motion.tooloffset.b
OUT FLOAT
motion.tooloffset.c
OUT FLOAT
motion.tooloffset.u
OUT FLOAT
motion.tooloffset.v
OUT FLOAT
motion.tooloffset.w
OUT FLOAT

Current tool offset in all 9 axes.

UNLOCK PINS

The pins for unlocking a joint are enabled with 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, ...
Example: loadrt motmod ... unlock_joints_mask=0x38 creates unlock pins
for joints 3,4,5
joint.N.unlock
OUT BIT
joint.N.is-unlocked
IN BIT

DEBUGGING PINS

Many of the pins below serve as debugging aids, and are subject to change or removal at any time.
joint.
N.active OUT BIT

TRUE when this joint is active

joint.N.backlash-corr OUT FLOAT

Backlash or screw compensation raw value

joint.N.backlash-filt OUT FLOAT

Backlash or screw compensation filtered value (respecting motion limits)

joint.N.backlash-vel OUT FLOAT

Backlash or screw compensation velocity

joint.N.coarse-pos-cmd OUT FLOAT
joint.
N.error OUT BIT

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

joint.N.f-error OUT FLOAT

The actual following error

joint.N.f-error-lim OUT FLOAT

The following error limit

joint.N.f-errored OUT BIT

TRUE when this joint has exceeded the following error limit

joint.N.faulted OUT BIT
joint.
N.free-pos-cmd OUT FLOAT

The "free planner" commanded position for this joint.

joint.N.free-tp-enable OUT BIT

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

joint.N.free-vel-lim OUT FLOAT

The velocity limit for the free planner

joint.N.homed OUT BIT

TRUE if the joint has been homed

joint.N.home-state OUT S32

homing state machine state

joint.N.in-position OUT BIT

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

joint.N.joint-vel-cmd OUT FLOAT

The joint’s commanded velocity

joint.N.kb-jog-active OUT BIT

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

joint.N.neg-hard-limit OUT BIT

The negative hard limit for the joint

joint.N.pos-hard-limit OUT BIT

The positive hard limit for the joint

joint.N.wheel-jog-active OUT BIT

MOTION PINS

motion.motion-enabled OUT BIT
motion.motion-type
OUT S32

These values are from src/emc/nml_intf/motion_types.h

1: Traverse

2: Linear feed

3: Arc feed

4: Tool change

5: Probing

6: Rotary FIXME joint indexing

motion.on-soft-limit OUT BIT
motion.program-line
OUT S32
motion.teleop-mode
OUT BIT

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

motion.spindle-is-oriented OUT S32
motion-command-handler.time
motion-controller.time

PARAMETERS

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

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

motion-command-handler.tmax-increased
motion-controller.tmax

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

motion-controller.tmax-increased
motion.debug-
*

These values are used for debugging purposes.

motion.servo.last-period

The number of CPU cycles 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

FUNCTIONS

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

Processes motion commands coming from user space

motion-controller

Runs the LinuxCNC motion controller

BUGS

This manual page is horribly incomplete.

SEE ALSO

iocontrol(1)