Patent ID: 6922899

Claim:
A rotary encoder comprising: a fixed section; a rotating section which can be rotated with reference to the fixed section; angle detecting means for detecting a rotation angle of the rotating section with reference to a predetermined reference position of the rotating section; and output means for outputting the detected angle, wherein, when the angle detecting means detects an angle θn=n×θs (n=1, 2, . . . , N (where N×θs=360°)) which is an integer multiple of a predetermined angle θs (θs≧output resolution) such that the rotating section is rotated, an angle error E (θn) included in the detected angle θn is measured, functions between the detected angles θn and errors E(θn) are defined by the following equation with respect to all n: E ⁢ ⁢ ( θ ⁢ ⁢ n ) = ∑ i = 1 N / 2 ⁢ A i · sin ⁢ ⁢ ( i ⁢ ⁢ θ ⁢ ⁢ n + ϕ i ) an amplitude A i and an initial phase φ i (i=1, 2, . . . , N/2 or (N−1)/2) are calculated such that all the defined equations are satisfied, storing means for storing an error function which is given by the following equation: E ⁢ ⁢ ( θ ) = ∑ i = 1 N / 2 ⁢ A i · sin ⁢ ⁢ ( i ⁢ ⁢ θ + ϕ i ) and which is a periodic function of a detected angle θa having the calculated amplitude A i and the calculated initial phase φ i as coefficients is arranged, the detected angle θa detected by the angle detection means is substituted for the variables θ in the equation of the error function E(θ) stored by the storing means, and a value obtained by subtracting the value E(θa) obtained by the substitution from the detected angle θa is outputted by the output means.