summaryrefslogtreecommitdiff
path: root/docs/man/man9/motion.9
blob: 260ea44705d88d48abf689baf9d8be9bea08b87b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
.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)