A method for detecting and operating a knob switch position of an electrical cabinet

Through the YOLOv8 key point detection algorithm and depth camera technology, the problem of robots identifying the position and orientation information of electrical cabinet knob switches is solved, and the robot's precise operation of electrical cabinet knob switches is realized, improving the feasibility of automated management.

CN118254180BActive Publication Date: 2024-09-27HEFEI UNIV OF TECH
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410489551.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-23
Publication Date
2024-09-27
Estimated Expiration
2044-04-23

AI Technical Summary

Technical Problem

In the existing technology, it is difficult for the robot to accurately identify the position information of the knob switch of the electrical cabinet, resulting in inaccurate operation of the robotic arm. Moreover, the traditional method requires pasting indicators, which affects the cleanliness of the electrical cabinet and makes maintenance difficult. Deep learning methods cannot accurately identify the knobs. Rotation angle and operating point of the switch operating handle.

Method used

The YOLOv8 key point detection algorithm is used to train the key point detection model. The depth camera is used to capture the image of the electrical cabinet, and the arrow, center and tail key points are marked. The detection frame and key point information are used to confirm the knob switch position, and the robot arm end effector is used. Precise operation enables automatic operation of the knob switch.

Benefits of technology

It improves the robot's recognition accuracy and operation precision of the electrical cabinet knob switch, reduces the computing power requirements, simplifies the identification process, avoids the use of pasted indicators, and meets the needs of unmanned management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118254180B
    Figure CN118254180B
Patent Text Reader

Abstract

The present invention discloses a method for detecting and operating the position and posture of a knob switch of an electrical cabinet, and belongs to the technical field of robot mechanical arm control. The method comprises: introducing a YOLOv8 key point detection algorithm to construct a key point detection model; collecting a target switch image, obtaining the key point pixel coordinates through a detection model; calculating the position of the gripper, and driving the mechanical arm to operate the target knob. The present invention enables the robot mechanical arm to operate the knob switch of the electrical cabinet more accurately. The present invention adopts a knob switch position detection method based on the YOLOv8 key point detection algorithm, which has low requirements for the recognition process, is simple and fast, but still maintains the advantages of high accuracy, and can effectively identify the knob switch operating handle at different rotation angles, meeting the needs of the robot mechanical arm to operate the knob switch of the electrical cabinet.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of robot arm control, and specifically relates to a method for detecting and operating a knob switch position of an electrical cabinet. Background Art

[0002] In recent years, with the rapid development of the national power grid system and high-speed railway system, the automation level of my country's power and railway systems has been significantly improved. In order to realize unmanned management of substations, many substations have introduced mobile robotic arms to replace operators to operate the equipment in the substation, such as issuing instructions to the buttons on the electrical cabinet. However, in actual application, it is difficult for robots to accurately operate the target buttons. Often, the robot cannot correctly identify the electrical switch, resulting in the inability to complete the operation process, which causes greater safety problems. Or some indicators are pasted to identify the electrical switch, but it also further increases the difficulty of maintenance and the standardization and neatness of the electrical cabinet surface. Therefore, in order to enable the robotic arm to correctly detect the position and posture information of the electrical switch, so as to accurately complete the operation task of the target switch, the present invention proposes a method for detecting the position and posture information of the knob switch, using a reliable imaging device and deep learning technology to achieve the purpose of replacing manual operation of the equipment with robotic technology.

[0003] The Chinese invention patent document (CN113887415A) published on January 4, 2022, "Method, device, electronic device and storage medium for identifying the gear position of a knob switch", proposes a method for identifying the gear position of a knob switch. This method adopts the instance segmentation algorithm in the deep learning algorithm to determine the gear position of the knob switch by detecting the angle between the center line of the indication area of ​​the knob indication end and the center area of ​​the image. However, the angle calculated by this method will deviate greatly from the actual angle, and the platform computing power required for instance segmentation is relatively high, which is not suitable for platforms with lower computing power. In addition, this method does not involve the precise positioning of the switch knob operating point, and can only realize the function of identifying the gear position.

[0004] Shi Mengan, Lu Zhenyu and others proposed a switch position recognition method based on deep learning target detection algorithm in "Power station knob switch state recognition based on YOLO-tiny-RFB model", which divides switches in different positions into different categories for target detection. This method can accurately recognize knob switches in some positions, but it cannot obtain the current angle of the knob switch operating handle, and it still cannot accurately locate the knob switch operating point.

[0005] In robot operations, machine vision technology, as the "eyes" of the robot, can correctly identify the target switch and obtain its position information, which directly affects whether the robot can accurately complete the operation. Among them, the research on the vision technology of robot recognition of electrical cabinet knob switches still has the following technical problems:

[0006] 1. The recognition method based on traditional visual processing technology generally requires pasting indicators to detect the position information of the knob switch operating handle. It not only requires regular maintenance of the firmness of the stickers, but also affects the standardization and neatness of the surface of the electrical cabinet operation panel.

[0007] 2. The current deep learning-based detection methods often use pattern matching methods to perform knob detection, and the rotation angle of the operating handle is also set in advance. However, due to long-term use of the knob switch, the rotation angle of the operating handle will deviate from the preset value due to looseness, and this method cannot accurately identify the operating point of the operating handle, resulting in the inability of the gripper at the end of the robotic arm to correctly grip the knob switch operating handle.

[0008] 3. Currently, most of the research on substation inspection robots is limited to the recognition of the current gear position of the knob switch, and does not involve the operation method of the knob switch. After the robot obtains the relevant information, it is handed over to manual judgment, and then the knob switch is operated manually, which cannot meet the needs of automated and unmanned substation management. Summary of the invention

[0009] The technical problem to be solved by the present invention is the problem existing in the prior art. Specifically, the present invention solves the problem that the traditional method of detecting the operating handle of the knob switch is easily interfered with and requires the pasting of indicators, so that the robot arm can operate the knob switch of the electrical cabinet more accurately, and the recognition process requires low computing power and is simple, fast and highly accurate.

[0010] The technical solution of the present invention is as follows.

[0011] A method for detecting and operating a knob switch of an electrical cabinet, the method involving a system comprising a robot and an electrical cabinet; a knob switch is mounted on an operation panel of the electrical cabinet, the knob switch is a multi-position self-locking knob switch, and an indicating arrow is marked on one end of a knob switch operating handle of the knob switch;

[0012] The robot comprises a 6-DOF mechanical arm, an end effector and a depth camera, the 6-DOF mechanical arm comprises 6 rotating joints and a mechanical arm base, the 6 rotating joints are rotating joint 1, rotating joint 2, rotating joint 3, rotating joint 4, rotating joint 5 and rotating joint 6 in sequence from the mechanical arm base, and the six rotating joints rotate around a first joint axis, a second joint axis, a third joint axis, a fourth joint axis, a fifth joint axis and a sixth joint axis in sequence, respectively, wherein the fourth joint axis and the fifth joint axis are perpendicular to each other, and the fifth joint axis and the sixth joint axis are perpendicular to each other; the end effector and the depth camera are both mounted on the end of the 6-DOF mechanical arm, and the optical axis of the depth camera is parallel to the sixth joint axis, and the depth camera moves with the 6-DOF mechanical arm; the end effector is a two-finger parallel gripper mounted on the mechanical arm rotating joint 6; the center point of the end of the two-finger parallel gripper is defined as the end of the mechanical arm;

[0013] The detection and operation method comprises the following steps:

[0014] Step 1, construct a key point detection model for the knob switch;

[0015] Use the depth camera to take N images of the knob switch, and use labelme annotation software to annotate the captured images to obtain three key points of the knob switch operating handle, which are respectively recorded as the arrow key point h, the center key point m and the tail key point t; select K images from the annotated images as the training set, and the remaining NK images as the test set, K<N;

[0016] After the annotation is completed, the annotation file is obtained, and the annotation file and the annotated image are trained using the YOLOv8 key point detection algorithm to obtain a key point detection model;

[0017] Step 2, capture the target image and confirm the current position of the knob switch;

[0018] Step 2.1, the robot moves to the area where the knob switch of the electrical cabinet is located, drives the 6-DOF manipulator to unfold, and after unfolding, keeps the optical axis of the depth camera perpendicular to the operating surface of the electrical cabinet, and the plane where the depth camera lens is located is parallel to the operating surface of the electrical cabinet. At this time, the two-finger parallel gripper of the end effector is also perpendicular to the front of the electrical cabinet; then use the depth camera to shoot the area where the knob switch is located, and during the shooting process, the knob switch is located at the center of the image. The image obtained by shooting is recorded as the target image, and the pixel coordinates of the pixel point in the upper left corner of the target image in the pixel coordinate system of the target image are (0, 0);

[0019] The target image is detected using the key point detection model. Specifically, the key point detection model selects the knob switch operating handle in the target image through a detection frame 1. The width of the detection frame 1 in the pixel coordinate system of the target image is w and the height is The pixel coordinates of the upper left corner of detection frame 1 are (u r , v r ); The pixel coordinates of the arrow key point h, the center key point m and the tail key point t of the target image in the pixel coordinate system of the target image are obtained through the detection frame 1, which are respectively recorded as the arrow key point coordinates (u h , v h ), center key point coordinates (u m , v m ) and the tail key point coordinates (u t , v t ), and the depth information of the central key point m is also obtained and recorded as depth d m ;

[0020] Step 2.2, based on the information of the detection frame and the three key points of the target image, the current gear position of the knob switch is judged according to the given confirmation criteria: if the current gear position of the knob switch is different from the expected gear position, proceed to step 3; if the current gear position of the knob switch is the same as the expected gear position, end this operation;

[0021] Step 3: Define the pose transformation matrix of the robot end coordinate system relative to the robot end effector coordinate system The pose transformation matrix of the robot end effector relative to the robot base coordinate system And the pose transformation matrix of the camera coordinate system relative to the robot end coordinate system Then use the camera calibration algorithm to calibrate the depth camera to obtain the intrinsic parameter matrix M of the depth camera;

[0022] According to the coordinates of the central key point of the target image (u m , v m ) and depth information d m , the pose transformation PC of the camera coordinate system relative to the robot end coordinate system is calculated through the calibrated intrinsic parameter matrix M,

[0023] The position of the center key point m relative to the robot base coordinate system is PB, and its expression is as follows:

[0024]

[0025] Where PC′ is a 4×1 matrix,

[0026] The coordinates of position PB in the robot base coordinate system are marked as (x p ,y p , z p ), the coordinate (x p ,y p , zp ) is the coordinate of the key point m at the center of the target image in the robot base coordinate system;

[0027] Step 4: Define point P0 as the center point of the end of the two parallel grippers of the robot arm, along the sixth joint axis of the robot arm away from the operating surface of the electrical cabinet, and the straight-line distance from the key point m at the center of the knob switch operating handle is d. m0 At, modify the d in the PC formula of the pose transformation in step 3 m is d m0 , and obtain the position coordinates of point P0 in the robot base coordinate system, recorded as (x p0 ,y p0 , z p0 ); Control the robot arm so that the center point of the end of the two-finger parallel gripper reaches point P0. The posture of the robot arm at this time is recorded as Z0;

[0028] Step 5: Fit the arrow key point h, center key point m and tail key point t into a straight line using the least squares method. The slope of the fitted line is k, the intercept is b, and the angle between the fitted line and the positive direction of the image U axis is θ. l ;

[0029] Step 6: Rotate the two-finger parallel gripper to an angle of θ1 with the positive direction of the image U axis; define point P1 as the center point of the end of the two-finger parallel gripper of the robot arm, along the sixth joint axis of the robot arm close to the operating surface of the electrical cabinet, and the straight-line distance from point P0 is d m1 At, modify the d in the PC formula of the pose transformation in step 3 m is d m1 , and obtain the position coordinates of point P1 in the robot base coordinate system, recorded as (x p1 ,y p1 , z p1 ); control the robot arm so that the center point of the end of the two-finger parallel gripper reaches point P1; after reaching the target position, tighten the two-finger parallel gripper, that is, clamp the operating handle of the knob switch;

[0030] Step 7: Note that the angle between the knob switch operating handle of the desired gear position of the knob switch and the positive direction of the image U axis is θ i , and 0≤θ i <π, if θ1-θ i >0, the two-finger parallel gripper is controlled to rotate the knob switch operating handle clockwise |θ1-θ i |, if θ1-θ i <0, the two-finger parallel gripper is controlled to rotate the knob switch operating handle counterclockwise |θ1-θ i |, then release the gripper and restore the robot arm to the robot arm posture Z0 described in step 4;

[0031] Step 8, use a depth camera to shoot the area where the knob switch is located after rotation, and record the image as the test image; detect the test image using the key point detection model described in step 1 to obtain a detection frame 2 at the location of the knob switch in the test image. The width of the detection frame 2 in the pixel coordinate system of the test image is w2 and the height is The pixel coordinates of the upper left corner of detection frame 2 are (u r2 , v r2 ); The pixel coordinates of the arrow key point h2, the center key point m2 and the tail key point t2 of the inspection image in the pixel coordinate system of the inspection image are obtained through the detection frame 2, which are respectively recorded as (u h2 , v h2 )、(u m2 , v m2 ) and (u t2 , v t2 );

[0032] Step 9, based on the information of the detection frame 2 and the three key points of the inspection image obtained in step 8, judge the gear state after rotation according to the confirmation criteria described in step 2.2. If the gear state of the knob switch is consistent with the expected gear state at this time, it is considered that the expected operation of the knob switch is completed, otherwise, repeat the operations of steps 2 to 9.

[0033] Preferably, the marking process of the three key points of the knob switch operating handle in step 1 is:

[0034] First, use the Labelme annotation software to annotate the training frame of the knob switch operating handle. The training frame covers the knob switch operating handle and its center coincides with the geometric center of the knob switch operating handle; the geometric center point of the knob switch operating handle is marked as the center key point m, the tip of the indicator arrow on the knob switch operating handle is marked as the arrow key point h, and the center point of the end edge of the other end of the knob switch operating handle without the indicator arrow is marked as the tail key point t.

[0035] Preferably, the knob switch is a three-position self-locking knob switch. In step 2.2 and step 9, the position confirmation criterion of the knob switch is: when the arrow key point h satisfies and When the current knob switch position is in the left position, it is considered that the current knob switch position is in the left position; when the arrow key point h satisfies and When the current knob switch position is in the left position, it is considered that the current knob switch position is in the left position; when the arrow key point h satisfies and , it is considered that the current knob switch position is in the right position.

[0036] Preferably, the posture transformation matrix in step 3 is Pose transformation matrix Pose transformation matrix The definition process of the internal parameter matrix M is as follows:

[0037] Define the first 3×3 rotation matrix Used to describe the coordinate rotation of the robot end coordinate system relative to the robot end effector coordinate system, defining the first translation vector of 3×1 It is used to describe the coordinate translation of the robot end coordinate system relative to the robot end effector coordinate system. The robot system obtains the pose transformation matrix of the robot end coordinate system relative to the robot end effector coordinate system. Its expression is:

[0038]

[0039] Define the second 3×3 rotation matrix Used to describe the coordinate rotation of the robot end effector coordinate system relative to the robot base coordinate system, defining a 3×1 second translation vector It is used to describe the coordinate translation of the robot end effector coordinate system relative to the robot base coordinate system. The robot system obtains the pose transformation matrix of the robot end effector relative to the robot base coordinate system. Its expression is:

[0040]

[0041] Define the pose transformation matrix describing the camera coordinate system relative to the robot end coordinate system Its expression is:

[0042]

[0043] In the formula, is a 3×3 rotation matrix used to describe the coordinate rotation of the camera coordinate system relative to the coordinate system of the end of the robot arm. is a 3×1 translation vector used to describe the coordinate translation of the camera coordinate system relative to the coordinate system of the robot end;

[0044] The camera calibration algorithm is used to calibrate the depth camera. The calibration result is the intrinsic parameter matrix M of the depth camera, which is expressed as:

[0045]

[0046] In the formula, f x is the normalized focal length on the image X axis in the image coordinate system, f x =f / d x, f is the focal length of the depth camera, d x is the physical size of each pixel in the pixel coordinate system on the X-axis of the image; f y is the normalized focal length on the Y axis of the image in the image coordinate system, f y =f / d y , d y is the physical size of each pixel in the pixel coordinate system on the Y axis of the image; u0 is the horizontal coordinate of the origin of the image coordinate system in the pixel coordinate system, and v0 is the vertical coordinate of the origin of the image coordinate system in the pixel coordinate system, that is, the coordinates of the origin of the image coordinate system in the pixel coordinate system are (u0, v0).

[0047] Preferably, the implementation process of step 5 is as follows:

[0048] The arrow key point h, center key point m and tail key point t are fitted into a straight line using the least squares method. The slope of the fitted line is k, the intercept is b, the equation of the fitted line is y=kx+b, and the simultaneous equations are:

[0049]

[0050] The angle between the fitting straight line and the positive direction of the U axis of the image is recorded as θ1, θ1=arctan k, 0≤θ1<π.

[0051] Compared with the prior art, the beneficial effects of the present invention include:

[0052] 1. The present invention adopts the YOLOv8 key point detection algorithm for training to obtain a key point detection model, which is then used to detect the posture information of the knob switch on the electrical cabinet, thereby controlling the robotic arm to complete the operation of the target switch. This solves the problem that the traditional method of detecting the knob switch operating handle is easily interfered with and requires the pasting of indicators, thereby enabling the robot arm to operate the electrical cabinet knob switch more accurately.

[0053] 2. The present invention adopts a knob switch posture detection method based on the YOLOv8 key point detection algorithm. Compared with the instance segmentation method which is also based on deep learning, the recognition process of this method requires low computing power, so it is simple and fast, but it still maintains the advantage of high accuracy. It can effectively identify the knob switch operating handle at different rotation angles and meet the needs of the robot mechanical arm operating the electrical cabinet knob switch. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] Figure 1 A structural diagram of a robot system in an embodiment of the present invention;

[0055] Figure 2 Schematic diagram of labeling of collected images in the detection model in an embodiment of the present invention;

[0056] Figure 3 This is a schematic diagram of target image annotation in an embodiment of the present invention;

[0057] Figure 4 This is a schematic diagram of judging the current gear position of the knob switch in an embodiment of the present invention;

[0058] Figure 5 This is a schematic diagram of a key point straight line fitting in an embodiment of the present invention;

[0059] Figure 6 Schematic diagram of the relative position relationship between point P0 and point P1 in an embodiment of the present invention;

[0060] Figure 7 It is the overall flow chart of the present invention;

[0061] Figure 8 It is a simplified flow chart of step 3 to step 7 of the present invention. DETAILED DESCRIPTION

[0062] The present invention is described in detail below with reference to the accompanying drawings.

[0063] Figure 1 : is a structural diagram of a robot system in an embodiment of the present invention. It can be seen from the figure that the system involved in the detection and operation method includes a robot and an electrical cabinet. A knob switch is installed on the operation panel of the electrical cabinet. The knob switch is a multi-position self-locking knob switch, and one end of the knob switch operating handle of the knob switch is marked with an indication arrow.

[0064] The robot includes a 6-DOF mechanical arm, an end effector and a depth camera. The 6-DOF mechanical arm includes 6 rotation joints and a mechanical arm base. The 6 rotation joints are rotation joint 1, rotation joint 2, rotation joint 3, rotation joint 4, rotation joint 5 and rotation joint 6 from the mechanical arm base, and the six rotation joints rotate around the first joint axis, the second joint axis, the third joint axis, the fourth joint axis, the fifth joint axis and the sixth joint axis respectively, wherein the fourth joint axis and the fifth joint axis are perpendicular to each other, and the fifth joint axis and the sixth joint axis are perpendicular to each other. The end effector and the depth camera are both installed at the end of the 6-DOF mechanical arm, and the optical axis of the depth camera is parallel to the sixth joint axis, and the depth camera moves with the 6-DOF mechanical arm. The end effector is a two-finger parallel gripper installed on the mechanical arm rotation joint 6. The center point of the end of the two-finger parallel gripper is defined as the end of the mechanical arm.

[0065] In this embodiment, the two-finger parallel clamp can rotate freely along with the sixth joint, and the clamp can be opened and tightened to clamp the object.

[0066] In this embodiment, the depth camera is an Intel RealSense D415i real-sense depth camera, which has a ranging function.

[0067] In this embodiment, the three-position self-locking knob switch has three positions. When the operating handle is in the left position, the angle between the operating handle of the three-position self-locking knob switch and the positive direction of the image U axis is 135°, and the indicator arrow points to the upper left; when the operating handle is in the middle position, the angle between the operating handle of the three-position self-locking knob switch and the positive direction of the image U axis is 90°, and the indicator arrow points directly upward; when the operating handle is in the right position, the angle between the operating handle of the three-position self-locking knob switch and the positive direction of the image U axis is 45°, and the indicator arrow points to the upper right.

[0068] Figure 7 It is the overall flow chart of the present invention, Figure 8 It is a simplified flow chart of step 3 to step 7 of the present invention, Figure 7 and Figure 8 It can be seen that the detection and operation method comprises the following steps:

[0069] Step 1: Build a key point detection model for the knob switch.

[0070] The depth camera is used to take N images of the knob switch, and the captured images are annotated using the labelme annotation software to obtain three key points of the knob switch operating handle, which are respectively recorded as the arrow key point h, the center key point m and the tail key point t; K images are selected from the annotated images as a training set, and the remaining NK images are selected as a test set, K<N.

[0071] After the labeling is completed, the labeling file is obtained, and the labeling file and the labeled image are trained together with the YOLOv8 key point detection algorithm to obtain the key point detection model.

[0072] In this embodiment, the marking process of the three key points is as follows:

[0073] First, use the Labelme annotation software to annotate the training frame of the knob switch operating handle. The training frame covers the knob switch operating handle and its center coincides with the geometric center of the knob switch operating handle; the geometric center point of the knob switch operating handle is marked as the center key point m, the tip of the indicator arrow on the knob switch operating handle is marked as the arrow key point h, and the center point of the end edge of the other end of the knob switch operating handle without the indicator arrow is marked as the tail key point t.

[0074] Figure 2 Schematic diagram of labeling of collected images in the detection model in an embodiment of the present invention.

[0075] In this embodiment, the collection distance, lighting conditions and knob switch models are selected. Specifically, the distance is divided into five equal parts within the range of 20cm to 70cm from the operating surface of the electrical cabinet, with a total of 6 image collection distances; there are 3 different lighting conditions: turning on the indoor lighting during the day, turning off the indoor lighting during the day, and turning on the indoor lighting at night; there are 5 different models of three-position self-locking knob switches. Therefore, this example consists of N = 3 × 6 × 3 × 5 = 270 images, 54 of which are randomly selected to form the test set, accounting for 20%, and the remaining 216 images constitute the training set, accounting for 80%.

[0076] Step 2: Take a picture of the target image and confirm the current position of the knob switch.

[0077] Step 2.1, the robot moves to the area where the knob switch of the electrical cabinet is located, drives the 6-DOF robotic arm to unfold, and after unfolding, keeps the optical axis of the depth camera perpendicular to the front of the electrical cabinet, and the plane where the depth camera lens is located is parallel to the plane of the electrical cabinet. At this time, the two-finger parallel gripper of the end effector is also perpendicular to the front of the electrical cabinet; then use the depth camera to shoot the area where the knob switch is located, and during the shooting process, the knob switch is located at the center of the image. The captured image is recorded as the target image, and the pixel coordinates of the pixel point in the upper left corner of the target image in the pixel coordinate system of the target image are (0, 0).

[0078] The target image is detected using the key point detection model. Specifically, the key point detection model selects the knob switch operating handle in the target image through a detection frame 1. The width of the detection frame 1 in the pixel coordinate system of the target image is w and the height is The pixel coordinates of the upper left corner of detection frame 1 are (u r , v r ); The pixel coordinates of the arrow key point h, the center key point m and the tail key point t of the target image in the pixel coordinate system of the target image are obtained through the detection frame 1, which are respectively recorded as the arrow key point coordinates (u h , v h ), center key point coordinates (u m , v m ) and the tail key point coordinates (u t , v t ), and the depth information of the central key point m is also obtained and recorded as depth d m .

[0079] Step 2.2, based on the information of the detection frame and the three key points of the target image, judge the current position of the knob switch according to the given confirmation criteria: if the current position of the knob switch is different from the expected position, go to step 3; if the current position of the knob switch is the same as the expected position, end this operation.

[0080] In this embodiment, the knob switch is a three-position self-locking knob switch. In step 2.2 and step 9, the knob switch position confirmation criteria are: when the arrow key point h satisfies and When the current knob switch position is in the left position, it is considered that the current knob switch position is in the left position; when the arrow key point h satisfies and When the current knob switch position is in the left position, it is considered that the current knob switch position is in the left position; when the arrow key point h satisfies and , it is considered that the current knob switch position is in the right position.

[0081] Figure 3 is a schematic diagram of target image annotation in an embodiment of the present invention, Figure 4 Schematic diagram of determining the current gear position of the knob switch in an embodiment of the present invention.

[0082] Step 3: Define the pose transformation matrix of the robot end coordinate system relative to the robot end effector coordinate system The pose transformation matrix of the robot end effector relative to the robot base coordinate system And the pose transformation matrix of the camera coordinate system relative to the robot end coordinate system Then, the camera calibration algorithm is used to calibrate the depth camera to obtain the intrinsic parameter matrix M of the depth camera.

[0083] According to the coordinates of the central key point of the target image (u m , v m ) and depth information d m , the pose transformation PC of the camera coordinate system relative to the robot end coordinate system is calculated through the calibrated intrinsic parameter matrix M,

[0084] The position of the center key point m relative to the robot base coordinate system is PB, and its expression is as follows:

[0085]

[0086] Where PC′ is a 4×1 matrix,

[0087] The coordinates of position PB in the robot base coordinate system are marked as (x p ,y p , z p ), the coordinate (x p ,y p , z p ) is the coordinate of the key point m at the center of the target image in the robot base coordinate system.

[0088] Step 4: Define point P0 as the center point of the end of the two parallel grippers of the robot arm, along the sixth joint axis of the robot arm away from the operating surface of the electrical cabinet, and the straight-line distance from the key point m at the center of the knob switch operating handle is d. m0 At, modify the d in the PC formula of the pose transformation in step 3 m is d m0 , and obtain the position coordinates of point P0 in the robot base coordinate system, recorded as (x p0 ,y p0 , z p0 ); Control the robot arm so that the center point of the end of the two-finger parallel gripper reaches point P0. The posture of the robot arm at this time is recorded as Z0;

[0089] In this embodiment, d m0 =48cm.

[0090] Step 5: Fit the arrow key point h, center key point m and tail key point t into a straight line using the least squares method. The slope of the fitted line is k, the intercept is b, and the angle between the fitted line and the positive direction of the image U axis is θ. l .

[0091] In this embodiment, the implementation process of step 5 is as follows:

[0092] The arrow key point h, center key point m and tail key point t are fitted into a straight line using the least squares method. The slope of the fitted line is k, the intercept is b, the equation of the fitted line is y=kx+b, and the simultaneous equations are:

[0093]

[0094] The angle between the fitting straight line and the positive direction of the U axis of the image is recorded as θ1, θ1=arctan k, 0≤θ1<π.

[0095] Figure 5 Schematic diagram of straight line fitting of key points in an embodiment of the present invention.

[0096] Step 6: Rotate the two-finger parallel gripper to an angle of θ1 with the positive direction of the image U axis; define point P1 as the center point of the end of the two-finger parallel gripper of the robot arm, along the sixth joint axis of the robot arm close to the operating surface of the electrical cabinet, and the straight-line distance from point P0 is d m1 At, modify the d in the PC formula of the pose transformation in step 3 m is d m1 , and obtain the position coordinates of point P1 in the robot base coordinate system, recorded as (x p1 ,y p1 , z p1); control the robot arm so that the center point of the end of the two-finger parallel gripper reaches point P1; after reaching the target position, tighten the two-finger parallel gripper, that is, clamp the operating handle of the knob switch;

[0097] In this embodiment, d m1 =50cm.

[0098] Figure 6 Schematic diagram of the relative position relationship between point P0 and point P1 in an embodiment of the present invention.

[0099] Step 7: Note that the angle between the knob switch operating handle of the desired gear position of the knob switch and the positive direction of the image U axis is θ i , and 0≤θ i <π, if θ1-θ i >0, the two-finger parallel gripper is controlled to rotate the knob switch operating handle clockwise |θ1-θ i |, if θ1-θ i <0, the two-finger parallel gripper is controlled to rotate the knob switch operating handle counterclockwise |θ1-θ i |, then release the gripper and restore the robot arm to the robot arm posture Z0 described in step 4.

[0100] Step 8, use a depth camera to shoot the area where the knob switch is located after rotation, and record the image as the test image; detect the test image using the key point detection model described in step 1 to obtain a detection frame 2 at the location of the knob switch in the test image. The width of the detection frame 2 in the pixel coordinate system of the test image is w2 and the height is The pixel coordinates of the upper left corner of detection frame 2 are (u r2 , v r2 ); The pixel coordinates of the arrow key point h2, the center key point m2 and the tail key point t2 of the inspection image in the pixel coordinate system of the inspection image are obtained through the detection frame 2, which are respectively recorded as (u h2 , v h2 )、(u m2 , v m2 ) and (u t2 , vt2).

[0101] Step 9, based on the information of the detection frame 2 and the three key points of the inspection image obtained in step 8, judge the gear state after rotation according to the method of step 2.2. If the gear state of the knob switch is consistent with the expected gear state at this time, it is considered that the expected operation of the knob switch is completed, otherwise, repeat the operations of steps 2 to 9.

[0102] In this embodiment, the posture transformation matrix in step 3 is Pose transformation matrix Pose transformation matrix The definition process of the internal parameter matrix M is as follows:

[0103] Define the first 3×3 rotation matrix Used to describe the coordinate rotation of the robot end coordinate system relative to the robot end effector coordinate system, defining the first translation vector of 3×1 It is used to describe the coordinate translation of the robot end coordinate system relative to the robot end effector coordinate system. The robot system obtains the pose transformation matrix of the robot end coordinate system relative to the robot end effector coordinate system. Its expression is:

[0104]

[0105] Define the second 3×3 rotation matrix Used to describe the coordinate rotation of the robot end effector coordinate system relative to the robot base coordinate system, defining a 3×1 second translation vector It is used to describe the coordinate translation of the robot end effector coordinate system relative to the robot base coordinate system. The robot system obtains the pose transformation matrix of the robot end effector relative to the robot base coordinate system. Its expression is:

[0106]

[0107] Define the pose transformation matrix describing the camera coordinate system relative to the robot end coordinate system Its expression is:

[0108]

[0109] In the formula, is a 3×3 rotation matrix used to describe the coordinate rotation of the camera coordinate system relative to the coordinate system of the end of the robot arm. is a 3×1 translation vector used to describe the coordinate translation of the camera coordinate system relative to the coordinate system of the robot end;

[0110] The camera calibration algorithm is used to calibrate the depth camera. The calibration result is the intrinsic parameter matrix M of the depth camera, which is expressed as:

[0111]

[0112] In the formula, f x is the normalized focal length on the image X axis in the image coordinate system, f x =f / d x , f is the focal length of the depth camera, d x is the physical size of each pixel in the pixel coordinate system on the X-axis of the image; f yis the normalized focal length on the Y axis of the image in the image coordinate system, f y =f / d y , d y is the physical size of each pixel in the pixel coordinate system on the Y axis of the image; u0 is the horizontal coordinate of the origin of the image coordinate system in the pixel coordinate system, and v0 is the vertical coordinate of the origin of the image coordinate system in the pixel coordinate system, that is, the coordinates of the origin of the image coordinate system in the pixel coordinate system are (u0, v0).

[0113] In the present invention, the pixel coordinate system is a rectangular coordinate system established with the upper left corner of the image as the origin and in pixels, including mutually perpendicular pixel U-axis and pixel V-axis, the horizontal coordinate on the pixel U-axis is the number of columns of the pixel in its image, the direction is parallel to the image plane and facing right, the vertical coordinate on the pixel V-axis is the number of rows of the pixel in its image, the direction is perpendicular to the pixel U-axis and downward. The image coordinate system is a coordinate system established with the intersection of the camera optical axis and the image plane as the origin, including mutually perpendicular image X-axis and image Y-axis, the image X-axis is parallel to the pixel U-axis and has the same direction, and the image Y-axis is parallel to the pixel V-axis and has the same direction.

Claims

1. A method for detecting and operating a knob switch of an electrical cabinet, the method involving a system comprising a robot and an electrical cabinet; a knob switch is mounted on an operation panel of the electrical cabinet, the knob switch is a multi-position self-locking knob switch, and an indicating arrow is marked on one end of the operating handle of the knob switch; The robot comprises a 6-DOF mechanical arm, an end effector and a depth camera, wherein the 6-DOF mechanical arm comprises 6 rotation joints and a mechanical arm base, wherein the 6 rotation joints are rotation joint 1, rotation joint 2, rotation joint 3, rotation joint 4, rotation joint 5 and rotation joint 6 in sequence from the mechanical arm base, and the six rotation joints rotate around a first joint axis, a second joint axis, a third joint axis, a fourth joint axis, a fifth joint axis and a sixth joint axis in sequence, respectively, wherein: The fourth joint axis and the fifth joint axis are perpendicular to each other, and the fifth joint axis and the sixth joint axis are perpendicular to each other; the end effector and the depth camera are both installed at the end of the 6-DOF robotic arm, and the optical axis of the depth camera is parallel to the sixth joint axis, and the depth camera moves with the 6-DOF robotic arm; the end effector is a two-finger parallel gripper installed on the sixth rotating joint of the robotic arm; the center point of the end of the two-finger parallel gripper is defined as the end of the robotic arm; Characterized in that the detection and operation method comprises the following steps: Step 1, construct a key point detection model for the knob switch; The depth camera is used to take N images of the knob switch, and the collected images are annotated with the labelme annotation software to obtain three key points of the knob switch operating handle, which are respectively recorded as the arrow key point h, the center key point m and the tail key point t; K images are selected from the annotated images as the training set, and the remaining NK images are selected as the test set. <N; After the annotation is completed, the annotation file is obtained, and the annotation file and the annotated image are trained using the YOLOv8 key point detection algorithm to obtain a key point detection model; Step 2, capture the target image and confirm the current position of the knob switch; Step 2.1, the robot moves to the area where the knob switch of the electrical cabinet is located, drives the 6-DOF manipulator to unfold, and after unfolding, keeps the optical axis of the depth camera perpendicular to the operating surface of the electrical cabinet, and the plane where the depth camera lens is located is parallel to the operating surface of the electrical cabinet. At this time, the two-finger parallel gripper of the end effector is also perpendicular to the operating surface of the electrical cabinet; then use the depth camera to shoot the area where the knob switch is located, and during the shooting process, the knob switch is located at the center of the image. The image obtained by shooting is recorded as the target image, and the pixel coordinates of the pixel point in the upper left corner of the target image in the pixel coordinate system of the target image are (0, 0); The target image is detected using the key point detection model. Specifically, the key point detection model selects the knob switch operating handle in the target image through a detection frame 1. The width of the detection frame 1 in the pixel coordinate system of the target image is w and the height is The pixel coordinates of the upper left corner of detection frame 1 are (u r , v r ); The pixel coordinates of the arrow key point h, the center key point m and the tail key point t of the target image in the pixel coordinate system of the target image are obtained through the detection frame 1, which are respectively recorded as the arrow key point coordinates (u h , v h ), center key point coordinates (u m , v m ) and the tail key point coordinates (u t , v t ), and the depth information of the central key point m is also obtained and recorded as depth d m ; Step 2.2, based on the information of the detection frame and the three key points of the target image, the current gear position of the knob switch is judged according to the given confirmation criteria: if the current gear position of the knob switch is different from the expected gear position, proceed to step 3; if the current gear position of the knob switch is the same as the expected gear position, end this operation; Step 3: Define the pose transformation matrix of the robot end coordinate system relative to the robot end effector coordinate system The pose transformation matrix of the robot end effector relative to the robot base coordinate system And the pose transformation matrix of the camera coordinate system relative to the robot end coordinate system Then use the camera calibration algorithm to calibrate the depth camera to obtain the intrinsic parameter matrix M of the depth camera; According to the coordinates of the central key point of the target image (u m , v m ) and depth information d m , the pose transformation PC of the camera coordinate system relative to the robot end coordinate system is calculated through the calibrated intrinsic parameter matrix M, The position of the center key point m relative to the robot base coordinate system is PB, and its expression is as follows: Where PC′ is a 4×1 matrix, The coordinates of position PB in the robot base coordinate system are marked as (x p ,y p , z p ), the coordinate (x p ,y p , z p ) is the coordinate of the key point m at the center of the target image in the robot base coordinate system; Step 4, define point P0 as the center point of the end of the two parallel grippers of the robot arm along the sixth joint axis of the robot arm away from the operating surface of the electrical cabinet, and the straight line distance from the center key point m of the knob switch operating handle is dm0. Modify the d in the PC formula of the posture transformation in step 3 m is d m0 , and obtain the position coordinates of point P0 in the robot base coordinate system, recorded as (x p0 ,y p0 , z p0 ); Control the robot arm so that the center point of the end of the two-finger parallel gripper reaches point P0. The posture of the robot arm at this time is recorded as Z0; Step 5: Fit the arrow key point h, center key point m and tail key point t into a straight line using the least squares method. The slope of the fitted line is k, the intercept is b, and the angle between the fitted line and the positive direction of the image U axis is θ. l ; Step 6: Rotate the two-finger parallel gripper to an angle of θ1 with the positive direction of the image U axis; define point P1 as the center point of the end of the two-finger parallel gripper of the robot arm, along the sixth joint axis of the robot arm close to the operating surface of the electrical cabinet, and the straight-line distance from point P0 is d m1 At, modify the d in the PC formula of the pose transformation in step 3 m is d m1 , and obtain the position coordinates of point P1 in the robot base coordinate system, recorded as (x p1 ,y p1 , z p1 ); control the robot arm so that the center point of the end of the two-finger parallel gripper reaches point P1; after reaching the target position, tighten the two-finger parallel gripper, that is, clamp the operating handle of the knob switch; Step 7: Note that the angle between the desired position of the knob switch and the positive direction of the image U axis is θ i , and 0≤θ i <π, if θ1-θ i >0, the two-finger parallel gripper is controlled to rotate the knob switch operating handle clockwise |θ1-θ i |, if θ1-θ i <0, the two-finger parallel gripper is controlled to rotate the knob switch operating handle counterclockwise |θ1-θ i |, then release the gripper and restore the robot arm to the robot arm posture Z0 described in step 4; Step 8: Use a depth camera to capture the area where the knob switch is located after rotation, and record the image as a test image; detect the test image using the key point detection model described in step 1 to obtain a detection frame 2 where the knob switch is located in the test image. The width of the detection frame 2 in the pixel coordinate system of the test image is w2, the height is 62, and the pixel coordinates of the upper left corner of the detection frame 2 are (u r2 , v r2 ); The pixel coordinates of the arrow key point h2, the center key point m2 and the tail key point t2 of the inspection image in the pixel coordinate system of the inspection image are obtained through the detection frame 2, which are respectively recorded as (u h2 , v h2 )、(u m2 , v m2 ) and (u t2 , v t2 ); Step 9, based on the information of the detection frame 2 and the three key points of the inspection image obtained in step 8, judge the gear state after rotation according to the confirmation criteria described in step 2.

2. If the gear state of the knob switch is consistent with the expected gear state at this time, it is considered that the expected operation of the knob switch is completed, otherwise, repeat the operations of steps 2 to 9.

2. The method for detecting and operating the position of a knob switch of an electrical cabinet according to claim 1, characterized in that: The marking process of the three key points of the knob switch operating handle in step 1 is as follows: First, use the Labelme annotation software to annotate the training frame of the knob switch operating handle. The training frame covers the knob switch operating handle and its center coincides with the geometric center of the knob switch operating handle; the geometric center point of the knob switch operating handle is marked as the center key point m, the tip of the indicator arrow on the knob switch operating handle is marked as the arrow key point h, and the center point of the end edge of the other end of the knob switch operating handle without the indicator arrow is marked as the tail key point t.

3. The method for detecting and operating the position of a knob switch of an electrical cabinet according to claim 1, characterized in that: The knob switch is a three-position self-locking knob switch. In step 2.2 and step 9, the knob switch position confirmation criteria are: when the arrow key point h satisfies and When the current knob switch position is in the left position, it is considered that the current knob switch position is in the left position; when the arrow key point h satisfies and When the current knob switch position is in the middle position, it is considered that the current knob switch position is in the middle position; when the arrow key point h satisfies and , it is considered that the current knob switch position is in the right position.

4. The method for detecting and operating the position of a knob switch of an electrical cabinet according to claim 1, characterized in that: Step 3: The pose transformation matrix Pose transformation matrix Pose transformation matrix The definition process of the internal parameter matrix M is as follows: Define the first 3×3 rotation matrix Used to describe the coordinate rotation of the robot end coordinate system relative to the robot end effector coordinate system, defining the first translation vector of 3×1 It is used to describe the coordinate translation of the robot end coordinate system relative to the robot end effector coordinate system. The robot system obtains the pose transformation matrix of the robot end coordinate system relative to the robot end effector coordinate system. Its expression is: Define the second 3×3 rotation matrix Used to describe the coordinate rotation of the robot end effector coordinate system relative to the robot base coordinate system, defining a 3×1 second translation vector It is used to describe the coordinate translation of the robot end effector coordinate system relative to the robot base coordinate system. The robot system obtains the pose transformation matrix of the robot end effector relative to the robot base coordinate system. Its expression is: Define the pose transformation matrix describing the camera coordinate system relative to the robot end coordinate system Its expression is: In the formula, is a 3×3 rotation matrix used to describe the coordinate rotation of the camera coordinate system relative to the coordinate system of the end of the robot arm. is a 3×1 translation vector used to describe the coordinate translation of the camera coordinate system relative to the coordinate system of the robot end; The camera calibration algorithm is used to calibrate the depth camera. The calibration result is the intrinsic parameter matrix M of the depth camera, which is expressed as: In the formula, f x is the normalized focal length on the image X axis in the image coordinate system, f x =f / d x , f is the focal length of the depth camera, d x is the physical size of each pixel in the pixel coordinate system on the X-axis of the image; f y is the normalized focal length on the Y axis of the image in the image coordinate system, f y =f / d y , d y is the physical size of each pixel in the pixel coordinate system on the Y axis of the image; u0 is the horizontal coordinate of the origin of the image coordinate system in the pixel coordinate system, v0 is the vertical coordinate of the origin of the image coordinate system in the pixel coordinate system, that is, the coordinates of the origin of the image coordinate system in the pixel coordinate system are (u0, V0).

5. The method for detecting and operating the position of a knob switch of an electrical cabinet according to claim 1, characterized in that: The implementation process of step 5 is as follows: The arrow key point h, center key point m and tail key point t are fitted into a straight line using the least squares method. The slope of the fitted line is k, the intercept is b, the equation of the fitted line is y=kx+b, and the simultaneous equations are: The angle between the fitting straight line and the positive direction of the image U axis is denoted as θ1, θ1=arctank, 0≤θ1<π.

Citation Information

Cited By

  • Knob switch pose detection method based on multi-point fitting

    CN120125531A

  • A method for detecting the position of a rotary switch based on multi-point fitting

    CN120125531B