.TH MOTION "9" "2007-08-25" "LinuxCNC Documentation" "HAL Component" .de TQ .br .ns .TP \\$1 .. .SH NAME motion \- accepts NML motion commands, interacts with HAL in realtime .SH SYNOPSIS \fBloadrt motmod [base_period_nsec=\fIperiod\fB] [base_thread_fp=\fI0 or 1\fB] [servo_period_nsec=\fIperiod\fB] [traj_period_nsec=\fIperiod\fB] [num_joints=\fI[0-9]\fB] ([num_dio=\fI[1-64]\fB] [num_aio=\fI[1-16]\fB]) .SH DESCRIPTION By default, the base thread does not support floating point. Software stepping, software encoder counting, and software pwm do not use floating point. \fBbase_thread_fp\fR can be used to enable floating point in the base thread (for example for brushless DC motor control). .P These pins and parameters are created by the realtime \fBmotmod\fR module. This module provides a HAL interface for LinuxCNC's motion planner. Basically \fBmotmod\fR 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. .P 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. .P Pin names starting with "\fBaxis\fR" are actually joint values, but the pins and parameters are still called "\fBaxis.\fIN\fR". They are read and updated by the motion-controller function. .SH PINS .TP \fBaxis.\fIN\fB.amp-enable-out\fR OUT BIT TRUE if the amplifier for this joint should be enabled .TP \fBaxis.\fIN\fB.amp-fault-in\fR IN BIT Should be driven TRUE if an external fault is detected with the amplifier for this joint .TP \fBaxis.\fIN\fB.home-sw-in\fR IN BIT Should be driven TRUE if the home switch for this joint is closed .TP \fBaxis.\fIN\fB.homing\fR OUT BIT TRUE if the joint is currently homing .TP \fBaxis.\fIN\fB.index-enable\fR IO BIT Should be attached to the index-enable pin of the joint's encoder to enable homing to index pulse .TP \fBaxis.\fIN\fB.is-unlocked\fR IN BIT If the axis is a locked rotary the unlocked sensor should be connected to this pin .TP \fBaxis.\fIN\fB.jog-counts\fR IN S32 Connect to the "counts" pin of an external encoder to use a physical jog wheel. .TP \fBaxis.\fIN\fB.jog-enable\fR IN BIT When TRUE (and in manual mode), any change to "jog-counts" will result in motion. When false, "jog-counts" is ignored. .TP \fBaxis.\fIN\fB.jog-scale\fR IN FLOAT Sets the distance moved for each count on "jog-counts", in machine units. .TP \fBaxis.\fIN\fB.jog-vel-mode\fR 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. .TP \fBaxis.\fIN\fB.joint-pos-cmd\fR 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. .TP \fBaxis.\fIN\fB.joint-pos-fb\fR OUT FLOAT The joint feedback position. This value is computed from the actual motor position minus joint offsets. Useful for machine visualization. .TP \fBaxis.\fIN\fB.motor-pos-cmd\fR OUT FLOAT The commanded position for this joint. .TP \fBaxis.\fIN\fB.motor-pos-fb\fR IN FLOAT The actual position for this joint. .TP \fBaxis.\fIN\fB.neg-lim-sw-in\fR IN BIT Should be driven TRUE if the negative limit switch for this joint is tripped. .TP \fBaxis.\fIN\fB.pos-lim-sw-in\fR IN BIT Should be driven TRUE if the positive limit switch for this joint is tripped. .TP \fBaxis.\fIN\fB.unlock\fR OUT BIT TRUE if the axis is a locked rotary and a move is commanded. .TP \fBmotion.adaptive-feed\fR 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. .TP \fBmotion.analog-in-\fINN\fR IN FLOAT These pins are used by M66 Enn wait-for-input mode. .TP \fBmotion.analog-out-\fINN\fR OUT FLOAT These pins are used by M67-68. .TP \fBmotion.coord-error\fR OUT BIT TRUE when motion has encountered an error, such as exceeding a soft limit .TP \fBmotion.coord-mode\fR OUT BIT TRUE when motion is in "coordinated mode", as opposed to "teleop mode" .TP \fBmotion.current-vel\fR OUT FLOAT Current cartesian velocity .TP \fBmotion.digital-in-\fINN\fR IN BIT These pins are used by M66 Pnn wait-for-input mode. .TP \fBmotion.digital-out-\fINN\fR OUT BIT These pins are controlled by the M62 through M65 words. .TP \fBmotion.distance-to-go\fR OUT FLOAT Distance remaining in the current move .TP \fBmotion.enable\fR 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. .TP \fBmotion.feed-hold\fR IN BIT When Feed Stop Control is enabled with M53 P1, and this bit is TRUE, the feed rate is set to 0. .TP \fBmotion.feed-inhibit\fR IN BIT When this bit is TRUE, the feed rate is set and held to 0. This will be delayed during spindle synch moves till the end of the move. .TP \fBmotion.in-position\fR OUT BIT TRUE if the machine is in position (ie, not currently moving towards the commanded position). .TP \fBmotion.probe-input\fR 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. .TP \fBmotion.program-line\fR OUT S32 .TP \fBmotion.requested-vel\fR OUT FLOAT The requested velocity with no adjustments for feed override .TP \fBmotion.spindle-at-speed\fR 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. .TP \fBmotion.spindle-brake\fR OUT BIT TRUE when the spindle brake should be applied .TP \fBmotion.spindle-forward\fR OUT BIT TRUE when the spindle should rotate forward .TP \fBmotion.spindle-index-enable\fR I/O BIT For correct operation of spindle synchronized moves, this signal must be hooked to the index-enable pin of the spindle encoder. .TP \fBmotion.spindle-inhibit\fR IN BIT When TRUE, the spindle speed is set and held to 0. .TP \fBmotion.spindle-on\fR OUT BIT TRUE when spindle should rotate .TP \fBmotion.spindle-reverse\fR OUT BIT TRUE when the spindle should rotate backward .TP \fBmotion.spindle-revs\fR IN FLOAT For correct operation of spindle synchronized moves, this signal must be hooked to the position pin of the spindle encoder. .TP \fBmotion.spindle-speed-in\fR IN FLOAT Actual spindle speed feedback in revolutions per second; used for G96 (constant surface speed) and G95 (feed per revolution) modes. .TP \fBmotion.spindle-speed-out\fR OUT FLOAT Desired spindle speed in rotations per minute .TP \fBmotion.spindle-speed-out-abs\fR OUT FLOAT Desired spindle speed in rotations per minute, always positive regardless of spindle direction. .TP \fBmotion.spindle-speed-out-rps\fR OUT float Desired spindle speed in rotations per second .TP \fBmotion.spindle-speed-out-rps-abs\fR OUT float Desired spindle speed in rotations per second, always positive regardless of spindle direction. .TP \fBmotion.spindle-orient-angle\fR OUT FLOAT Desired spindle orientation for M19. Value of the M19 R word parameter plus the value of the [RS274NGC]ORIENT_OFFSET ini parameter. .TP \fBmotion.spindle-orient-mode\fR OUT BIT Desired spindle rotation mode. Reflects M19 P parameter word. .TP \fBmotion.spindle-orient\fR 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. .TP \fBmotion.spindle-is-oriented\fR 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. .TP \fBmotion.spindle-orient-fault\fR IN S32 Fault code input for orient cycle. Any value other than zero will cause the orient cycle to abort. .TP \fBmotion.spindle-locked\fR OUT BIT Spindle orient complete pin. Cleared by any of M3,M4,M5. .TP \fBmotion.teleop-mode\fR OUT bit .TP \fBmotion.tooloffset.x\fR OUT FLOAT .TQ \fBmotion.tooloffset.y\fR OUT FLOAT .TQ \fBmotion.tooloffset.z\fR OUT FLOAT .TQ \fBmotion.tooloffset.a\fR OUT FLOAT .TQ \fBmotion.tooloffset.b\fR OUT FLOAT .TQ \fBmotion.tooloffset.c\fR OUT FLOAT .TQ \fBmotion.tooloffset.u\fR OUT FLOAT .TQ \fBmotion.tooloffset.v\fR OUT FLOAT .TQ \fBmotion.tooloffset.w\fR OUT FLOAT Current tool offset in all 9 axes. .SH DEBUGGING PINS Many of the pins below serve as debugging aids, and are subject to change or removal at any time. .TP \fBaxis.\fIN\fB.active\fR OUT BIT TRUE when this joint is active .TP \fBaxis.\fIN\fB.backlash-corr\fR OUT FLOAT Backlash or screw compensation raw value .TP \fBaxis.\fIN\fB.backlash-filt\fR OUT FLOAT Backlash or screw compensation filtered value (respecting motion limits) .TP \fBaxis.\fIN\fB.backlash-vel\fR OUT FLOAT Backlash or screw compensation velocity .TP \fBaxis.\fIN\fB.coarse-pos-cmd\fR OUT FLOAT .TP \fBaxis.\fIN\fB.error\fR OUT BIT TRUE when this joint has encountered an error, such as a limit switch closing .TP \fBaxis.\fIN\fB.f-error\fR OUT FLOAT The actual following error .TP \fBaxis.\fIN\fB.f-error-lim\fR OUT FLOAT The following error limit .TP \fBaxis.\fIN\fB.f-errored\fR OUT BIT TRUE when this joint has exceeded the following error limit .TP \fBaxis.\fIN\fB.faulted\fR OUT BIT .TP \fBaxis.\fIN\fB.free-pos-cmd\fR OUT FLOAT The "free planner" commanded position for this joint. .TP \fBaxis.\fIN\fB.free-tp-enable\fR OUT BIT TRUE when the "free planner" is enabled for this joint .TP \fBaxis.\fIN\fB.free-vel-lim\fR OUT FLOAT The velocity limit for the free planner .TP \fBaxis.\fIN\fB.homed\fR OUT BIT TRUE if the joint has been homed .TP \fBaxis.\fIN\fB.in-position\fR OUT BIT TRUE if the joint is using the "free planner" and has come to a stop .TP \fBaxis.\fIN\fB.joint-vel-cmd\fR OUT FLOAT The joint's commanded velocity .TP \fBaxis.\fIN\fB.kb-jog-active\fR OUT BIT .TP \fBaxis.\fIN\fB.neg-hard-limit\fR OUT BIT The negative hard limit for the joint .TP \fBaxis.\fIN\fB.pos-hard-limit\fR OUT BIT The positive hard limit for the joint .TP \fBaxis.\fIN\fB.wheel-jog-active\fR OUT BIT .TP \fBmotion.motion-enabled\fR OUT BIT .TP \fBmotion.motion-type\fR OUT S32 These values are from src/emc/kinematics/tc.h .RS .RS .TP 1: Linear move .P 2: Arc move .P 3: Rigid tap move .RE .RE .TP \fBmotion.on-soft-limit\fR OUT BIT .TP \fBmotion.program-line\fR OUT S32 .TP \fBmotion.teleop-mode\fR OUT BIT TRUE when motion is in "teleop mode", as opposed to "coordinated mode" .SH PARAMETERS Many of the parameters serve as debugging aids, and are subject to change or removal at any time. .TP \fBmotion-command-handler.time\fR .TQ \fBmotion-command-handler.tmax\fR .TQ \fBmotion-controller.time\fR .TQ \fBmotion-controller.tmax\fR Show information about the execution time of these HAL functions in CPU cycles .TP \fBmotion.debug-\fI*\fR These values are used for debugging purposes. .TP \fBmotion.servo.last-period\fR 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 .TP \fBmotion.servo.overruns\fR By noting large differences between successive values of motion.servo.last-period, the motion controller can determine that there has probably been a failure to meet its timing constraints. Each time such a failure is detected, this value is incremented. .SH FUNCTIONS Generally, these functions are both added to the servo-thread in the order shown. .TP \fBmotion-command-handler\fR Processes motion commands coming from user space .TP \fBmotion-controller\fR Runs the LinuxCNC motion controller .SH BUGS This manual page is horribly incomplete. .SH SEE ALSO iocontrol(1)