Professional Documents
Culture Documents
net/publication/234065316
CITATIONS READS
41 896
1 author:
Silvano Balemi
University of Lugano
61 PUBLICATIONS 1,015 CITATIONS
SEE PROFILE
All content following this page was uploaded by Silvano Balemi on 28 November 2022.
AUTOMATIC CALIBRATION OF
SINUSOIDAL ENCODER SIGNALS
Silvano Balemi
Abstract: Precision positioning and manipulation systems often rely on data from
sensors delivering a sinusoidal signal pair. These signals can be interpolated to
provide a high resolution measurement.
The paper presents a novel method for removing signal differences and drifts by
automatic self-calibrating the sinusoidal signal pair. Then, manual calibration is
avoided and slow varying effects, like thermal drifts or imprecise sensor mounting,
can be effectively compensated.
The proposed method can be implemented on a DSP. It uses an on-line gradient
search to minimize a given performance index. c
Copyright °2005 IFAC
68
The paper first presents three different variations
¾
of a discrete-time, digital interpolation algorithm ´ cos(α̂)
´
which is inspired by an equivalent closed-loop sin(α)- l ´
+́
analog circuit. Then it recalls the Heydemann ×
correction method, an off-line parameter compen- @
@+
R je -
@ α̂
sation based on a least-square minimization. It -
filter
then proceeds with a variation of the Heydemann ¡
µ−
¡
correction, which is suitable for on-line use and cos(α)- ×l
¡
finally presents a new search method based on the
H
Y
HH
minimization of the residual compensation error.
H sin(α̂) ¾
69
denominator by choosing an appropriate filter Then, comparison of the desired closed-loop de-
numerator. In fact: nominator with the denominator of the closed-
Ncl (z) Nfilter (z) loop transfer function yields the coefficients
Gcl (z) = = (3)
Dcl (z) Nfilter (z) + Dfilter (z) p1 · p2 − p1 − p2 + 1
a=
ts
the comparison of the two denominators Dcl (z) b = p ·p 1 2
and Nfilter (z) + Dfilter (z) yields
Nfilter (z) = Dcl (z) − Dfilter (z) Note that the filter pole b is used to place the
closed-loop poles. Thus, the second filter pole
= z · (−p1 − p2 − c) + p1 · p2 − d cannot be freely chosen and it is impossible to
implement a filter of type 2.
The speed is computed by taking the derivative of
the position estimate, thus causing extra on-line
computational load (see Figure 4). 4.3 Method 3: Second order stage and integrator
z−1
1/ksincos 2 Finally, for the filter shown in Figure 2 a second
1
ts.z
v order realization is proposed with the structure
filter Derivator
sin
n(z)
shown in Figure 6.
1/ksincos 1
d(z)
2 x
cos 1/ksincos/ts 2
cos 1 v
angle filter
sin sin
a.z+b z
1/ksincos 1
z2−cz z−1
Fig. 4. Closed-loop interpolator with speed esti- 2
integr./ts
x
cos
mate from position derivative cos
angle
sin
70
5.1 Heydemann correction 5.2 Gradient search: correction of gains and offsets
A calibration method has been proposed by Hey- A first idea would be to use a gradient search giv-
demann (1981) (see also (Birch, 1990)). This cor- ing directly the correction parameters. Consider-
rection relies on a least-square estimate and on ing only the effect of gains and offset, equation (4)
the solution of a set of non-linear equations. reduces to
The measurements given by equation (4) can be yc,k = ac · cos αk + bc
rearranged as ys,k = as · sin αk + bs
1 −bc
· yc,k + = cos(αk ) This expression can be rewritten as
ac ac
1 −bs
· ys,k + = sin αk · cos β − cos αk · sin β θ1 · yc,k + θ2 = cos αk
as as θ3 · ys,k + θ4 = sin αk
After replacement of cos(αk ) in the second expres-
sion and introduction of the notation gc = 1/ac where θ1 = 1/ac , θ2 = −bc /ac , θ3 = 1/as and
and gs = 1/as the equations above can be rewrit- θ4 = −bs /as . The trigonometric equality used
ten as before can be rewritten as
gc · (yc,k − bc ) = cos(αk ) kM · Θk22 = 1
gs · (ys,k − bs ) + (gc (yc,k − bc ) · sin β
= sin(αk ) where Θ = [θ1 , θ2 , θ3 , θ4 ]0 and
cos β
µ ¶
yc,k 1 0 0
The equality sin2 α + cos2 α = 1 gives M= (6)
0 0 ys,k 1
θ1 · yc2 + θ2 · ys2 + θ3 · yc · ys + θ4 · yc + θ5 · ys = 1
The minization of the error kMk · Θk22 − 1 leads to
with the objective function
gc2 X X
θ1 = J= ²2k = (kMk · Θk22 − 1)2
K · cos2 β k k
gs2
θ2 =
K · cos2 β to be minimized. The corresponding gradient is
2gc gs sin β X
θ3 =
K · cos2 β (5) ∇J = 4 · Mk0 · Mk · Θ · (Θ0 · Mk0 · Mk · Θ − 1)
2gc k
θ4 =− (gc bc + gs bs sin β)
K · cos2 β
2gs which can be used off-line for estimating Θ and
θ5 =− (gs bs + gc bc sin β)
K · cos2 β thus the parameters ac , bc , as and bs . This is
g b + gs2 b2s + 2gc bc gs bs sin β
2 2
performed by iterating Θ → Θ − γ · ∇J with a
K =1− c c
cos2 β suitably small γ. Note that explicit estimate of
the offsets and of the gains is not needed. The
or equivalently estimate of the parameter vector Θ is sufficient
[yc2 , ys2 , yc · ys , yc , ys ] · [θ1 , θ2 , θ3 , θ4 , θ5 ]0 = 1 for the calibration of our measurements.
| {z } | {z }
Y Θ An on-line version can be implemented in various
ways, e.g. by calculating the gradient over a num-
For a set of measurement pairs the equation ber of steps before updating Θ or also by comput-
extends to the equation set ing a time-smoothed version of the gradient with
Y·Θ=1 a forgetting factor λ as in the following formula
71
P
of the angle α can be extended, like in the Hey- Consider the objective function J = 2
k krk k .
demann correction, to include the estimate of the The first order approximation of J with respect
phase deviation β from the ideal 90 degrees. Then to a parameter variation δΘ is
the equations for the compensation of the two X X X
2 2
measurements (4) can be rewritten as krk +∇rk δΘk ≈ krk k +2· rkT ·∇rk · δΘ
k k k
θ1 · yc,k + θ2 = cos(αk )
θ3 · ys,k + θ4 + θ5 · yc,k = sin(αk ) The objective function value can be reduced with
the following choice of the parameter update:
1 bc 1
where θ1 = ac , θ2 = − ac , θ3 = as cos β , θ4 = X
bc ·tan β δΘ = −γ · (∇rk )T · rk
bs
− as cos β − ac and θ5 = tan β
ac . Similarly to the k
previous gradient search, the new matrix
µ ¶
yc,k 1 0 0 0 where the small scalar value γ controls the speed
M= (7)
0 0 ys,k 1 yc,k of convergence of the parameter vector Θ.
The gradient ∇rk is
can be defined together with a five element vector
Θ which delivers the five compensation parame- T
ters. Again, no explicit estimate of offsets, gains yc,k + sin α̂k · ∂θα̂1k − cos α̂k · ∂θα̂1k
and phase difference has to be computed. 1 + sin α̂ · ∂ α̂k − cos α̂k · ∂θα̂2k
k θ2
∇rk =
sin α̂k · ∂θα̂3k ys,k − cos α̂k · ∂θα̂3k
sin α̂k · ∂θα̂4k 1 − cos α̂k · ∂θα̂4k
5.4 Gradient search: correction of non-linearities
µ ¶ µ ¶
The sinusoidal signals may be affected by non- yc,k 1 0 0 sin α̂k
= + · ∇α̂k
linearities given by the general expression 0 0 ys,k 1 − cos α̂k
| {z }
Mk
yc,k = fc (cos αk ) ys,k = fs (sin αk )
where Mk is again the matrix of equation (6).
Assuming that the non-linearities are invertible
(which is reasonable in practice) the inverse func- For ∇α̂k take the recursive equation
tions α̂k+1 = −c · α̂k − d · α̂k−1 + a · ek + b · ek−1 (9)
fc−1 (yc,k ) = cos α fs−1 (ys,k ) = sin α
from the filter (2). Then
can be defined. For the functions fc−1 and fs−1
∇α̂k+1 = −c·∇α̂k − d·∇α̂k−1 + a·∇ek + b·∇ek−1
a third order polynomial approximation can be
chosen, which leads to
Consider now the error
2 3
θ1 · yc,k + θ2 · yc,k + θ3 · yc,k + θ4 = cos αk
2 3 ek = (θ3 ·ys,k + θ4 )·cos α̂k − (θ1 ·yc,k + θ2 )·sin α̂k
θ5 · ys,k + θ6 · ys,k + θ7 · ys,k + θ8 = sin αk
The steps defined in sections 5.2 and 5.3 can be The derivative of ek with respect to θ1 is
re-applied here with the only difference that the ∂ek
matrix M is now of the form = −yc,k · sin α̂k
µ ¶ ∂θ1
2 3
yc,k yc,k yc,k 1 0 0 0 0 ∂ α̂k
M= 2 3 −(θ3 ·ys,k + θ4 )·sin α̂k ·
0 0 0 0 ys,k ys,k ys,k 1 ∂θ1
∂ α̂k
and that there are 8 compensation parameters θi . −(θ1 ·yc,k + θ2 )·cos α̂k ·
∂θ1
and considering that θ3·ys,k +θ4 ≈ sin αk and that
5.5 Gradient based on residual θ1 ·yc,k + θ2 ≈ cos αk the gradient
i.e. the error between the estimated sine and Proceeding in the same way for the other variables
cosine values and the compensated measurements. the gradient ∇ek can be obtained
72
T The simulation of Figure 7, where the parame-
−yc,k · sin α̂k
− sin α̂k ter update at time k is δΘk = −γ · (∇rk )T ·
∇ek = −∇α̂k (10) rk , shows how the compensation parameters for
ys,k · cos α̂k
cos α̂k offsets, gains and phase difference converge ap-
| {z } proximately to the corresponding parameter val-
wk
ues from the Heydemann correction (for mea-
surements affected by additional distortions, the
Now, with this equation
estimates are necessarily identical, because the
∇α̂k+1 = −(c + a)·∇α̂k − (d + b)·∇α̂k−1 objectives functions are different).
+a·wk + b·wk−1 (11) 1.6
Xµ µ ¶ ¶T 1.2
sin α̂k
δΘ = −γ · Mk + · ∇α̂k · rk
− cos α̂k 1
k
0.8
0.4
73
View publication stats