A monocular vision PnP automatic charging alignment system and method combined with lifting shaft freedom distribution

By combining a monocular camera with a 3D reference model and phased control, the problem of inaccurate charging port pose recovery during automatic charging was solved, achieving a high-precision and safe automatic charging alignment process, and improving charging efficiency and success rate.

CN123129760APending Publication Date: 2026-11-20WUHAN JUGAN TIMES ROBOT TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611091866.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-22
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

In existing automatic charging solutions, monocular vision is insufficient to recover the complete three-dimensional pose of the charging port. PnP calculation is prone to jumps due to the unstable correspondence of feature points. Vertical height error lacks an independent priority compensation channel, resulting in severe coupling of multi-degree-of-freedom control. The alignment process lacks a phased strategy and an abnormal backoff mechanism, affecting charging accuracy and efficiency.

Method used

A monocular camera is used to acquire images of the charging port. Two-dimensional feature points are extracted through contour recognition. PnP pose calculation is performed in combination with a preset three-dimensional reference model. The pose error is decomposed so that the vertical error is borne first by the servo lifting axis, and the remaining error is borne by the other degrees of freedom of the robotic arm. A phased control strategy is designed, including coarse alignment, fine alignment and low-speed insertion stages, and an abnormal backoff mechanism is introduced.

Benefits of technology

High-precision and stable estimation of the three-dimensional pose of the charging port was achieved under low-cost conditions, with priority compensation for vertical errors and multi-stage adaptive alignment and insertion, which improved the accuracy, efficiency and robustness of automatic charging and ensured the safety and success rate of the insertion process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123129760A_ABST
    Figure CN123129760A_ABST
Patent Text Reader

Abstract

This invention discloses a monocular vision PnP automatic charging alignment system and method combining lifting axis degree of freedom allocation. The system includes: preprocessing the charging port image, performing contour recognition and feature point sorting to obtain an ordered two-dimensional point set corresponding to a three-dimensional model; calculating the initial pose of the charging port relative to the camera using the PnP algorithm, and after verification of reprojection error, depth, and time sequence continuity, fusing multiple frames of data to obtain a stable target pose, which is then converted to the robotic arm's base coordinate system using a hand-eye calibration matrix. The error between this target pose and the current pose of the charging gun is calculated and decomposed into vertical error and other multi-directional errors. The vertical error is preferentially compensated by an independent servo lifting axis, while other errors are compensated by other degrees of freedom of the robotic arm. Finally, based on pose error, reprojection error, and other conditions, the system sequentially and automatically switches between three stages: coarse alignment, fine alignment, and low-speed insertion, driving the robotic arm to complete high-precision alignment and insertion operations.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of automatic charging for new energy vehicles, specifically to a monocular vision PnP automatic charging alignment system and method that combines the degree of freedom allocation of the lifting axis. Background Technology

[0002] One of the core challenges of automatic charging systems for new energy vehicles lies in the precise, high-constraint automatic alignment and insertion of the charging gun and the vehicle's charging port with minimal gap. This process essentially falls under the category of spatial pose recognition and assembly execution problems. It requires the system to not only identify the position of the charging port in three-dimensional space, but also its opening direction, normal orientation, and deviation from the charging gun's insertion axis. Furthermore, it must achieve stable, continuous, and low-impact alignment and propulsion control at the actuator level.

[0003] Existing automatic charging solutions typically employ binocular cameras, depth cameras, structured light, laser ranging, millimeter-wave radar, or multi-sensor fusion to identify the charging port location, followed by a multi-degree-of-freedom robotic arm to perform the approach, calibration, and insertion actions. While binocular or depth-based solutions can directly provide depth information, their overall hardware costs are high, installation and calibration are complex, and their stability remains insufficient under outdoor conditions such as reflective paint, low light, rain, fog, dirt, and shadows. Some low-cost solutions use monocular vision for detection, but often only output a two-dimensional target box, center point, or rough outline position. Without a known three-dimensional reference model, camera calibration parameters, and a stable correspondence between two-dimensional and three-dimensional feature points, it is difficult to recover the complete spatial pose of the charging port relative to the camera or charging gun, thus failing to meet the positional and directional accuracy requirements of automatic insertion.

[0004] On the other hand, at the actuator control level, existing solutions often assign the target pose error to all degrees of freedom of the robotic arm for joint calculation, without establishing a dedicated priority compensation channel for vertical errors. In automatic charging scenarios, the charging port heights vary significantly between different vehicle models, and even the same vehicle model will exhibit significant vertical deviations under different parking postures. If height errors are still compensated through the coordinated efforts of multiple joints, it can easily lead to complex inverse decoupling, insufficient control rigidity, slow vertical adjustment response, and large end-effector trajectory disturbances, thereby affecting the precision alignment quality and insertion stability.

[0005] Furthermore, existing automatic alignment control systems often fail to explicitly distinguish between the three stages of coarse alignment, fine alignment, and low-speed insertion. Even when stages are defined, there is a lack of error thresholds and degree-of-freedom allocation strategies that are adapted to the visual pose accuracy between each stage. This can easily lead to an overly conservative and inefficient coarse alignment stage, or insufficiently strict control in the fine and insertion stages, resulting in lateral interference, attitude deviation, jamming, and mis-insertion.

[0006] Therefore, there is a need for an automatic charging alignment method that can stably extract the contour features of the charging port and reliably recover the spatial pose under low-cost monocular vision conditions, and distribute the pose error according to the principle that "the servo lifting axis takes priority to bear the vertical direction error, and the remaining degrees of freedom bear the lateral and attitude errors," while coordinating coarse alignment, fine alignment and low-speed insertion staged control. Summary of the Invention

[0007] The purpose of this invention is to provide a monocular vision PnP automatic charging alignment system and method that combines lifting axis degree of freedom allocation. This system and method can acquire images of the vehicle charging port area using a monocular camera without relying on binocular cameras, depth cameras, or laser rangefinders. Key two-dimensional feature points of the charging port are extracted through contour recognition. PnP pose calculation is performed according to a preset three-dimensional reference model of the charging port structure to obtain the spatial pose of the charging port relative to the camera coordinate system. Then, according to the calibration relationship between the camera coordinate system and the robotic arm control coordinate system, the target pose is transformed to the robotic arm control coordinate system. Subsequently, the error between the current pose of the charging gun and the target pose is decomposed into vertical direction error, horizontal direction error, attitude direction error, and axial propulsion error. The vertical direction error is preferentially borne by the servo lifting axis, and the remaining errors are borne by the other degrees of freedom of the robotic arm. Finally, a phased closed-loop control is performed in combination with three stages: coarse alignment, fine alignment, and low-speed insertion. In case of abnormality, backtracking, re-identification, and retry are performed.

[0008] To achieve this objective, the present invention provides a monocular vision PnP automatic charging alignment system that combines lifting axis degree of freedom allocation, comprising: The vision processing module is used to preprocess and perform contour recognition on the original image of the charging port area acquired by the monocular camera to obtain a set of disordered two-dimensional feature data points of the charging port. Based on the preset set of three-dimensional reference data points of the charging port, the disordered two-dimensional feature data points of the charging port are sorted to obtain a set of ordered two-dimensional feature data points of the charging port. The pose calculation module is used to execute the PnP algorithm based on the ordered two-dimensional feature data point set of the charging port, the preset three-dimensional reference data point set of the charging port, the camera intrinsic parameter matrix and distortion parameters, to obtain the initial target pose of the charging port relative to the camera coordinate system. The module performs credibility verification and historical frame fusion on the initial target pose to obtain the stable target pose of the charging port relative to the camera coordinate system. The module then transforms the stable target pose of the charging port relative to the camera coordinate system from the camera coordinate system to the robot arm base coordinate system to obtain the stable target pose of the charging port in the robot arm base coordinate system. The error decomposition and compensation module is used to calculate the pose error between the stable target pose of the charging port and the current pose of the charging gun in the base coordinate system of the robotic arm, and decompose the pose error into vertical direction error and other multi-directional errors. The vertical direction error is preferentially allocated to the servo lifting axis of the robotic arm to generate the lifting axis compensation amount, and the other multi-directional errors are allocated to the other degrees of freedom of the robotic arm to generate the robotic arm compensation amount. The phased control module is used to drive the robotic arm to achieve plug-in control between the charging gun and the charging port based on the compensation amount of the lifting axis and the compensation amount of the robotic arm. In the plug-in control, the module switches between the coarse alignment control stage, the fine alignment control stage, and the low-speed plug-in control stage in sequence, based on whether the pose error meets the set constraint conditions.

[0009] The beneficial effects of this invention are as follows: Addressing the problems in existing automatic charging solutions, such as the difficulty in recovering the complete 3D pose of the charging port using monocular vision, the tendency for PnP calculations to jump due to unstable feature point correspondences, the lack of an independent priority compensation channel for vertical height errors leading to severe coupling in multi-degree-of-freedom control, and the lack of a phased strategy and anomaly backoff mechanism adapted to visual accuracy during the alignment process, this invention performs robust preprocessing and contour recognition on the charging port image acquired by a monocular camera, extracts disordered 2D feature points, and establishes a stable one-to-one correspondence based on a preset 3D model and fixed rules. This provides data input with higher geometric consistency for PnP solutions, improving the reliability of pose recovery. Furthermore, the initial pose calculated by PnP is subjected to triple reliability checks: reprojection error, depth rationality, and time sequence continuity. Finally, historical multi-frame data is fused to obtain a stable target pose. This effectively suppresses single-frame noise and jumps, enhancing the system's robustness in complex environments. Based on this, the stable target pose is transformed to the robotic arm's base coordinate system, and the error between the target pose and the charging gun's current pose is calculated. After decomposing the error, the vertical height error is preferentially allocated to an independent servo lifting axis for compensation, thereby distributing the horizontal and attitude errors to the remaining degrees of freedom of the robotic arm. This achieves high rigidity, rapid response adjustment, and control decoupling in the vertical direction. Simultaneously, a three-stage alignment process—coarse alignment, fine alignment, and low-speed insertion—is designed, using pose error, reprojection error, and the number of consecutive stable frames as criteria. Through progressively tightening thresholds and differentiated control strategies, the system is guided from rapid approach to smooth transition to high-precision alignment and compliant insertion. Furthermore, by constructing a real-time anomaly scoring and failure handling process, the system can immediately and safely revert and retry or terminate when deviations or failures occur during insertion. Ultimately, using only a low-cost monocular camera, we simultaneously achieved high-precision and stable estimation of the charging port's three-dimensional pose, priority and independent compensation for vertical errors, multi-stage adaptive alignment and insertion, and full-process safety monitoring, significantly improving the accuracy, efficiency, robustness, and overall success rate of automatic charging alignment. Attached Figure Description

[0010] Figure 1 This is a flowchart illustrating the overall process of the method of the present invention. Figure 2 This is a flowchart of the algorithm decision-making process of the present invention; Figure 3 This is a schematic diagram of the priority degree of freedom allocation of the servo lifting axis of the present invention; Figure 4 This is a diagram showing the distribution structure of the robotic arm motors according to the present invention; Figure 5 This is a schematic diagram of the structure of the present invention. Detailed Implementation

[0011] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, not all of them. Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to represent selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.

[0012] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments: Example 1 like Figure 5 As shown, a monocular vision PnP automatic charging alignment system combining lifting axis degree of freedom allocation includes: The vision processing module is used to preprocess and perform contour recognition on the original image of the charging port area acquired by the monocular camera to obtain a set of disordered two-dimensional feature data points of the charging port. Based on the preset three-dimensional reference data point set of the charging port, the disordered two-dimensional feature data point set of the charging port is sorted to obtain an ordered set of two-dimensional feature data points of the charging port corresponding to the three-dimensional reference data point set of the charging port. The pose calculation module is used to execute the PnP algorithm based on the ordered two-dimensional feature data point set of the charging port, the preset three-dimensional reference data point set of the charging port, the camera intrinsic parameter matrix and distortion parameters, to obtain the initial target pose of the charging port relative to the camera coordinate system. The module performs credibility verification and historical frame fusion on the initial target pose to obtain the stable target pose of the charging port relative to the camera coordinate system. The module then transforms the stable target pose of the charging port relative to the camera coordinate system from the camera coordinate system to the robot arm base coordinate system to obtain the stable target pose of the charging port in the robot arm base coordinate system. The error decomposition and compensation module is used to calculate the pose error between the stable target pose of the charging port and the current pose of the charging gun in the base coordinate system of the robotic arm, and decompose the pose error into vertical direction error and other multi-directional errors. The vertical direction error is preferentially allocated to the servo lifting axis of the robotic arm to generate the lifting axis compensation amount, and the other multi-directional errors are allocated to the other degrees of freedom of the robotic arm to generate the robotic arm compensation amount. The phased control module is used to drive the robotic arm to achieve plug-in control between the charging gun and the charging port based on the compensation amount of the lifting axis and the compensation amount of the robotic arm. In the plug-in control, the module uses whether the pose error meets the set constraint conditions as the criterion to switch between the coarse alignment control stage, the fine alignment control stage and the low-speed plug-in control stage between the charging gun and the charging port in sequence, so as to realize the alignment and charging of the charging gun and the charging port.

[0013] In some embodiments, the method for presetting a set of three-dimensional reference data points for a charging port includes: For a national standard AC charging port, its panel has 7 physical holes, including 1 protective ground (PE), 1 neutral wire (N), 1 live wire (L), 1 neutral wire (CP), 1 control confirmation (CC), and 2 spare holes. The geometric center of the panel is selected as the origin O, perpendicular to the charging port panel plane, and pointing outwards from the inside of the charging port (i.e., towards the camera / plug direction) as the positive Z-axis. The X-axis is horizontally to the right along the charging port, and the Y-axis is vertically upwards along the charging port, with the X-axis and Y-axis perpendicular to each other. The precise relative position dimensions of the 7 physical holes of the charging port are obtained (e.g., the center distance between holes, the distance to the panel boundary, etc.). In the charging port coordinate system (X, Y, Z), three-dimensional coordinates are assigned to the center of each hole (or other easily identifiable contour corner points in the image). Since all points lie on the same plane (panel plane), this plane is defined as the plane with Z=0.

[0014] The overall flowchart of the method of the present invention is as follows: Figure 1As shown, the system first acquires images of the charging port area using a monocular camera. After preprocessing and contour extraction, an unordered set of two-dimensional feature data points is generated. Then, a pre-defined set of three-dimensional reference data points is used to sort this unordered set. The Perspective-n-Point (PnP) algorithm is executed using camera intrinsics and distortion parameters to calculate the initial target pose of the charging port relative to the camera coordinate system. To ensure the reliability of the pose data, the system performs a credibility check on the initial pose (including reprojection error, depth range, and frame stability judgment), and obtains a stable target pose through temporal fusion filtering. The stable pose is then transformed from the camera coordinate system to the robotic arm's base coordinate system using a hand-eye calibration matrix. In the control execution phase, the system calculates the multi-dimensional pose error between the current pose of the charging gun at the robotic arm's end effector and the target pose. A decoupling strategy is used to preferentially allocate the vertical error to the independent servo lifting axis for pre-compensation, while the horizontal and attitude errors are allocated to the remaining degrees of freedom of the robotic arm for collaborative compensation. Finally, based on real-time state variables such as pose error and reprojection error, the system automatically switches between three progressive control stages: coarse alignment, fine alignment, and low-speed insertion, to achieve high-precision and smooth insertion between the charging gun and the charging port. If insertion failure or abnormality is detected at any stage, the corresponding rollback and re-identification safety mechanism is triggered to complete the entire automatic charging process.

[0015] Some technical solutions include methods for obtaining an ordered set of two-dimensional feature data points of the charging port corresponding to the set of three-dimensional reference data points of the charging port: Preprocessing operators are used to preprocess the original image of the charging port area acquired by the monocular camera: ;in, Original image of the charging port area. This is the preprocessed image of the charging port area. Preprocessing operators are mathematical descriptions or algorithmic encapsulations used to perform a series of standardized image preprocessing operations on the raw image of the charging port area acquired by a monocular camera, thus transforming the raw image... Convert into a preprocessed image suitable for subsequent contour recognition and feature point extraction The image preprocessing operation includes one or more of the following steps: region of interest cropping; grayscale conversion; median filtering, Gaussian filtering, or bilateral filtering for noise reduction; brightness equalization or contrast enhancement; edge enhancement; binarization; and morphological processing such as opening / closing operations, erosion, and dilation. To ensure that contour recognition is adaptable to different environments, the preprocessing parameters can be adjusted according to the current image brightness, contrast, and texture complexity.

[0016] Contour recognition is performed on the preprocessed charging port area image to obtain a set of candidate charging port contours. : ; in, This is the first candidate contour in the set of candidate contours for the charging port. This is the second candidate contour in the set of candidate contours for the charging port. The nth candidate contour in the set of candidate contours for the charging port; Candidate profile set for charging ports Multi-dimensional filtering is performed to obtain the target charging port outline, and the set of disordered two-dimensional feature data points of the charging port in the target charging port outline is extracted. , ;in, The i-th unordered two-dimensional feature data point of the target charging port contour. The coordinates are ; Based on the standard structural dimensions of the target charging port, establish a set of three-dimensional reference data points in the charging port coordinate system. : ; in, Let i be the i-th 3D reference data point in the set of 3D reference data points. The coordinates are ; The unordered two-dimensional feature data point set of the charging port is sorted based on the preset three-dimensional reference data point set of the charging port to obtain the ordered two-dimensional feature data point set of the charging port corresponding to the three-dimensional reference data point set of the charging port.

[0017] In some embodiments, a set of three-dimensional reference data points The following principles must be met: Each point has a clear geometric and physical meaning, such as the corner point of the charging port outline, the center point of the circular hole, the intersection of the edges, the center point of the positioning hole, or the boundary point of the standard opening; The relative positions between the points are stable. Relative position stability means that these reference points belong to a fixed geometric structure within the charging port body, and their mutual distances, angles, and topological relationships do not change with image shooting angle, lighting variations, robotic arm movement, or vehicle parking posture. For example, if multiple hole centers are selected as reference points, the actual physical distance between any two hole centers remains unchanged after the charging port is manufactured. The distribution of charging points should cover the main structural outline of the charging port as much as possible, avoiding concentration of all points in a local area; The point layout avoids collinear or near-degenerate distributions to ensure the stability of PnP (Perspective-n-Point) solutions; The number of points must meet the requirements for stable PnP solutions, usually no less than 4, and at least 6 feature points with stable geometric significance should be used.

[0018] The method for sorting an unordered two-dimensional feature data point set of a charging port based on a preset three-dimensional reference data point set includes: a three-dimensional reference point set. The four vertex points of a rectangle defined in the charging port coordinate system are obtained in advance and stored in a clockwise direction: top left corner P1=(X1,Y1,Z1), top right corner P2=(X2,Y2,Z2), bottom right corner P3=(X3,Y3,Z3). The bottom left corner P4 = (X4, Y4, Z4). From the camera image, contour extraction may yield the same four pixels pA, pB, pC, pD, but their storage order is random, for example, it might be [pB, pD, pA, pC]. For a two-dimensional point set, calculate the polar angle (angle) of each two-dimensional data point relative to its two-dimensional center point, and sort the two-dimensional points clockwise (or counterclockwise, consistent with the definition of the three-dimensional point set) according to their polar angles. After sorting, the order of the two-dimensional points becomes [pA, pB, pC, pD].

[0019] By applying preprocessing operators to the original image, uneven illumination, noise, and background interference are effectively suppressed, enhancing the contrast and integrity of the charging port contour and laying a clear image foundation for subsequent recognition. Through contour recognition and multi-dimensional filtering, a unique and true target charging port contour can be robustly extracted from complex scenes, effectively eliminating interference objects with similar shapes or textures, ensuring the accuracy of feature sources. Furthermore, a precise 3D reference model point cloud data set based on the prior physical structure of the charging port provides a geometric correspondence benchmark for 2D image feature points. Based on this 3D model, the extracted disordered 2D points are sorted, forcibly establishing a stable and consistent one-to-one correspondence between 2D image points and 3D space points. This fundamentally avoids mismatches caused by random or disordered feature point order, ensuring the strict order and geometric consistency of the input data for subsequent PnP pose calculation, thereby significantly improving the accuracy, stability, and overall reliability of the entire vision guidance system.

[0020] In some technical solutions, the method of obtaining the initial target pose of the charging port relative to the camera coordinate system by executing the PnP algorithm based on an ordered set of two-dimensional feature data points of the charging port, a preset set of three-dimensional reference data points of the charging port, the camera intrinsic parameter matrix, and distortion parameters includes: ; in, Here, u is the scale factor, where u is the x-coordinate of the two-dimensional feature point of the charging port in the image coordinate system or pixel coordinate system, and v is the y-coordinate of the two-dimensional feature point of the charging port in the image coordinate system or pixel coordinate system. For homogeneous coordinates, the constant term is... For the camera intrinsic parameter matrix, This represents the rotational relationship between the charging port coordinate system and the camera coordinate system. The X-axis coordinates of the 3D reference data point in the charging port coordinate system. The Y-axis coordinate of the 3D reference data point in the charging port coordinate system. The Z-axis coordinate of the 3D reference data point in the coordinate system of the charging port itself. This is the translation vector of the charging port relative to the camera coordinate system; The initial target pose of the charging port relative to the camera coordinate system is: ,in, This represents the initial target pose of the charging port coordinate system relative to the camera coordinate system, obtained by the PnP algorithm.

[0021] Precise point-to-point matching is performed between a pre-established set of ordered 2D feature points of the charging port and a 3D reference point set with known structural dimensions, providing geometrically one-to-one corresponding input data for PnP (Programmable Noise Pointing) solutions. Furthermore, by introducing camera intrinsic matrix and distortion parameters, the imaging geometry and lens distortion characteristics of the camera are accurately modeled, restoring image pixel coordinates to a normalized physical imaging plane, effectively eliminating the impact of lens distortion on measurement accuracy. Subsequently, by solving the perspective projection equations containing the rotation matrix R and translation vector t, the complete six-degree-of-freedom pose of the charging port in the camera's 3D space (i.e., the initial target pose) is robustly calculated from the 2D image information, solving the problem of determining the depth, position, and orientation of the target object in monocular vision.

[0022] In some technical solutions, the method for obtaining a stable target pose of the charging port relative to the camera coordinate system by performing credibility verification and historical frame fusion on the initial target pose includes: The initial target pose is reprojected to verify the error. The three-dimensional reference data points in the charging port three-dimensional reference data point set are reprojected back to the image plane in the camera coordinate system through the initial target pose, thus obtaining the reprojected data point of the i-th two-dimensional data point in the image plane in the camera coordinate system. The reprojection error of the i-th two-dimensional data point for: , The first one extracted from the image plane in the camera coordinate system The coordinates of two-dimensional feature data points For the first The coordinates of the two-dimensional reprojected data points are obtained by reprojecting the three-dimensional reference data points onto the image plane using the initial target pose, camera intrinsic matrix, and distortion parameters. , is the L2 norm of the two-dimensional pixel coordinate difference, used to characterize the pixel distance between the actual extracted point and the reprojected point; Mean square error of reprojection of initial target pose include: ; in, The total number of data points in the two-dimensional feature data point set of the charging port, when At that time, the initial target pose of the current frame satisfies the basic geometric consistency requirements. A preset threshold is set for reprojection error; The initial target pose is depth-based for validity verification. The translation vector obtained through PnP is: ; in, This represents the offset of the charging port center along the x-axis in the camera coordinate system. This represents the offset of the charging port center along the Y-axis in the camera coordinate system. The target depth value along the camera's z-axis from the center of the charging port, when At that time, the target depth value of the charging port is within a reasonable working range. The lower limit threshold of the target depth. The upper limit threshold for the target depth; The initial target pose is subjected to temporal continuity verification, and the displacement jump of the charging port in three-dimensional space is checked. for: ,in, This indicates the location of the charging port in the current frame. The location of the charging port in the previous valid frame; The attitude jump variable of the charging port in three-dimensional space is: ,in, The charging port orientation for the current frame. The charging port orientation of the previous valid frame; when At that time, the pose continuity of the charging port in three-dimensional space meets the requirements. The displacement jump threshold, This is the attitude transition threshold; The initial target pose of the current frame is usable if it meets the basic geometric consistency requirements, the target depth value of the charging port is within a reasonable working range, and the pose of the charging port is continuous in three-dimensional space; otherwise, the initial target pose of the current frame is unusable. Introducing a historical frame fusion mechanism reduces single-frame fluctuations in the available current frame's initial target pose. The initial target pose of the charging port is... The effective pose translation vector within the frame is The result of fusion translation for: ;in, Let be the effective pose translation vector of the charging port in the first frame. This is the effective pose translation vector of the charging port in the second frame. Let be the effective pose translation vector of the charging port in the Nth frame. Let be the effective pose translation vector of the charging port in the j-th frame. Let be the weight coefficients of the effective pose translation vector of the charging port in the j-th frame, and satisfy . ; Similarly, the charging port attitude can be obtained by fusing historical frames using rotational averaging, quaternion-weighted averaging, or small-angle linearized averaging to achieve a stable attitude output. ; When using a quaternion-weighted average method for historical frame fusion, the effective frame pose is converted into a unit quaternion. The merged unit quaternion is: ; in, For the first The unit quaternion corresponding to the effective pose of a frame. For the first Weighting coefficients for effective pose of a frame. The merged unit quaternion; After converting to a rotation matrix, the stable attitude output is obtained. ; When the pose deviation between adjacent frames is less than a preset small angle threshold, a small angle linearization averaging method can be used to fuse historical frames, converting the pose of the effective frames into rotation vectors. And perform a weighted average according to the weights: ; The merged rotation vector Convert to a rotation matrix to obtain the stable attitude output. ; Stabilize the target pose relative to the charging port in the camera coordinate system for: .

[0023] A triple-step verification mechanism rigorously filters the initial target pose calculated by PnP for reliability: reprojection error verification assesses the degree of fit between the pose and the original image from a geometric consistency perspective; depth rationality verification excludes outliers beyond the working space from a physical feasibility perspective; and temporal continuity verification eliminates unreasonable and abrupt jumps between frames from a motion smoothness perspective, ensuring that only high-confidence pose data is allowed into the control flow. Furthermore, a historical frame fusion mechanism is introduced, which effectively suppresses random fluctuations caused by unavoidable sensor noise, image jitter, and instantaneous environmental interference in single-frame data by weighted averaging of the translation components of effective poses from multiple consecutive frames and robustly fusing the rotation components using quaternion weighted averaging or small-angle linearized averaging. The output is a stable target pose that is smoothed in the time dimension and is statistically more reliable, enhancing the stability and continuity of the visual feedback signal.

[0024] The algorithm decision-making process of this invention is as follows: Figure 2 As shown, the target pose error is first input; then it is determined whether there is a vertical error. If there is a vertical error, it is compensated first through the servo lifting axis; then the remaining error is calculated and allocated to the horizontal direction, and then the attitude error and the insertion thrust are allocated in sequence; if there is no vertical error, the error is directly allocated to the horizontal direction, and then the attitude error and the insertion thrust are allocated in sequence; finally, the control quantities of each degree of freedom are output.

[0025] The distribution structure of the robotic arm motor is as follows Figure 4 As shown, a vertically positioned base has articulated motors 1 and 2 connected sequentially to its top for driving the robotic arm to perform pitch and rotation movements. A horizontally extending cantilever is fixedly connected to the top of the robotic arm, with articulated motors 3 and 4 connected to its end for driving the end effector for further attitude adjustments. An articulated motor 5 is located at the end effector for driving the charging gun to rotate or make fine adjustments. Additionally, an independent servo lifting motor is installed at the bottom of the base. The articulated motors 1 through 5 work together to form a multi-degree-of-freedom kinematic chain for the robotic arm, responsible for achieving flexible positioning of the charging gun in space. The servo lifting motor, as an independent vertical drive unit, is specifically used for vertical height compensation tasks. Together, they achieve high-precision automatic charging connection control.

[0026] The priority degree of freedom allocation of the servo lifting axis in this invention is as follows: Figure 3 As shown, the acquired target pose error is first decomposed into four independent dimensions: vertical direction error, horizontal direction error, attitude direction error, and insertion axial error. Then, the system implements differentiated compensation according to a preset mechanical structure priority strategy: the vertical direction error is directly guided to the "servo lifting axis priority compensation" branch for processing; while the horizontal direction error and attitude direction error are merged into the remaining degrees of freedom compensation branches for lateral and attitude errors, and are eliminated collaboratively by the other motion degrees of freedom of the robotic arm; the insertion axial error is directly involved in the final synthesis as an independent linear propulsion component. Finally, the compensation outputs of the above three branches are converged to the integrated control output node, forming a complete control command to drive the robotic arm to execute the final insertion action.

[0027] Some technical solutions involve transforming the stable target pose of the charging port relative to the camera coordinate system from the camera coordinate system to the robot arm's base coordinate system, including: The transformation matrix from the camera coordinate system to the robot arm's base coordinate system is: ; The target pose of the charging port in the robot arm's base coordinate system is: , Let be the transformation matrix from the charging port coordinate system to the robot arm base coordinate system. This is the stable transformation matrix from the charging port coordinate system to the camera coordinate system. The hand-eye calibration transformation matrix is ​​used to transform the camera coordinate system to the robot arm base coordinate system. If the hand-eye calibration matrix stored in the system is a transformation matrix from the robot arm's base coordinate system to the camera coordinate system, then when performing the transformation from the camera coordinate system to the robot arm's base coordinate system, the inverse matrix of this hand-eye calibration matrix should be used as the transformation matrix. To ensure that the direction of coordinate transformation is consistent with the formula Consistent The stable target pose of the charging port in the robot arm's base coordinate system is: .

[0028] By utilizing a fixed transformation relationship (i.e., the hand-eye calibration matrix) precisely obtained through pre-processed hand-eye calibration, the stable target pose output by the vision module in the camera coordinate system, which has been verified and fused, is uniformly transformed to the robot arm's base coordinate system through rigorous homogeneous transformation matrix multiplication. This ensures that the target position and orientation calculated from the image can be directly and accurately understood and used by the robot arm controller. Secondly, the two possible directional definitions of the hand-eye calibration matrix (from base to camera or from camera to base) are clearly addressed, and the input of the transformation formula is standardized by inverting the matrix when necessary, ensuring the correctness and flexibility of the coordinate transformation chain in mathematical direction. Finally, a high-precision and stable charging port target pose is obtained in the robot arm's cognitive world (robot arm base coordinate system).

[0029] In some technical solutions, the method of calculating the pose error between the stable target pose of the charging port in the robot arm's base coordinate system and the current pose of the charging gun in the robot arm's base coordinate system, and decomposing the pose error into vertical direction error and other multi-directional errors, wherein the vertical direction error is preferentially allocated to the servo lifting axis of the robot arm to generate the lifting axis compensation amount, and the other multi-directional errors are allocated to the remaining degrees of freedom of the robot arm to generate the robot arm compensation amount includes: The formula for the pose error transformation between the stable target pose of the charging port and the current pose of the charging gun in the robot arm's base coordinate system is as follows: , Here is the error transformation matrix. Let be the homogeneous transformation matrix corresponding to the current pose of the charging gun. This is the homogeneous transformation matrix corresponding to the stable target pose of the charging port in the base coordinate system of the robotic arm; The position error vector between the stable target position of the charging port and the current position of the charging gun From the error transformation matrix The translated portion is directly extracted: ; in This refers to the lateral error in the horizontal direction. To account for axial or longitudinal errors in the insertion process. This refers to the vertical height error. It is the transpose operator; Error transformation matrix for: ; in, Error transformation matrix The rotating part, Error transformation matrix The translated portion, and: ; Position error vector Depend on Direct extraction yields: ; Right now: ; The attitude error vector between the stable target attitude of the charging port and the current attitude of the charging gun From the error transformation matrix The rotated portion was directly extracted: ,in, This refers to the angle deviation required for the charging gun to rotate around the X-axis of the gun head coordinate system. The angle deviation required for the charging gun to rotate around the Y-axis of the gun head coordinate system. The angle deviation required for the charging gun to rotate around the Z-axis of the gun head coordinate system; Attitude error vector From the error transformation matrix Rotation part Extracted; when using Euler angles, Converted into angular deviations around the X, Y, and Z axes according to a preset rotation sequence, these deviations are respectively used as... , and When using the rotation vector method, through Obtain the equivalent rotation vector, and use the three components of this equivalent rotation vector as... , and ; The method of prioritizing vertical errors to the servo lifting axis of the robotic arm and allocating other multi-directional errors to the robotic arm includes direct priority allocation or optimized target drive allocation. The direct priority allocation method for the pose error between the stable target pose of the charging port and the current pose of the charging gun includes: allocating the vertical direction error... The main control input for the servo lifting axis of the robotic arm: ;in, This refers to the target displacement of the servo lifting axis, i.e., the lifting axis compensation amount. The proportional coefficient for the servo lifting axis; The remaining degrees of freedom of the robotic arm bear the residual error, i.e., the robotic arm compensation amount: ,in, The remaining pose error after deducting compensation for the lifting axis is used to cover the remaining degrees of freedom of the robotic arm, and the remaining pose error includes lateral error. Axial error Attitude error And the residual height error after compensation by the lifting shaft and correction by the attitude equivalent height residual. ; The optimization target-driven allocation method for the pose error between the stable target pose of the charging port and the current pose of the charging gun includes: setting a higher weight for the vertical direction error in the controller's optimization objective function, so that the automatic charging system prioritizes reducing the low-height error when solving for the control quantity. ; in, The objective function is to optimize the pose error between the stable target pose of the charging port and the current pose of the charging gun in the robot arm's base coordinate system. This is the weight for the vertical height error. The horizontal error weight is used in the horizontal direction. For the insertion of axial or front-back direction error weights For attitude error weights, To control the weights of the smoothing term, For the control quantity of the executing agency; To reflect the priority compensation principle of the servo lifting axis, the following settings are configured: For example, it is advisable ; To address the potential for equivalent height changes at the charging gun tip during attitude correction, an equivalent height residual calculation is introduced based on simplified geometric model calculations or Jacobian matrix mapping. In the simplified geometric model, the effective length of the charging gun is... The attitude error of the charging gun around the horizontal axis is The equivalent height residual at the end of the charging gun head due to attitude correction can be approximated as: ; when When the size is small, it can be approximated as: ; in, The unit of measurement is radians; Smaller means: ; in, For a preset small angle approximation threshold, preferably, Can be taken as The corresponding radian value; If there is an attitude error around another horizontal axis at the same time Then the equivalent height residual It can be represented as: ; in, The sign is determined by the rotation direction of the attitude error. The first direction coefficient is determined by the charging gun installation direction and the coordinate system definition. The second direction coefficient is determined by the installation direction of the charging gun and the coordinate system definition. When the corresponding attitude error is positive, if the attitude error causes the end of the charging gun head to rise in the vertical positive direction along the robot arm base coordinate system, the corresponding direction coefficient is positive; if it causes the end of the charging gun head to fall in the vertical negative direction along the robot arm base coordinate system, the corresponding direction coefficient is negative.

[0030] In the Jacobian mapping method, the change in position of the charging gun tip in three-dimensional space is... The small change in attitude angle required to correct attitude error The relationship between them is: ; in, Let be the equivalent Jacobian matrix of the displacement from the attitude to the end point of the charging gun head. The equivalent height residual is: ; Final servo lifting axis target displacement It can be corrected to: ; Target adjustment amount of the remaining degrees of freedom of the robotic arm for: ; in, This is the equivalent Jacobian inverse mapping for the remaining degrees of freedom of the robotic arm. This refers to the remaining pose error allocated to the other degrees of freedom of the robotic arm, excluding the vertical height error.

[0031] In some technical solutions, the method of driving the robotic arm to realize the insertion control between the charging gun and the charging port based on the compensation amount of the lifting axis and the compensation amount of the robotic arm, and using whether the pose error meets the set constraint conditions as a criterion, sequentially executing the switching between the coarse alignment control stage, the fine alignment control stage, and the low-speed insertion control stage between the charging gun and the charging port includes: The purpose of the coarse alignment stage is to quickly bring the nozzle to the pre-connection working area in front of the charging port: During the coarse alignment phase, the vehicle's automatic charging system switches from the coarse alignment phase to the fine alignment phase when the following conditions are met simultaneously: Condition 1: Positional error between the current position of the charging gun and the target charging port position : ; Condition 2: The attitude error between the current position of the charging gun and the position of the target charging port. : ; Condition 3: ; ; ; in, This is the position error threshold for the coarse alignment stage. This is the attitude error threshold for the coarse alignment stage. This refers to the PnP reprojection error. This represents the permissible reprojection error threshold during the coarse alignment stage. The target depth obtained from PnP solution. This is the lower limit of a reasonable depth range. This represents the upper limit of a reasonable depth range. For a continuous and stable number of effective frames, This represents the minimum number of stable frames required for the coarse alignment stage. The purpose of the precision alignment stage is to ensure that the axis of the charging gun head and the axis of the charging port are aligned with high precision. When the following conditions are met simultaneously, the vehicle's automatic charging system will move from the precision alignment stage to the low-speed insertion stage: ; ; ; ; ; ; in, The position error threshold for the fine alignment stage. The attitude error threshold during the fine alignment stage. This is the permissible reprojection error threshold for the fine alignment stage. This represents the change in position error between adjacent frames. This represents the change in attitude error between adjacent frames. The number of consecutive stable frames required for the precision alignment stage; The purpose of the low-speed insertion stage is to stably advance the charging gun head axis along the charging port axis, suppressing lateral deviation and attitude skew. If the charging gun head remains stable and the advancement is normal, the charging gun is continuously inserted into the charging port. If an increase in the deviation of the charging gun head or a failure in the pose verification is detected, the charging gun is returned to the pre-insertion position and re-enters the fine alignment stage. In the low-speed insertion stage, if the position error, attitude error, or reprojection error no longer meets the constraints of the low-speed insertion stage, or if the change in position error or attitude error between adjacent frames exceeds the corresponding threshold, the charging gun is controlled to stop advancing and return to the pre-insertion position, and the fine alignment stage is re-entered. The charging gun will remain plugged into the charging port until the connection is complete, provided that all of the following conditions are met: ; ; ; ; in, The charging gun is inserted and pushed at a low speed. The charging gun insertion speed during the coarse alignment stage. The charging gun insertion speed during the precise alignment stage. This is the maximum permissible propulsion speed during the low-speed insertion phase, and it meets the following requirements: , This is the position error threshold during the low-speed insertion phase. This is the attitude error threshold during the low-speed insertion phase. This is the permissible reprojection error threshold during the low-speed insertion phase.

[0032] Some technical solutions also include an exception handling module. This module is used to control the charging gun to retract and trigger a re-identification or safety termination process when a charging gun connection failure is detected. Methods for controlling the charging gun to retract and trigger a re-identification or safety termination process when a charging gun connection failure is detected include... Set up an anomaly detection mechanism to determine if there is an anomaly in the charging gun connection; The criteria for determining charging gun connection abnormality are defined as follows: ; in, This is the value for determining the connection failure. This is the term representing the increase in positional error during the insertion process. This is the growth term of attitude error. This represents the current reprojection error. To advance the status anomaly items, This is a weighting factor for the increase in position error. This is a weighting factor for the increase in attitude error. The weighting factor for the current reprojection error. To advance the weighting coefficient for state anomalies, when If the charging gun connection is faulty, it is determined that the charging gun is not properly connected. As the threshold for determining abnormal insertion, when an abnormal insertion occurs, the charging gun retracts along the insertion axis to the safe pre-insertion position. The retraction displacement of the charging gun is as follows: ; in, For the backtracking distance, The unit vector in the opposite direction of the insertion axis; Simultaneously, the system enters the failure handling process when any of the following situations occur: Failure handling is triggered by the following situations: The following conditions are met: the initial target pose is an abnormal candidate value after a continuous set of frames; the charging gun is abnormal after a continuous set of frames; the current position error and attitude error between the current position of the charging gun and the target charging port position do not meet the convergence conditions after a continuous set of frames. when If necessary, perform one of the following actions: pause all current movements of the robotic arm; return the charging gun to a safe position; re-enter the coarse alignment stage of the charging gun and terminate the current automatic charging task and issue an alarm; in, The failure counter is used to record the number of times the failure handling trigger condition occurs. This is the failure counter's counting threshold.

[0033] By defining a comprehensive insertion anomaly criterion that integrates multi-dimensional information such as position error growth, attitude error growth, instantaneous reprojection error, and physical propulsion anomalies, and obtaining a quantified anomaly score through weighted summation, the system can highly sensitively and comprehensively capture various deviations and fault symptoms that occur during the insertion process. When the anomaly score exceeds a preset threshold, the system immediately triggers a safety response, controlling the charging gun to precisely retract along the insertion axis to a predetermined safe position. This effectively avoids potential equipment collisions or damage caused by increased pose deviations or physical jamming, and creates conditions for subsequent re-identification and retry. Secondly, by pre-setting multiple high-order failure triggering scenarios (such as continuous pose anomalies across multiple frames, multiple failed insertion retry attempts, and persistent non-convergence of errors), and introducing a failure counter for cumulative monitoring, when any failure scenario continues to occur and reaches the cumulative threshold, the safety response escalates, executing mandatory measures according to preset strategies, such as immediately pausing all actions, retracting to an absolutely safe position, restarting the coarse alignment process, or completely terminating the task and reporting an alarm. Enhance the adaptive and self-protective capabilities of the automatic charging alignment system in the face of complex interference, transient failures and persistent anomalies, and ensure the equipment safety and operational reliability of automatic charging operations.

[0034] The priority degree of freedom allocation of the servo lifting axis in this invention is as follows: Figure 3As shown, the acquired target pose error is first decomposed into four independent dimensions: vertical direction error, horizontal direction error, attitude direction error, and insertion axial error. Then, the system implements differentiated compensation according to a preset mechanical structure priority strategy: the vertical direction error is directly guided to the servo lifting axis priority compensation branch for processing; while the horizontal direction error and attitude direction error are merged into the remaining degrees of freedom compensation branches for lateral and attitude errors, and are eliminated collaboratively by the other motion degrees of freedom of the robotic arm; the insertion axial error is directly involved in the final synthesis as an independent linear propulsion component. Finally, the compensation outputs of the above three branches are unified and converged to the integrated control output node, forming a complete control command to drive the robotic arm to execute the final insertion action.

[0035] Example 2 A monocular vision PnP automatic charging alignment method based on the system, incorporating lifting axis degree of freedom allocation, includes: The original images of the charging port area acquired by the monocular camera are preprocessed and contour recognized to obtain a set of disordered two-dimensional feature data points of the charging port. Based on the preset three-dimensional reference data point set of the charging port, the disordered two-dimensional feature data point set of the charging port is sorted to obtain a set of ordered two-dimensional feature data points of the charging port. Based on the ordered two-dimensional feature data point set of the charging port, the preset three-dimensional reference data point set of the charging port, the camera intrinsic parameter matrix and distortion parameters, the PnP algorithm is executed to obtain the initial target pose of the charging port relative to the camera coordinate system. The initial target pose is then verified for reliability and fused with historical frames to obtain the stable target pose of the charging port relative to the camera coordinate system. Finally, the stable target pose of the charging port relative to the camera coordinate system is transformed from the camera coordinate system to the robot arm base coordinate system to obtain the stable target pose of the charging port in the robot arm base coordinate system. Calculate the pose error between the stable target pose of the charging port and the current pose of the charging gun in the base coordinate system of the robotic arm, and decompose the pose error into vertical direction error and other multi-directional errors. The vertical direction error is preferentially allocated to the servo lifting axis of the robotic arm to generate the lifting axis compensation amount, and the other multi-directional errors are allocated to the other degrees of freedom of the robotic arm to generate the robotic arm compensation amount. The robotic arm is driven by the compensation amount of the lifting shaft and the compensation amount of the robotic arm to realize the plug-in control between the charging gun and the charging port. In the plug-in control, the positioning error is used as the criterion to switch between the coarse alignment control stage, the fine alignment control stage and the low-speed plug-in control stage between the charging gun and the charging port in sequence.

[0036] Example 3 The present invention provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the method described in Embodiment 2.

[0037] This invention can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented in whole or in part as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired means, such as coaxial cable, optical fiber, digital subscriber line (DSL), or wireless means (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium, such as a solid-state drive (SSD).

[0038] Those skilled in the art will readily understand that the above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, combinations, substitutions, improvements, etc., made under the spirit and principles of the present invention are included within the protection scope of the present invention.

[0039] The contents not described in detail in this specification are existing technologies known to those skilled in the art.

Claims

1. A monocular vision PnP automatic charging alignment system combining lifting axis degree of freedom allocation, characterized in that, include: The vision processing module is used to preprocess and perform contour recognition on the original image of the charging port area acquired by the monocular camera to obtain a set of disordered two-dimensional feature data points of the charging port. Based on the preset set of three-dimensional reference data points of the charging port, the disordered two-dimensional feature data points of the charging port are sorted to obtain a set of ordered two-dimensional feature data points of the charging port. The pose calculation module is used to execute the PnP algorithm based on the ordered two-dimensional feature data point set of the charging port, the preset three-dimensional reference data point set of the charging port, the camera intrinsic parameter matrix and distortion parameters, to obtain the initial target pose of the charging port relative to the camera coordinate system. The module performs credibility verification and historical frame fusion on the initial target pose to obtain the stable target pose of the charging port relative to the camera coordinate system. The module then transforms the stable target pose of the charging port relative to the camera coordinate system from the camera coordinate system to the robot arm base coordinate system to obtain the stable target pose of the charging port in the robot arm base coordinate system. The error decomposition and compensation module is used to calculate the pose error between the stable target pose of the charging port and the current pose of the charging gun in the base coordinate system of the robotic arm, and decompose the pose error into vertical direction error and other multi-directional errors. The vertical direction error is preferentially allocated to the servo lifting axis of the robotic arm to generate the lifting axis compensation amount, and the other multi-directional errors are allocated to the other degrees of freedom of the robotic arm to generate the robotic arm compensation amount. The phased control module is used to drive the robotic arm to achieve plug-in control between the charging gun and the charging port based on the compensation amount of the lifting axis and the compensation amount of the robotic arm. In the plug-in control, the module switches between the coarse alignment control stage, the fine alignment control stage, and the low-speed plug-in control stage in sequence, based on whether the pose error meets the set constraint conditions.

2. The monocular vision PnP automatic charging alignment system with lifting axis degree of freedom allocation according to claim 1, characterized in that: Methods for obtaining an ordered set of two-dimensional feature data points for charging ports include: Preprocessing operators are used to preprocess the original image of the charging port area acquired by the monocular camera: ;in, Original image of the charging port area. This is the preprocessed image of the charging port area. Preprocessing operators; Contour recognition is performed on the preprocessed charging port area image to obtain a set of candidate charging port contours. : ; in, This is the first candidate contour in the set of candidate contours for the charging port. This is the second candidate contour in the set of candidate contours for the charging port. The nth candidate contour in the set of candidate contours for the charging port; Candidate profile set for charging ports Multi-dimensional filtering is performed to obtain the target charging port outline, and the set of disordered two-dimensional feature data points of the charging port in the target charging port outline is extracted. , ;in, The i-th unordered two-dimensional feature data point of the target charging port contour. The coordinates are ; Based on the standard structural dimensions of the target charging port, establish a set of three-dimensional reference data points in the charging port coordinate system. : ; in, Let i be the i-th 3D reference data point in the set of 3D reference data points. The coordinates are ; The unordered two-dimensional feature data point set of the charging port is sorted based on the preset three-dimensional reference data point set of the charging port to obtain the ordered two-dimensional feature data point set of the charging port corresponding to the three-dimensional reference data point set of the charging port.

3. The monocular vision PnP automatic charging alignment system with lifting axis degree of freedom allocation according to claim 2, characterized in that: The method for obtaining the initial target pose of the charging port relative to the camera coordinate system by executing the PnP algorithm based on an ordered set of two-dimensional feature data points of the charging port, a preset set of three-dimensional reference data points of the charging port, the camera intrinsic parameter matrix, and distortion parameters includes: ; in, As a scale factor, The x-coordinate of the two-dimensional feature data point of the charging port in the camera coordinate system. The ordinate of the two-dimensional feature data point of the charging port in the camera coordinate system. For homogeneous coordinates, the constant term is... For the camera intrinsic parameter matrix, This represents the rotational relationship between the charging port coordinate system and the camera coordinate system. The X-axis coordinates of the 3D reference data point in the charging port coordinate system. The Y-axis coordinate of the 3D reference data point in the charging port coordinate system. The Z-axis coordinate of the 3D reference data point in the coordinate system of the charging port itself. Let be the translation vector of the charging port relative to the camera coordinate system; The initial target pose of the charging port relative to the camera coordinate system is: ,in, This represents the initial target pose of the charging port coordinate system relative to the camera coordinate system, obtained by the PnP algorithm.

4. The monocular vision PnP automatic charging alignment system with lifting axis degree of freedom allocation according to claim 3, characterized in that: The method for obtaining a stable target pose of the charging port relative to the camera coordinate system by performing credibility verification and historical frame fusion on the initial target pose includes: The initial target pose is reprojected to verify the error. The three-dimensional reference data points in the charging port three-dimensional reference data point set are reprojected back to the image plane in the camera coordinate system through the initial target pose, thus obtaining the reprojected data point of the i-th two-dimensional data point in the image plane in the camera coordinate system. The reprojection error of the i-th two-dimensional data point for: , The first one extracted from the image plane in the camera coordinate system The coordinates of a two-dimensional feature data point For the first The coordinates of the two-dimensional reprojected data points are obtained by reprojecting the three-dimensional reference data points onto the image plane using the initial target pose, camera intrinsic matrix, and distortion parameters. It is the L2 norm of the two-dimensional pixel coordinate difference, used to characterize the pixel distance between the actual extracted point and the reprojected point; Mean square error of reprojection of initial target pose include: ; in, The total number of data points in the two-dimensional feature data point set of the charging port, when At that time, the initial target pose of the current frame satisfies the basic geometric consistency requirements. A preset threshold is set for reprojection error; The initial target pose is depth-based for validity verification. The translation vector obtained through PnP is: ; in, This represents the offset of the charging port center along the X-axis in the camera coordinate system. This represents the offset of the charging port center along the Y-axis in the camera coordinate system. The target depth value along the Z-axis of the camera, centered on the charging port; when At that time, the target depth value of the charging port is within a reasonable working range. The lower limit threshold of the target depth. The upper limit threshold for the target depth; The initial target pose is subjected to temporal continuity verification, and the displacement jump of the charging port in three-dimensional space is checked. for: ,in, This indicates the location of the charging port in the current frame. The location of the charging port in the previous valid frame; The attitude jump variable of the charging port in three-dimensional space is: ,in, The charging port orientation for the current frame. The charging port orientation of the previous valid frame; when At that time, the pose continuity of the charging port in three-dimensional space meets the requirements. The displacement jump threshold, This is the attitude transition threshold; The initial target pose of the current frame is usable if it meets the basic geometric consistency requirements, the target depth value of the charging port is within a reasonable working range, and the pose of the charging port is continuous in three-dimensional space. Introducing a historical frame fusion mechanism reduces single-frame fluctuations in the available current frame's initial target pose. The initial target pose of the charging port is... The effective pose translation vector within the frame is The result of fusion translation for: ;in, Let be the effective pose translation vector of the charging port in the first frame. This is the effective pose translation vector of the charging port in the second frame. Let be the effective pose translation vector of the charging port in the Nth frame. Let be the effective pose translation vector of the charging port in the j-th frame. Let be the weight coefficients of the effective pose translation vector of the charging port in the j-th frame, and satisfy . ; Similarly, the charging port attitude can be obtained by fusing historical frames using rotational averaging, quaternion-weighted averaging, or small-angle linearized averaging to achieve a stable attitude output. ; When using a quaternion-weighted average method for historical frame fusion, the effective frame pose is converted into a unit quaternion. The merged unit quaternion is: ; in, For the first The unit quaternion corresponding to the effective pose of a frame. For the first Weighting coefficients for effective pose of a frame. The merged unit quaternion; After converting to a rotation matrix, the stable attitude output is obtained. ; When using a small-angle linearized averaging method for historical frame fusion, the pose of the effective frames is converted into a rotation vector. And perform a weighted average according to the weights: ; The merged rotation vector Convert to a rotation matrix to obtain the stable attitude output. ; Stabilize the target pose relative to the charging port in the camera coordinate system for: .

5. The monocular vision PnP automatic charging alignment system with lifting axis degree of freedom allocation according to claim 4, characterized in that: Methods for transforming the stable target pose of the charging port relative to the camera coordinate system from the camera coordinate system to the robot arm's base coordinate system include: The transformation matrix from the camera coordinate system to the robot arm's base coordinate system is: ; The target pose of the charging port in the robot arm's base coordinate system is: , Let be the transformation matrix from the charging port coordinate system to the robot arm base coordinate system. This is the stable transformation matrix from the charging port coordinate system to the camera coordinate system. The hand-eye calibration transformation matrix is ​​used to transform the camera coordinate system to the robot arm base coordinate system. If the hand-eye calibration matrix stored in the system is a transformation matrix from the robot arm's base coordinate system to the camera coordinate system, then when performing the transformation from the camera coordinate system to the robot arm's base coordinate system, the inverse matrix of this hand-eye calibration matrix should be used as the transformation matrix. To ensure that the direction of coordinate transformation is consistent with the formula Consistent The stable target pose of the charging port in the robot arm's base coordinate system is: .

6. The monocular vision PnP automatic charging alignment system with lifting axis degree of freedom allocation according to claim 5, characterized in that: The method for calculating the pose error between the stable target pose of the charging port and the current pose of the charging gun in the base coordinate system of the robotic arm, and decomposing the pose error into vertical direction error and other multi-directional errors, wherein the vertical direction error is preferentially allocated to the servo lifting axis of the robotic arm to generate the lifting axis compensation amount, and the other multi-directional errors are allocated to the remaining degrees of freedom of the robotic arm to generate the robotic arm compensation amount includes: The formula for the pose error transformation between the stable target pose of the charging port and the current pose of the charging gun in the robot arm's base coordinate system is as follows: , Here is the error transformation matrix. Let be the homogeneous transformation matrix corresponding to the current pose of the charging gun. This is the homogeneous transformation matrix corresponding to the stable target pose of the charging port in the base coordinate system of the robotic arm; The position error vector between the stable target position of the charging port and the current position of the charging gun From the error transformation matrix The translated portion is directly extracted: ; in This refers to the lateral error in the horizontal direction. To account for axial or longitudinal errors in the insertion direction. This refers to the vertical height error. It is the transpose operator; Error transformation matrix for: ; in, Error transformation matrix The rotating part, Error transformation matrix The translated portion, and: ; Position error vector Depend on Direct extraction yields: ; Right now: ; The attitude error vector between the stable target attitude of the charging port and the current attitude of the charging gun From the error transformation matrix The rotated portion was directly extracted: ,in, This refers to the angle deviation required for the charging gun to rotate around the X-axis of the gun head coordinate system. The angle deviation required for the charging gun to rotate around the Y-axis of the gun head coordinate system. The angle deviation required for the charging gun to rotate around the Z-axis of the gun head coordinate system; Attitude error vector From the error transformation matrix Rotation part Extracted; when using Euler angles, Converted into angular deviations around the X, Y, and Z axes according to a preset rotation sequence, these deviations are respectively used as... , and When using the rotation vector method, through Obtain the equivalent rotation vector, and use the three components of this equivalent rotation vector as... , and ; The method of prioritizing vertical errors to the servo lifting axis of the robotic arm and allocating other multi-directional errors to the robotic arm includes direct priority allocation or optimized target drive allocation. The direct priority allocation method for the pose error between the stable target pose of the charging port and the current pose of the charging gun includes: allocating the vertical direction error... The main control input for the servo lifting axis of the robotic arm: ;in, This refers to the target displacement of the servo lifting axis, i.e., the lifting axis compensation amount. The proportional coefficient for the servo lifting axis; The remaining degrees of freedom of the robotic arm bear the residual error, i.e., the robotic arm compensation amount: ,in, The remaining pose error after deducting compensation for the lifting axis is used to cover the remaining degrees of freedom of the robotic arm, and the remaining pose error includes lateral error. Axial error Attitude error And the residual height error after compensation by the lifting shaft and correction by the attitude equivalent height residual. ; The optimization target-driven allocation method for the pose error between the stable target pose of the charging port and the current pose of the charging gun includes: setting a higher weight for the vertical direction error in the controller's optimization objective function, so that the automatic charging system prioritizes reducing the low-height error when solving for the control quantity. ; in, The objective function is to optimize the pose error between the stable target pose of the charging port and the current pose of the charging gun in the robot arm's base coordinate system. This is the weight for the vertical height error. The horizontal error weight is used in the horizontal direction. Weighting for axial or longitudinal errors during insertion. For attitude error weights, To control the weights of the smoothing term, For the control quantity of the implementing agency.

7. The monocular vision PnP automatic charging alignment system with lifting axis degree of freedom allocation according to claim 6, characterized in that: The method of controlling the connection between the charging gun and the charging port by driving the robotic arm based on the compensation amount of the lifting axis and the compensation amount of the robotic arm includes: using whether the pose error meets the set constraints as a criterion, and sequentially switching between the coarse alignment control stage, the fine alignment control stage, and the low-speed connection control stage between the charging gun and the charging port. The purpose of the coarse alignment stage is to quickly bring the nozzle to the pre-connection working area in front of the charging port: During the coarse alignment phase, the vehicle's automatic charging system switches from the coarse alignment phase to the fine alignment phase when the following conditions are met simultaneously: Condition 1: Positional error between the current position of the charging gun and the target charging port position : ; Condition 2: The attitude error between the current position of the charging gun and the position of the target charging port. : ; Condition 3: ; ; ; in, This is the position error threshold for the coarse alignment stage. This is the attitude error threshold for the coarse alignment stage. This refers to the PnP reprojection error. This represents the permissible reprojection error threshold during the coarse alignment stage. The target depth obtained from PnP solution. This is the lower limit of a reasonable depth range. This represents the upper limit of a reasonable depth range. For a continuous and stable number of effective frames, This represents the minimum number of stable frames required for the coarse alignment stage. The purpose of the precision alignment stage is to ensure that the axis of the charging gun head and the axis of the charging port are aligned with high precision. When the following conditions are met simultaneously, the vehicle's automatic charging system will move from the precision alignment stage to the low-speed insertion stage: ; ; ; ; ; ; in, The position error threshold for the fine alignment stage. The attitude error threshold during the fine alignment stage. This is the permissible reprojection error threshold for the fine alignment stage. This represents the change in position error between adjacent frames. This represents the change in attitude error between adjacent frames. The number of consecutive stable frames required for the precision alignment stage; The purpose of the low-speed insertion stage is to stably advance the charging gun head axis along the charging port axis. The charging gun will remain plugged into the charging port until the connection is complete, provided that all of the following conditions are met: ; ; ; ; in, The charging gun is inserted and pushed at a low speed. The charging gun insertion speed during the coarse alignment stage. The charging gun insertion speed during the precise alignment stage. This is the maximum permissible propulsion speed during the low-speed insertion phase, and it meets the following requirements: , This is the position error threshold during the low-speed insertion phase. This is the attitude error threshold during the low-speed insertion phase. This is the permissible reprojection error threshold during the low-speed insertion phase.

8. The monocular vision PnP automatic charging alignment system with lifting axis degree of freedom allocation according to claim 7, characterized in that: It also includes an exception handling module, which is used to control the charging gun to retract and trigger a re-identification or safety termination process when a charging gun connection failure is detected. The methods for controlling the charging gun to retract and trigger a re-identification or safety termination process when a charging gun connection failure is detected include... Set up an anomaly detection mechanism to determine if there is an anomaly in the charging gun connection; The criteria for determining charging gun connection abnormality are defined as follows: ; in, This is the value for determining the connection failure. This is the term representing the increase in positional error during the insertion process. This is the attitude error growth term. This represents the current reprojection error. To advance the status anomaly items, This is a weighting factor for the increase in position error. This is a weighting factor for the increase in attitude error. The weighting factor for the current reprojection error. To advance the weighting coefficient for state anomalies, when: If the charging gun connection is faulty, it is determined that the charging gun is not properly connected. As the threshold for determining abnormal insertion, when an abnormal insertion occurs, the charging gun retracts along the insertion axis to the safe pre-insertion position. The retraction displacement of the charging gun is as follows: ; in, For the backtracking distance, The unit vector in the opposite direction of the insertion axis; Simultaneously, the system enters the failure handling process when any of the following situations occur: Failure handling is triggered by the following situations: The following conditions are met: the initial target pose is an abnormal candidate value after a continuous set of frames; the charging gun is abnormal after a continuous set of frames; the current position error and attitude error between the current position of the charging gun and the target charging port position do not meet the convergence conditions after a continuous set of frames. when: hour, Perform one of the following actions: pause all current movements of the robotic arm; return the charging gun to a safe position; re-enter the coarse alignment stage of the charging gun and terminate the current automatic charging task and issue an alarm; in, The failure counter is used to record the number of times the failure handling trigger condition occurs. This is the failure counter's counting threshold.

9. A monocular vision PnP automatic charging alignment method based on the system of claim 1, combining lifting axis degree of freedom allocation, characterized in that, include: The original images of the charging port area acquired by the monocular camera are preprocessed and contour recognized to obtain a set of disordered two-dimensional feature data points of the charging port. Based on the preset three-dimensional reference data point set of the charging port, the disordered two-dimensional feature data point set of the charging port is sorted to obtain a set of ordered two-dimensional feature data points of the charging port. Based on the ordered two-dimensional feature data point set of the charging port, the preset three-dimensional reference data point set of the charging port, the camera intrinsic parameter matrix and distortion parameters, the PnP algorithm is executed to obtain the initial target pose of the charging port relative to the camera coordinate system. The initial target pose is then verified for reliability and fused with historical frames to obtain the stable target pose of the charging port relative to the camera coordinate system. Finally, the stable target pose of the charging port relative to the camera coordinate system is transformed from the camera coordinate system to the robot arm base coordinate system to obtain the stable target pose of the charging port in the robot arm base coordinate system. Calculate the pose error between the stable target pose of the charging port and the current pose of the charging gun in the base coordinate system of the robotic arm, and decompose the pose error into vertical direction error and other multi-directional errors. The vertical direction error is preferentially allocated to the servo lifting axis of the robotic arm to generate the lifting axis compensation amount, and the other multi-directional errors are allocated to the other degrees of freedom of the robotic arm to generate the robotic arm compensation amount. The robotic arm is driven by the compensation amount of the lifting shaft and the compensation amount of the robotic arm to realize the plug-in control between the charging gun and the charging port. In the plug-in control, the positioning error is used as the criterion to switch between the coarse alignment control stage, the fine alignment control stage and the low-speed plug-in control stage between the charging gun and the charging port in sequence.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method of claim 9.