summaryrefslogtreecommitdiff
path: root/docs/man/man9/encoder_ratio.9
blob: 9e31fe68324913cc1545d5bfad7610114e3736d9 (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

.TH ENCODER_RATIO "9" "2007-01-16" "LinuxCNC Documentation" "HAL Component"
.de TQ
.br
.ns
.TP \\$1
..

.SH NAME
encoder_ratio \- an electronic gear to synchronize two axes
.SH SYNOPSIS
\fBloadrt encoder_ratio [num_chan=\fInum\fB | names=\fIname1\fB[,\fIname2...\fB]]

.SH DESCRIPTION
\fBencoder_ratio\fR can be used to synchronize two axes (like an "electronic
gear").  It counts encoder pulses from both axes in software, and produces an
error value that can be used with a PID loop to make the slave encoder track
the master encoder with a specific ratio.

This module supports up to eight axis pairs.  The number of pairs is set by the
module parameter \fBnum_chan\fR.  Alternatively, specify \fBnames=\fR and unique names
separated by commas.
.P
The \fBnum_chan=\fR and \fBnames=\fR specifiers are mutually exclusive.
If neither \fBnum_chan=\fR nor \fBnames=\fR are specified, the default value is one.


.SH FUNCTIONS
.TP
.B encoder-ratio.sample
Read all input pins.  Must be called at twice the maximum desired count rate.
.TP
.B encoder-ratio.update (uses floating-point)
Updates all output pins.  May be called from a slower thread.

.SH NAMING
The names for pins and parameters are prefixed as:
  \fBencoder-ratio.N.\fR for N=0,1,...,num-1 when using \fBnum_chan=num\fR
  \fBnameN.\fR for nameN=name1,name2,... when using \fBnames=name1,name2,...\fR

The \fBencoder-ratio.N.\fR format is shown in the following descriptions.

.SH PINS

.TP
.B encoder-ratio.\fIN\fB.master-A\fR bit in
.TQ
.B encoder-ratio.\fIN\fB.master-B\fR bit in
.TQ
.B encoder-ratio.\fIN\fB.slave-A\fR bit in
.TQ
.B encoder-ratio.\fIN\fB.slave-B\fR bit in
The encoder channels of the master and slave axes
.TP
.B encoder-ratio.\fIN\fB.enable\fR bit in
When the enable pin is FALSE, the error pin simply reports the slave axis
position, in revolutions.  As such, it would normally be connected to the
feedback pin of a PID block for closed loop control of the slave axis.
Normally the command input of the PID block is left unconnected (zero), so the
slave axis simply sits still.  However when the enable input goes TRUE, the
error pin becomes the slave position minus the scaled master position.  The
scale factor is the ratio of master teeth to slave teeth.  As the master moves,
error becomes non-zero, and the PID loop will drive the slave axis to track the
master.  
.TP
.B encoder-ratio.\fIN\fB.error\fR float out
The error in the position of the slave (in revolutions)
.SH PARAMETERS
.TP
.B encoder-ratio.N.master-ppr\fR unsigned rw
.TQ
.B encoder-ratio.N.slave-ppr\fR unsigned rw
The number of pulses per revolution of the master and slave axes
.TP
.B encoder-ratio.N.master-teeth\fR unsigned rw
.TQ
.B encoder-ratio.N.slave-teeth\fR unsigned rw
The number of "teeth" on the master and slave gears.

.SH SEE ALSO
\fBencoder(9)\fR