Disclosure of Invention
The technical problem to be solved by the embodiments of the present invention is to provide a method and a system for a robot to accurately move a mechanical arm to a specified position, so that the robot can accurately move the mechanical arm to the specified position by establishing a relationship between a camera coordinate and a physical coordinate.
In order to solve the above technical problem, an embodiment of the present invention provides a method for a robot to accurately move a robot arm to a specified position, where the method includes:
a, acquiring coordinates of a plurality of designated positions of a first designated image and a second designated image of a robot moving mechanical arm reaching a preset calibration plate, performing target calculation on the acquired coordinates of the first designated image and the second designated image, and determining related physical parameters of a center point of the first designated image and a center point of the second designated image;
b, acquiring an imaging picture which is shot by a fixed camera and simultaneously comprises the first designated image and the second designated image, performing data processing on the acquired imaging picture shot by the fixed camera, and determining related image parameters of a central point of the first designated image and a central point of the second designated image;
c, establishing a mapping relation between the physical coordinates of the mobile mechanical arm of the robot and the coordinates of the camera according to the relevant physical parameters of the central points of the first designated image and the second designated image and the relevant image parameters of the central points of the first designated image and the second designated image;
and d, appointing a certain pixel point coordinate in the imaging picture of the fixed camera, and converting the appointed pixel point coordinate according to the established mapping relation to obtain the physical coordinate of the robot corresponding to the movable mechanical arm on the preset calibration plate and drive the robot to move the mechanical arm to accurately arrive.
Wherein, the step a specifically comprises:
setting a first designated image and a second designated image having the same figure on the predetermined calibration plate; the first designated image and the second designated image respectively comprise a square and a circle which takes the center point of the square as the center of the circle and has a radius of half the length of the square;
acquiring four vertex physical coordinates of a square on the first instruction image and four vertex physical coordinates of a square on the second instruction image when the robot moving mechanical arm reaches the first instruction image, and calculating a physical coordinate of a circle center on the first instruction image and a physical coordinate of a circle center on the second instruction image according to the acquired four vertex physical coordinates of the quadrangles on the first instruction image and the second instruction image;
and fixing the physical coordinate of the center of the circle on the first instruction image, the physical coordinate of the center of the circle on the second instruction image and the radius of the circle to be half of the length of a quadrangle, and outputting the fixed physical coordinates and the radius of the circle as related physical parameters of the center point of the first appointed image and the center point of the second appointed image.
Wherein, the step b specifically comprises:
acquiring an imaging picture which is shot by a fixed camera and simultaneously comprises the first designated image and the second designated image, and performing data processing on the acquired imaging picture shot by the fixed camera to obtain a pixel coordinate of the center of a circle on the first instruction image and a radius corresponding to the pixel coordinate of the center of a circle on the second instruction image;
and outputting the pixel coordinate of the center of the circle on the first instruction image and the radius corresponding to the pixel coordinate of the center of the circle on the second instruction image and the radius corresponding to the pixel coordinate of the center of the circle on the first instruction image as the related image parameters of the center point of the first appointed image and the center point of the second appointed image.
The embodiment of the invention also provides a system for accurately moving the mechanical arm to the specified position by the robot, which comprises:
the physical parameter determining unit is used for acquiring coordinates of a plurality of designated positions of a first designated image and a second designated image on a preset calibration plate when a robot moving mechanical arm reaches the preset calibration plate, performing target calculation on the acquired coordinates of the first designated image and the second designated image, and determining related physical parameters of a central point of the first designated image and a central point of the second designated image;
the image parameter determining unit is used for acquiring an imaging picture which is shot by a fixed camera and simultaneously comprises the first designated image and the second designated image, performing data processing on the acquired imaging picture shot by the fixed camera, and determining related image parameters of a central point of the first designated image and a central point of the second designated image;
the coordinate mapping unit is used for establishing a mapping relation between the physical coordinates of the mobile mechanical arm of the robot and the camera coordinates according to the relevant physical parameters of the central points of the first designated image and the second designated image and the relevant image parameters of the central points of the first designated image and the second designated image;
and the conversion moving unit is used for appointing a certain pixel point coordinate in an imaging picture of the fixed camera, converting the appointed pixel point coordinate according to the established mapping relation, obtaining the physical coordinate of the robot corresponding to the moving mechanical arm on the preset calibration plate and driving the robot to move the mechanical arm to accurately arrive.
Wherein the physical parameter determination unit includes:
the image setting module is used for setting a first designated image and a second designated image with the same graph on the preset calibration plate; the first designated image and the second designated image respectively comprise a square and a circle which takes the center point of the square as the center of the circle and has a radius of half the length of the square;
the physical coordinate calculation module is used for acquiring the physical coordinates of four vertexes of a square on the first instruction image and the physical coordinates of four vertexes of a square on the second instruction image when the robot moving mechanical arm reaches the first instruction image, and calculating the physical coordinates of the center of a circle on the first instruction image and the physical coordinates of the center of a circle on the second instruction image according to the acquired physical coordinates of the four vertexes of the quadrangle on the first instruction image and the second instruction image;
and the physical parameter output module is used for fixing the physical coordinates of the circle center on the first instruction image, the physical coordinates of the circle center on the second instruction image and the circle radius to be half of the length of a quadrangle and outputting the fixed physical coordinates and the fixed physical parameters as the related physical parameters of the center point of the first appointed image and the center point of the second appointed image.
Wherein the image parameter determination unit includes:
the image shooting and calculating module is used for acquiring an imaging picture which is shot by a fixed camera and simultaneously comprises the first designated image and the second designated image, and performing data processing on the acquired imaging picture which is shot by the fixed camera to obtain a pixel coordinate of the circle center on the first instruction image and a radius corresponding to the pixel coordinate of the circle center on the second instruction image;
and the image parameter output module is used for outputting the pixel coordinate of the circle center on the first instruction image and the radius corresponding to the pixel coordinate of the circle center on the second instruction image and the radius corresponding to the pixel coordinate of the circle center on the first instruction image as the related image parameters of the center point of the first appointed image and the center point of the second appointed image.
The embodiment of the invention has the following beneficial effects:
in the embodiment of the invention, because the relation between the camera coordinate and the physical coordinate is established, the target point obtained by visual positioning is converted into the physical coordinate, and the mechanical arm is further driven to search the target point, the obtained final physical coordinate is accurate, the algorithm efficiency is high, the mechanical arm moves in the shortest path, and the finally moved coordinate meets the requirement; meanwhile, the embodiment of the invention has strong anti-interference performance on the interference of factors such as dust, particles, spots and the like in the camera image, and can accurately find the target point under the condition that a large number of interferents exist.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in further detail with reference to the accompanying drawings.
As shown in fig. 1, in an embodiment of the present invention, a method for a robot to accurately move a robot arm to a specified position is provided, where the method includes:
step S1, acquiring coordinates of a plurality of designated positions of a first designated image and a second designated image when the robot moving mechanical arm reaches a preset calibration plate, performing target calculation on the acquired coordinates of the first designated image and the second designated image, and determining related physical parameters of a center point of the first designated image and a center point of the second designated image;
step S2, acquiring an imaging picture which is shot by a fixed camera and simultaneously comprises the first designated image and the second designated image, performing data processing on the acquired imaging picture shot by the fixed camera, and determining related image parameters of a central point of the first designated image and a central point of the second designated image;
step S3, establishing a mapping relation between the physical coordinates of the mobile mechanical arm of the robot and the coordinates of the camera according to the relevant physical parameters of the central point of the first specified image and the central point of the second specified image and the relevant image parameters of the central point of the first specified image and the central point of the second specified image;
step S4, appointing a certain pixel point coordinate in the imaging picture of the fixed camera, and converting the appointed pixel point coordinate according to the established mapping relation to obtain the physical coordinate of the robot corresponding to the mobile mechanical arm on the preset calibration plate and drive the robot to move the mechanical arm to accurately arrive.
Specifically, in step S1, a first specific image and a second specific image having the same pattern are set on a predetermined calibration sheet; the first designated image and the second designated image respectively comprise a square and a circle which takes the center point of the square as the center of the circle and has a radius of half the length of the square;
acquiring four vertex physical coordinates of a square on a first instruction image and four vertex physical coordinates of a square on a second instruction image when a robot moves a mechanical arm, and calculating a physical coordinate of a circle center on the first instruction image and a physical coordinate of a circle center on the second instruction image according to the acquired four vertex physical coordinates of respective quadrangles on the first instruction image and the second instruction image;
and fixing the physical coordinates of the center of the circle on the first instruction image, the physical coordinates of the center of the circle on the second instruction image and the radius of the circle to be half of the length of the quadrangle, and outputting the parameters as the relevant physical parameters of the center point of the first specified image and the center point of the second specified image.
As an example, the position of the arm of the industrial robot is moved multiple times and within the fixed camera field of view, so that all vertex parameters C of the square are obtained1~C8The position in the robot coordinate system and the physical coordinate M of the centers of two squares15And M16Radius R of the circle15. At this time, C1~C8The physical coordinates of (a) are: (61.249, 307.946), (61.149, 327.928), (41.323, 327.297), (41.323, 308.272), (41.215, 286.645), (40.707, 306.531), (21.298, 306.535), (21.015, 286.871). Circle center M15And M16The physical coordinates of (a) are: (51.261, 317.86075), (31.05875, 296.6455), radius of the circle R15=5000um。
In step S2, acquiring an imaging picture taken by the fixed camera and including both the first designated image and the second designated image, and performing data processing on the acquired imaging picture taken by the fixed camera to obtain a pixel coordinate of a center of a circle on the first instruction image and a radius corresponding to the pixel coordinate of the center of a circle on the second instruction image;
and outputting the pixel coordinate of the center of the circle on the first instruction image and the radius corresponding to the pixel coordinate of the center of the circle on the second instruction image and the radius corresponding to the pixel coordinate of the center of the circle on the first instruction image as the related image parameters of the center point of the first appointed image and the center point of the second appointed image.
As an example, a fixed camera (the position and lens are not changed, but a panorama of a predetermined calibration board can be taken) is used to process the captured image. The circle in the calibration plate can be detected by using Hough transformation. The target point, namely the circle center parameter C can be obtained9、C10Pixel coordinates in the camera coordinate system and a radius parameter R11、R12. At this time, the center C9、C10The pixel coordinates are: (208, 1435), (1622, 498); radius of circle R11=R12=229。
In step S3, as shown in fig. 2, the general coordinates are converted to two coordinates of find OXY and O ' X ' Y '; the coordinate of O' in the OXY coordinate is (x)0,y0) The angle from the x-axis to x' is t, and therefore the coordinate conversion formula x ═ x is obtained0-(x′cost+y′sint),y=y0+(x′sint+y′cost)。
In the conversion of the physical coordinate and the pixel coordinate, t is a deflection angle parameter theta, and a pixel ratio parameter lambda is required to be introduced, so that the physical coordinate and the pixel coordinate are obtainedStandard conversion formula x ═ x0-(x′cosθ+y′sinθ)* λ,y=y0+(x′sinθ+y′cosθ)*λ。
The physical parameter M obtained in the step S1 is utilized15、M16And R15And the image parameter C obtained in step S29、C10And R11Can calculate and obtain a camera coordinate system deflection angle parameter theta13And a pixel ratio parameter λ14. At this time, the deflection angle parameter θ13=arctan((yc9-yc10)/(xc9-xc10))-arctan((ym15-ym16)/(xm15-xm16) ); pixel ratio parameter lambda14=R15/R11(ii) a Wherein x isc9And yc9Are respectively C9Pixel coordinate values on the X-axis and Y-axis; x is the number ofc10And yc10Are respectively C10Pixel coordinate values on the X-axis and Y-axis; x is the number ofm15And ym15Are respectively M15Physical coordinate values on the X-axis and Y-axis; x is the number ofm16And ym16Are respectively M16Physical coordinate values on the X-axis and Y-axis. Thus, θ is calculated130.224 radian, λ14=21.834。
In step S4, coordinates of a certain pixel point in the imaging picture of the fixed camera are randomly designated and coordinate conversion is performed to obtain physical coordinates of the robot corresponding to the moving arm on the preset calibration board and to drive the robot to move the arm to accurately arrive.
As an example, specify C on a picture9(corresponding to M in physical coordinates15) The position on the preset calibration plate is the accurate arrival position of the robot mobile mechanical arm according to x0=M16.x+(xc10*cosθ13+ yc10*sinθ13)*λ14,y0=M16.y-(xc10*sin(-θ13)+yc10*cosθ13)*λ14,x=x0-(xc9*cosθ13+ yc9*sinθ13)*λ14And y ═ y0+(xc9*sin(-θ13)+yc9*cosθ13)*λ14,C9The coordinate substitution calculation results in the coordinates of the robot coordinate system being (51.3535,317.8452). And M15The coordinate error is less than 0.1mm, and the actual use requirement is met.
As shown in fig. 3, in an embodiment of the present invention, a system for a robot to accurately move a robot arm to a specified position is provided, where the system includes:
a physical parameter determining unit 210, configured to obtain coordinates of a plurality of specified positions where a robot moving mechanical arm reaches a first specified image and a second specified image on a preset calibration plate, perform target calculation on the obtained coordinates of the first specified image and the second specified image, and determine a relevant physical parameter of a center point of the first specified image and a relevant physical parameter of a center point of the second specified image;
an image parameter determining unit 220, configured to acquire an imaging picture that is taken by a fixed camera and includes the first designated image and the second designated image at the same time, perform data processing on the acquired imaging picture that is taken by the fixed camera, and determine related image parameters of a center point of the first designated image and a center point of the second designated image;
a coordinate mapping unit 230, configured to establish a mapping relationship between physical coordinates of a robot moving arm and coordinates of a camera according to relevant physical parameters of a center point of the first specified image and a center point of the second specified image and relevant image parameters of the center point of the first specified image and the center point of the second specified image;
and the conversion moving unit 240 is used for designating a certain pixel point coordinate in the imaging picture of the fixed camera, and converting the designated pixel point coordinate according to the established mapping relation to obtain a physical coordinate of the robot corresponding to the moving mechanical arm on the preset calibration plate and drive the robot to move the mechanical arm to accurately arrive.
Wherein the physical parameter determination unit 210 includes:
an image setting module 2101 configured to set a first designated image and a second designated image having the same graphic on the predetermined calibration plate; the first designated image and the second designated image respectively comprise a square and a circle which takes the center point of the square as the center of the circle and has a radius of half the length of the square;
a physical coordinate calculation module 2102, configured to obtain physical coordinates of four vertices of a square on the first instruction image and physical coordinates of four vertices of a square on the second instruction image when the robot moves the mechanical arm to reach the first instruction image, and calculate, according to the obtained physical coordinates of the four vertices of each quadrilateral on the first instruction image and the second instruction image, a physical coordinate of a circle center on the first instruction image and a physical coordinate of a circle center on the second instruction image;
and the physical parameter output module 2103 is configured to fix the physical coordinate of the center of the circle on the first instruction image, the physical coordinate of the center of the circle on the second instruction image, and the radius of the circle to be half of the length of the quadrangle, and output the fixed physical coordinates as the related physical parameters of the center point of the first specified image and the center point of the second specified image.
Wherein the image parameter determination unit 220 includes:
an image capturing and calculating module 2201, configured to obtain an imaging picture captured by a fixed camera and including the first specified image and the second specified image at the same time, and perform data processing on the obtained imaging picture captured by the fixed camera to obtain a pixel coordinate of a center of a circle on the first instruction image and a radius corresponding to the pixel coordinate of the center of a circle on the second instruction image;
an image parameter output module 2202, configured to output, as related image parameters of a center point of the first specified image and a center point of the second specified image, the pixel coordinate of the center of the circle on the first instruction image and the radius corresponding to the pixel coordinate of the center of the circle on the second instruction image.
The embodiment of the invention has the following beneficial effects:
in the embodiment of the invention, because the relation between the camera coordinate and the physical coordinate is established, the target point obtained by visual positioning is converted into the physical coordinate, and the mechanical arm is further driven to search the target point, the obtained final physical coordinate is accurate, the algorithm efficiency is high, the mechanical arm moves in the shortest path, and the finally moved coordinate meets the requirement; meanwhile, the embodiment of the invention has strong anti-interference performance on the interference of factors such as dust, particles, spots and the like in the camera image, and can accurately find the target point under the condition that a large number of interferents exist.
It should be noted that, in the foregoing system embodiment, each included system unit is only divided according to functional logic, but is not limited to the above division as long as the corresponding function can be implemented; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention.
It will be understood by those skilled in the art that all or part of the steps in the method for implementing the above embodiments may be implemented by relevant hardware instructed by a program, and the program may be stored in a computer-readable storage medium, such as ROM/RAM, magnetic disk, optical disk, etc.
The above disclosure is only for the purpose of illustrating the preferred embodiments of the present invention, and it is therefore to be understood that the invention is not limited by the scope of the appended claims.