Disclosure of Invention
The invention aims to overcome the defects of the prior art, provides an angular displacement vision measurement method of an absolute position rotary encoder, aims to solve the technical problem of recalibration of a reference zero position under the condition of power failure and restarting, and provides a non-contact high-resolution and high-precision angular displacement measurement scheme.
According to an embodiment of the present invention, the present invention provides an angular displacement vision measuring method based on an absolute position rotary encoder, comprising the steps of:
s1, constructing an angular displacement visual measurement world coordinate system based on a pre-designed absolute position rotary encoder, and acquiring first light spot data with a known height value by adopting an image acquisition device;
s2, obtaining image point coordinates (u, v) by the first light spot with known Z coordinates through least square fitting, and calibrating and solving second light spot data to calculate the coordinates of the second light spot data in a world coordinate system XY plane;
s3, fitting the image point coordinate (u) of the second light point by a least square method2,v2) Calculating the height direction data of the second light spot in the world coordinate system by combining the calibration result;
and S4, converting the absolute angular displacement of the rotary encoder into absolute angular displacement according to the proportional relation between the height and the angle to finish measurement.
Preferably, the pre-designed absolute position rotary encoder is a rotary encoder with continuously changing edge height and proportional angle, wherein the relationship between the edge height H and the angle θ is as follows:
in the formula, h1Is the height of the lowest edge of the rotary encoder, and the corresponding maximum angle is theta1,h2Is the height of the highest position of the edge, and the corresponding minimum angle is theta2。
Preferably, the world coordinate system is specifically: the origin O point of the world coordinate system is in the same point with the central point of the rotary encoder chassis, the XY plane of the world coordinate system is coplanar with the plane of the rotary encoder chassis, and the Z axis is parallel to the light.
Preferably, the acquiring of the first light spot data with a known height value by using the image acquisition device is to irradiate the laser pointer parallel to the central axis of the rotary encoder and make the laser spot always fall on the edge to form the first light spot data, where the height value of the first light spot data is known.
Preferably, the step S2 specifically includes:
step s201, calibrating R, T according to the linear imaging model by acquiring the first light spot data with known height value Z, as follows:
where ρ is a scale factor, [ x, y, z,1 [ ]]
TThe homogeneous coordinate of the calibration point on the calibration plate under the world coordinate system is obtained; [ m, n,1 ]]
THomogeneous coordinates of the index point image points; k is an internal parameter of the camera, wherein,
α
u、α
vscale factors on the u and v axes of the image or normalized focal length; u. of
0、v
0Is the geometric center of the picture;
wherein [ r ]1 r2 r3]A column vector of R, satisfying the following relationship:
in the formula, "| | | non-conducting phosphor2"represents the modulus of the vector," · "represents the vector inner product;
s202, calibrating the second light spot by constructing a linear equation set according to the calibration result and the camera imaging model and solving a horizontal and vertical coordinate x under the XY plane of the world coordinate systeml,ylThe values are shown below:
order:
a system of linear equations is obtained:
calibrating the abscissa x of the second spot according to the above formulal,ylThe value of (c).
Preferably, the fitting of the coordinates (u) of the image point of the second light point by means of a least squares method2,v2) And calculating the height direction data of the second light spot under the world coordinate system by combining the calibration result, specifically based on the horizontal and vertical coordinates xl,ylThe height value is obtained according to the following formula:
order:
then the following results are obtained:
thus, the z of the light spot is determinedpValue, wherein z of the light spotpThe value is the height value H of the edge where the second light spot is located after the rotary encoder rotates.
Preferably, said performing the measurement in terms of the proportional relationship between the height and the angle as converted into the absolute angular displacement of the rotary encoder comprises obtaining the absolute angular displacement θ as:
preferably, the image capturing device comprises a camera with known internal parameters.
The image acquisition device also comprises a laser pen which is used for irradiating parallel to the central shaft of the rotary encoder to acquire light spot data.
Preferably, the rotary-type encoder rotates 360 ° once.
Compared with the prior art, the invention has the following advantages: the image processing target is clear, the image point is easy and quick to obtain, and the image processing is simple and does not need a complex algorithm because only the image coordinate of the laser point needs to be obtained, so that the speed is high, and the real-time measurement can be realized; the edge height of the absolute position rotary encoder is continuously changed, so that the absolute position rotary encoder has high angular displacement measurement resolution and cannot lose absolute angular displacement after power failure; the photographic technology is applied to angular displacement measurement, and calibration is not needed to be carried out again once, so that the requirement of equipment is reduced, and a non-contact measurement method is provided, so that the interference to an object is reduced; the whole process is simple in algorithm, and the requirement of computing equipment is lowered. Compared with the existing method, the absolute position rotary encoder angular displacement measurement method based on monocular vision provided by the invention has the characteristics of non-contact, high resolution, simple calibration, absolute position and high precision, and has great practical application value.
Detailed Description
The following examples are given for the detailed implementation and specific operation of the present invention, but the scope of the present invention is not limited to the following examples.
Example 1
The absolute position rotary encoder angular displacement measurement operation is realized by an MATLAB platform in an M language programming mode in a Windows operating system.
The method for measuring the angular displacement of the absolute position rotary encoder mainly comprises the following four operation steps of designing the absolute position rotary encoder, enabling a laser pen to be vertical to the encoder, establishing a world coordinate system, shooting and calibrating the system by using a camera with known internal reference, extracting an image point of a light spot, measuring a height value of the light spot in the world coordinate system, converting the absolute angular displacement of the rotary encoder according to the proportional relation between the height and the angle, and completing measurement, wherein the specific steps are as follows (units which are not marked in the steps are all millimeter units):
and step S1, constructing an angular displacement vision measurement world coordinate system based on a pre-designed absolute position rotary encoder, and acquiring first light point data with a known height value by adopting an image acquisition device.
In the step, according to the purpose of the invention, an image acquisition device of the measurement system is constructed to acquire the light spot data, the image acquisition device comprises a camera with known internal parameters, and the camera with known internal parameters is used for taking photos.
In the present invention, a rotary encoder with continuously changing edge height and proportional angle relationship is designed, as shown in fig. 3, the relationship between the edge height H and the angle θ is as follows:
in the formula, h1Is the height of the lowest edge of the rotary encoder, and the corresponding maximum angle is theta1,h2Is the height of the highest position of the edge, and the corresponding minimum angle is theta2The rotary encoder rotates 360 degrees in one turn.
In the invention, the image acquisition device also comprises a laser pen, the laser pen is used for irradiating in parallel with the central shaft of the rotary encoder, and the light spot always falls on the edge in the measurement process, as shown in figure 4;
such a world coordinate system is established according to the designed encoder and the light of the laser pointer: the origin O point and the central point of the rotary encoder chassis are in the same point, the XY plane and the plane of the chassis are in the same plane, the Z axis is parallel to the light, then a camera with known internal parameters is used for shooting pictures by a 'facing' device, and the structure of the whole system is shown in figure 5;
and S2, obtaining coordinates (u, v) of an image point by fitting the first light point with the known Z coordinate through a least square method, and calibrating and solving the data of the second light point to calculate the coordinates of the second light point in the XY plane of the world coordinate system.
In the step, mainly the calibration of the parameters of the measurement system is performed, and specifically the following contents are included:
step S201, calibrating parameters according to a linear imaging model by acquiring first light spot data with known height value Z, specifically: by utilizing the established system and the world coordinate system, a calibration plate is firstly placed, the laser pen does not work, and system parameters R, T are calibrated according to a camera linear imaging model by taking a picture through a camera, namely as shown in the following formula:
where ρ is a scale factor, [ x, y, z,1 [ ]]TThe homogeneous coordinate of the calibration point on the calibration plate under the world coordinate system is obtained; [ m, n,1 ]]TIs the homogeneous coordinate of the index point image point.
K is the internal parameter of the camera and is a 3 multiplied by 3 matrix which is obtained by calibrating in advance by a Zhang-friend method
R, T can describe the relation between the camera coordinate system and the world coordinate system, R represents the rotation relation of the two coordinate systems and is a 3 x 3 matrixThe formula is as follows:
wherein, the column vector of R satisfies the following relation:
in the formula, "| | | non-conducting phosphor2"represents the modulus of the vector," · "represents the vector inner product;
t represents the position of the original coordinate system origin under the new coordinate system, and the specific form is as follows:
s202, calibrating the second light spot by constructing a linear equation set according to the calibration result and the camera imaging model and solving a horizontal and vertical coordinate x under the XY plane of the world coordinate systeml,ylThe values are shown below:
order:
a system of linear equations is obtained:
calibrating the horizontal and vertical coordinates x of the second light spot according to the above formulal,ylThe value of (c).
S3, fitting the image point coordinate (u) of the second light point by a least square method2,v2) And calculating the height direction data of the second light spot under the world coordinate system by combining the calibration result.
Integrating system parameters and x in coordinates under a light spot world coordinate systeml,ylThe calibration result of the value, during measurement, the rotary encoder is placed, the laser pen works, the picture is taken, and the z of the second light spot can be obtained according to the following equation and the coordinate of the image point of the obtained light spotpA value;
order:
the above equation is developed as:
thus, z of the second light spot is determinedpA value;
at this time, z of the light spotpThe value is the height value H of the edge of the current light spot after the rotation of the rotary encoder.
In an embodiment of the invention, the first spot image point coordinates (u, v) and the second spot image point coordinates (u, v)2,v2) All correspond to (x)l,yl) This is the principle of camera imaging, where a certain point is in the three-dimensional world (x)l,yl,Zl) But the coordinates of the image taken by the camera are two-dimensional, losing ZlThe value is obtained. Similarly, the x and y values of a point in the three-dimensional world coordinate are unchanged, only the z value is changed, the position of the camera is unchanged before and after the z value of the light spot is changed, and the image coordinate of the shot light spot is changed, namely the image coordinate (u, v) of the first light spot is changed to the image coordinate (u, v) of the second light spot2,v2) In the three-dimensional world, the Z value of the light spot becomes.
And S4, converting the absolute angular displacement of the rotary encoder into absolute angular displacement according to the proportional relation between the height and the angle to finish measurement.
In this step, z is calculated from this timepThe value is the height of the spot on the edge of the rotary encoder, i.e., the edge height H, so the absolute angular displacement θ is:
example 2
When calibrating system parameters, the specific method is as follows:
step one, calibrating a parameter R, T value:
using the angular points of the checkerboard as the calibration points, and under the established world coordinate system, in order to conveniently locate the coordinates of the calibration points, the XY plane is set according to the positions of the horizontal and vertical angular points on the checkerboard, as shown in fig. 5, so that the coordinates of each calibration point are (x)i,yi0) (i is 1,2,3, …, k), and the corresponding pixel coordinate is (m)i,ni) Then the camera linear imaging equation can be changed to the following equation:
order:
then there is the following formula:
taking a plurality of calibration points, namely k is more than or equal to 4, firstly constructing a linear equation set, solving a G matrix by using a least square method, and then calculating by combining the relation between column vectors of R (explained above) to obtain R, T, wherein the constructed linear equation set is as follows:
step two, x in the coordinate of the light spot under the world coordinate systeml,ylThe values are calibrated as follows:
taking the checkerboard away, placing the rotary encoders, making the chassis center coincide with the world coordinate system origin as much as possible, operating the laser pen, and taking the known angular displacement positions of the rotary encoders, namely the z of the coordinates of the light spot in the world coordinate systemlThe value is known, a picture is taken and the image point (m) is obtained by image processingl,nl) The calibration data combining the above step one has the following formula:
order:
there is a system of linear equations:
according to which the horizontal and vertical coordinates x of the light spot are calibratedl,ylThe value of (c).
The invention relates to an angular displacement vision measuring method, which applies the photographic technique to the angular displacement measurement, and firstly designs an absolute position rotary encoder with continuously changed edges, wherein the edge height and the angle are in direct proportion; then a laser pen is used for irradiating in parallel to the central shaft of the rotary encoder and enabling a laser point to fall on the edge all the time so as to form a light spot; then, shooting from any angle by adopting a calibrated digital camera, and ensuring that a light spot is shot completely; and finally, obtaining the image point of the light spot by using an image processing technology, calculating the position of the light spot under a world coordinate system according to a calibration result and a camera imaging model, and converting the rotary angular displacement of the rotary encoder according to the relation between the height and the angle. The method can solve the problem of recalibration of the reference zero position under the condition of restarting after power failure, and provides a non-contact high-resolution and high-precision angular displacement measurement scheme.
The present invention is not limited to the above preferred embodiments, and any modifications, equivalent substitutions and improvements made within the spirit and principle of the present invention should be included in the protection scope of the present invention.