A robot motion control method, device and storage medium

CN122645356BActive Publication Date: 2026-10-09DAIMON (SHENZHEN) ROBOTICS TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202611155022.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-07-31
Publication Date
2026-10-09
Estimated Expiration
2046-07-31

AI Technical Summary

Technical Problem

本申请实施例提供一种机器人运动控制方法、设备及存储介质,能够解决机器人控制过程中自碰撞风险高的技术问题,通过安全距离值进行碰撞预测,并以安全距离值对初始关节动作进行修正,在满足实时控制频率的前提下显著降低了自碰撞漏检率,进而显著降低了机器人控制过程中的自碰撞风险

Benefits of technology

[0014] This application embodiment obtains the initial joint motion corresponding to the current robot state and reference motion during robot motion control. Based on the current robot state, a safety value prediction is performed to obtain multiple preset safety distance values ​​for self-collision pairs. These self-collision pairs are pre-specified pairs of parts that will collide with different body components of the robot. Activated collision pairs with safety distance values ​​less than a preset activation threshold are selected. Gradient prediction processing is performed on the activated collision pairs according to a preset prediction model to obtain the joint space gradient of each activated collision pair with respect to the current joint configuration. Functional constraints are constructed based on the safety distance values ​​of each activated collision pair, the joint space gradient, and the preset safety threshold. Under these constraints, the target joint motion is obtained by minimizing the difference from the initial joint motion. The target joint motion is a joint angle command vector composed of the corrected target angle values ​​of each robot joint. The robot is then controlled to perform motion based on the target joint motion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122645356B_ABST
    Figure CN122645356B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a robot motion control method and device and a storage medium. The method comprises: obtaining an initial joint motion corresponding to a current robot state and a reference motion, performing safety value prediction according to the current robot state to obtain safety distance values of a plurality of preset self-collision pairs; performing correction processing on the initial joint motion according to the safety distance values to obtain a target joint motion, wherein the target joint motion is a joint angle instruction vector composed of target angle values of each joint of the robot after correction; and controlling the robot to perform motion according to the target joint motion. The present scheme solves the problem of high self-collision risk in robot motion, and reduces the self-collision risk in the robot control process by correcting the initial joint motion with the safety distance value as the constraint condition, while meeting the real-time control frequency and reducing the self-collision detection rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of robot control technology, and in particular to a robot motion control method, device and storage medium. Background Technology

[0002] Humanoid robot full-body motion control typically generates target actions based on text commands, human motion data, or motion capture results. A control strategy then outputs motion commands for each joint, driving the robot to perform full-body movements such as walking, dancing, and interactive postures. During motion execution, unexpected contact or collisions may occur between different body parts of the robot (such as legs, arms, torso, and head), known as self-collisions. Self-collisions can damage the robot's hardware structure, disrupt motion stability, and even cause the robot to fall.

[0003] In the whole-body motion control of humanoid robots, to prevent self-collision between different body parts, existing technologies often use simplified geometric models such as capsules, spheres, and bounding boxes to approximate the real shape of body parts, and calculate the mutual distance or collision boundary between each simplified geometry in the controller. Specifically, firstly, complex parts of the robot such as legs, arms, torso, and head are approximated as regular geometric shapes such as capsules, spheres, or bounding boxes, respectively; then, in each control cycle, the spatial pose of each simplified geometry is calculated based on the current joint state of the robot; next, the shortest distance between each simplified geometry is calculated and compared with a preset safety threshold; if the distance is greater than the safety threshold, the current posture is determined to be safe, and the original action continues; if the distance is less than or equal to the safety threshold, a self-collision risk is determined, and avoidance processing is triggered, such as stopping the movement or reversing the movement. In the above scheme, when controlling the robot's motion, the simplified geometric model does not have sufficient accuracy in representing the complex body shape, resulting in a high rate of missed self-collision detection, and therefore a significant risk of self-collision. Summary of the Invention This application provides a robot motion control method, device, and storage medium that can solve the technical problem of high self-collision risk during robot control. It predicts collisions using a safe distance value and corrects the initial joint movements using the safe distance value. Under the premise of meeting the real-time control frequency, it significantly reduces the self-collision missed rate, thereby significantly reducing the self-collision risk during robot control.

[0004] In a first aspect, embodiments of this application provide a robot motion control method, comprising: The initial joint motions corresponding to the current robot state and reference motion are obtained. Based on the current robot state, a safety value prediction is performed to obtain the safety distance values ​​of multiple preset self-collision pairs. Here, the self-collision pair is a pair of parts that are pre-specified to collide between different body parts of the robot. Activation collision pairs that are less than the preset activation threshold are selected based on the safety distance value; Gradient prediction processing is performed on the activated collision pairs according to the preset prediction model to obtain the joint space gradient of each activated collision pair with respect to the current joint configuration. Based on the safe distance value of each active collision pair, the joint space gradient, and the preset safety threshold, a function constraint condition is constructed. Under the function constraint condition, the target joint action is obtained by minimizing the difference between the initial joint action and the target joint action. The target joint action is a joint angle command vector composed of the corrected target angle values ​​of each joint of the robot. The robot performs movements based on the target joint motion.

[0005] Furthermore, based on the current robot state, safety values ​​are predicted to obtain multiple preset safe distance values ​​for self-collision pairs, including: Feature extraction is performed on the current robot state to obtain global pose features; Based on global attitude features, coarse-grained safety prediction is performed to obtain the initial safety distance value of the preset self-collision pair; Based on the interaction type of different body parts, the initial safe distance value of the self-collision pair of the corresponding interaction type is grouped and corrected to obtain the corresponding safe distance value.

[0006] Furthermore, under the functional constraints, the corresponding target joint motions are obtained by solving, including: Using the correction amount of the target joint motion relative to the initial joint motion as the optimization variable, an objective function is constructed that includes a weighted sum of squares of the correction amount and a relaxation variable penalty term; The functional constraints and joint physical limits that introduce relaxation variables are determined as target constraints. Under the objective constraints, the optimal correction amount that minimizes the objective function is solved, and the sum of the initial joint motion and the optimal correction amount is taken as the objective joint motion.

[0007] Furthermore, gradient prediction processing is performed on the activated collision pairs according to the preset prediction model to obtain the joint space gradient of each activated collision pair with respect to the current joint configuration, including: For each active collision pair, the partial derivatives of the safe distance value of the active collision pair with respect to each joint angle in the current joint configuration are calculated through backpropagation of the preset prediction model. The partial derivatives of each joint angle are combined to form the joint space gradient of each activated collision pair.

[0008] Furthermore, before obtaining the initial joint motion corresponding to the current robot state and the reference motion, the following steps are also included: Offline collision detection is performed based on a pre-set high-fidelity geometric model to calculate the real safety margin of multiple body parts under different joint configurations. Using each joint configuration as input feature and the corresponding true safety margin as safety label, a training dataset and a calibration dataset are constructed. The preset safety value prediction model is trained based on the training dataset, and the trained safety value prediction model is calibrated based on the calibration dataset to obtain the target safety value prediction model. Accordingly, safety value prediction is performed based on the current robot state, including: The target safety value prediction model is used to predict the safety value of the current robot state.

[0009] Furthermore, the pre-defined safety value prediction model is trained based on the training dataset, including: An asymmetric loss function is used to train the safety value prediction model; wherein, the first penalty weight applied by the asymmetric loss function to samples that are actually unsafe but are predicted to be safe is higher than the second penalty weight applied to samples that are actually safe but are predicted to be unsafe.

[0010] Furthermore, the trained security value prediction model is calibrated using the calibration dataset to obtain the target security value prediction model, including: The calibration dataset is input into the trained safety value prediction model for data processing to obtain the predicted safety distance value. The statistical prediction of the safe distance value is the optimistic bias relative to the corresponding safe label in the calibration dataset, where the safe label is the true safety margin of the corresponding sample; A conservative buffer value is set for each preset self-collision pair based on the optimistic bias. The target safety distance value after tightening is determined based on the predicted safety distance value and the conservative buffer value. The safety value prediction model is then updated based on the target safety distance value to obtain the target safety value prediction model. The target safety value prediction model takes the joint configuration as input and outputs the corresponding target safety distance value.

[0011] Furthermore, before obtaining the initial joint motion corresponding to the current robot state and the reference motion, the following steps are also included: Generate multiple sets of candidate parameters for configuring function constraints and their solution process; Based on the preset constraint proxy model, each group of candidate parameters is safely screened to obtain the candidate parameter group that passes the screening; The selected candidate parameter groups are evaluated through simulation. The candidate parameter groups that meet the preset safety conditions and preset performance conditions are determined as deployment parameters. The deployment parameters are used to construct and solve the function constraints in the configuration correction process.

[0012] In a second aspect, embodiments of this application provide a robot motion control device, comprising: Memory and one or more processors; Memory, used to store one or more programs; When one or more programs are executed by one or more processors, the one or more processors implement the robot motion control method as described in the first aspect.

[0013] In a third aspect, embodiments of this application provide a storage medium for storing computer-executable instructions, which, when executed by a computer processor, are used to perform the robot motion control method as described in the first aspect.

[0014] This application embodiment obtains the initial joint motion corresponding to the current robot state and reference motion during robot motion control. Based on the current robot state, a safety value prediction is performed to obtain multiple preset safety distance values ​​for self-collision pairs. These self-collision pairs are pre-specified pairs of parts that will collide with different body components of the robot. Activated collision pairs with safety distance values ​​less than a preset activation threshold are selected. Gradient prediction processing is performed on the activated collision pairs according to a preset prediction model to obtain the joint space gradient of each activated collision pair with respect to the current joint configuration. Functional constraints are constructed based on the safety distance values ​​of each activated collision pair, the joint space gradient, and the preset safety threshold. Under these constraints, the target joint motion is obtained by minimizing the difference from the initial joint motion. The target joint motion is a joint angle command vector composed of the corrected target angle values ​​of each robot joint. The robot is then controlled to perform motion based on the target joint motion.

[0015] By employing the aforementioned technical means, the safe distance value of a preset self-collision pair can be obtained through safety value prediction. This quantifies the distance to the self-collision, allowing for early identification and quantified warning of critical states near the safety boundary that have not yet made actual contact. Compared to the traditional binary classification labeling method for collisions, this embodiment reduces missed detections due to insufficient information granularity, thereby significantly reducing the self-collision missed detection rate and consequently significantly reducing the risk of self-collision during robot control. Furthermore, by pre-setting multiple self-collision pairs, it effectively covers various interaction relationships such as leg and arm, head and arm, torso and limbs, and arm and arm. Compared to the traditional method that only uses simplified geometric approximations such as capsules or bounding boxes and can only cover a portion of collision pairs, this embodiment effectively covers multiple monitored self-collision pairs, avoiding the omission of collisions between certain body parts due to incomplete collision pair sets, further reducing the self-collision missed detection rate. Furthermore, by re-correcting the robot based on its latest current state in each control cycle, this embodiment solves the problem that the reference trajectory after offline correction is safe but the actual execution trajectory is unsafe, compared to the traditional offline correction method. This embodiment can make real-time safety judgments and necessary action corrections based on the current real posture, further reducing the risk of self-collision during robot control.

[0016] Furthermore, the correction process intervenes only when the safe distance value of the self-collision pair exceeds the activation threshold. Through precise guidance of the joint space gradient, the correction amount is concentrated on the few joints that are most effective in increasing the safe distance value. This minimizes the correction magnitude while achieving the same safety improvement effect. Therefore, the target joint motion that is safe from self-collision can be obtained with the minimum correction amount while ensuring the original motion style. This significantly reduces the risk of self-collision while ensuring the accuracy of robot motion control, thereby significantly improving the safety of robot motion control.

[0017] The beneficial effects of the robot motion control device and storage medium provided above can be referenced in relation to the beneficial effects of the robot motion control method. Attached Figure Description

[0018] Figure 1 This is a flowchart of a robot motion control method provided in an embodiment of this application; Figure 2 This is a first schematic diagram of a robot action provided in an embodiment of this application; Figure 3 This is a second schematic diagram of a robot action provided in an embodiment of this application; Figure 4 This is a third schematic diagram of a robot action provided in an embodiment of this application; Figure 5This is a flowchart of another robot motion control method provided in the embodiments of this application; Figure 6 This is a flowchart of yet another robot motion control method provided in the embodiments of this application; Figure 7 This is a flowchart of another robot motion control method provided in the embodiments of this application; Figure 8 This is a flowchart of another robot motion control method provided in the embodiments of this application; Figure 9 This is a schematic diagram of the structure of a robot motion control device provided in an embodiment of this application; Figure 10 This is a schematic diagram of the structure of a robot motion control device provided in an embodiment of this application. Detailed Implementation

[0019] To make the objectives, technical solutions, and advantages of this application clearer, specific embodiments of this application will be described in further detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are merely for explaining this application and not for limiting it. It should also be noted that, for ease of description, only the parts relevant to this application are shown in the drawings, not all of them. Before discussing exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe operations (or steps) as sequential processes, many of these operations can be performed in parallel, concurrently, or simultaneously. Furthermore, the order of the operations can be rearranged. The process can be terminated when its operation is completed, but may also have additional steps not included in the drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.

[0020] Currently, full-body motion control for humanoid robots typically employs a two-stage approach. The first stage involves an upper-level module generating reference actions based on text commands, human motion data, video reconstruction results, or motion databases. The second stage involves a lower-level reinforcement learning tracking strategy outputting joint movements based on the current robot state and the reference actions, enabling the robot to perform full-body movements such as walking, dancing, and interactive postures in simulations or on a real machine. While this technology can generate relatively rich semantic actions, the generated or redirected reference actions may not necessarily meet the geometric constraints of the specific robot body. To address potential physical inconsistencies in the reference actions, solutions typically involve offline action correction and online safety filtering.

[0021] Offline motion correction methods typically preprocess the reference motion before robot execution through motion redirection, inverse kinematics optimization, multi-contact trajectory optimization, or physical consistency optimization to reduce foot slippage, ground slippage, floating, or obvious joint inconsistencies. This method primarily affects the reference motion itself; during execution, closed-loop tracking is still performed by lower-level strategies. However, because the tracking strategy still outputs motion based on the current state, disturbances, and model errors during actual execution, the actual posture may deviate from the corrected reference motion, leading to renewed self-collision risks. Therefore, this offline motion correction method cannot guarantee safe closed-loop execution.

[0022] Online safety filtering methods typically involve constraining and modifying the actions output by the strategy or controller during control execution. Traditional online methods often use simplified geometric models such as capsules, spheres, or bounding boxes to approximate body parts, and calculate mutual distances or collision boundaries in the controller. Because simplified geometric models cannot accurately represent the true shapes of complex parts such as the legs, arms, torso, and head of a humanoid robot, they are prone to problems such as overly conservative approaches leading to excessive modification of actions and thus impairing action representation, or insufficient coverage resulting in the failure to detect real self-collisions in a timely manner.

[0023] Traditional online methods often employ triangular meshes, convex hulls, or fine geometric models to calculate more accurate self-collision distances. While self-collision distance calculations based on triangular meshes or convex hulls are more accurate, the computational cost is too high if distance queries are performed on a large number of body part pairs and joint space gradients are calculated in each control cycle. This cannot meet the real-time control frequency requirements of humanoid robots, making this method difficult to use directly for real-time control.

[0024] Traditional online methods typically train neural networks to learn binary classification boundaries between collisions and non-collisions, and then use the trained neural network to correct reference actions. However, learning only collision classification boundaries cannot reliably provide continuous safety values ​​and gradients with respect to joint configurations, making it difficult to directly construct constraints to achieve minimum corrections. Therefore, this type of approach is insufficient to support constrained action correction.

[0025] Therefore, traditional methods of robot motion control have a high rate of missed collisions and pose a significant risk of self-collision.

[0026] Based on this, the robot motion control method, device, and storage medium of this application are provided. The purpose is to acquire the initial joint action corresponding to the current robot state and reference action during robot motion control; predict safety values ​​based on the current robot state to obtain multiple preset safety distance values ​​for self-collision pairs, where a self-collision pair is a pre-specified pair of parts that will collide between different body parts of the robot; filter out active collision pairs that are less than a preset activation threshold based on the safety distance values; perform gradient prediction processing on the active collision pairs according to a preset prediction model to obtain the joint space gradient of each active collision pair with respect to the current joint configuration; construct function constraints based on the safety distance values ​​of each active collision pair, the joint space gradient, and the preset safety threshold; and, under the function constraints, solve for the corresponding target joint action with the objective of minimizing the difference from the initial joint action, where the target joint action is a joint angle command vector composed of the corrected target angle values ​​of each joint of the robot; and control the robot to perform motion based on the target joint action.

[0027] By employing the aforementioned technical means, the safe distance value of a preset self-collision pair can be obtained through safety value prediction. This quantifies the distance to the self-collision, allowing for early identification and quantified warning of critical states near the safety boundary that have not yet made actual contact. Compared to the traditional binary classification labeling method for collisions, this embodiment reduces missed detections due to insufficient information granularity, thereby significantly reducing the self-collision missed detection rate and consequently significantly reducing the risk of self-collision during robot control. Furthermore, by pre-setting multiple self-collision pairs, it effectively covers various interaction relationships such as leg and arm, head and arm, torso and limbs, and arm and arm. Compared to the traditional method that only uses simplified geometric approximations such as capsules or bounding boxes and can only cover a portion of collision pairs, this embodiment effectively covers multiple monitored self-collision pairs, avoiding the omission of collisions between certain body parts due to incomplete collision pair sets, further reducing the self-collision missed detection rate. Furthermore, by re-correcting the robot based on its latest current state in each control cycle, this embodiment solves the problem that the reference trajectory after offline correction is safe but the actual execution trajectory is unsafe, compared to the traditional offline correction method. This embodiment can make real-time safety judgments and necessary action corrections based on the current real posture, further reducing the risk of self-collision during robot control.

[0028] Furthermore, the correction process intervenes only when the safe distance value of the self-collision pair exceeds the activation threshold. Through precise guidance of the joint space gradient, the correction amount is concentrated on the few joints that are most effective in increasing the safe distance value. This minimizes the correction magnitude while achieving the same safety improvement effect. Therefore, the target joint motion that is safe from self-collision can be obtained with the minimum correction amount while ensuring the original motion style. This significantly reduces the risk of self-collision while ensuring the accuracy of robot motion control, thereby significantly improving the safety of robot motion control.

[0029] Figure 1 This is a flowchart illustrating a robot motion control method provided in an embodiment of this application. The robot motion control method provided in this embodiment can be executed by a robot motion control device, which can be implemented through software and / or hardware. The robot motion control device can consist of two or more physical entities, or it can consist of a single physical entity. Generally, the robot motion control device can be a motion controller, such as a PLC controller, embedded controller, motion control card, or dedicated robot controller.

[0030] The following description uses a motion controller as the main component for executing robot motion control methods. (Refer to...) Figure 1 The robot motion control method specifically includes: S11. Obtain the initial joint motion corresponding to the current robot state and reference motion, predict the safety value based on the current robot state, and obtain the safety distance values ​​of multiple preset self-collision pairs. The self-collision pair is a pair of parts that are pre-specified to collide between different body parts of the robot.

[0031] In one embodiment, during robot motion control, the initial joint actions corresponding to the current robot state and reference actions are first acquired. Based on the current robot state, safety value prediction is performed to obtain multiple preset safe distance values ​​for self-collision pairs. The current robot state includes at least the robot's current joint configuration, which is characterized by the current angle values ​​of each joint. The current robot state can be obtained in real time by encoders installed at each joint of the robot. For example, in this control cycle, joint angle data such as the current angle of the left hip pitch joint being 20°, the current angle of the right knee pitch joint being 55°, and the current angle of the left shoulder pitch joint being 55° are read from the encoders at each joint. These angle values ​​are arranged in order of joint number to form a complete joint configuration vector, which is the current robot state. It should be noted that the dimension of this joint configuration vector is equal to the total number of degrees of freedom of the robot's joints.

[0032] The reference motion refers to the desired motion trajectory of the robot to be tracked. It is pre-generated by the upper-level motion generation module and provided to this embodiment as a tracking target. It can originate from the motion generation results of text semantics, the redirected output of human motion capture data, or the retrieval results of a preset motion database. It should be noted that the role of the reference motion in this step is to provide motion intention guidance for the generation of the initial joint movements.

[0033] The initial joint motion is a joint angle command vector output by a pre-trained reinforcement learning tracking strategy based on the current robot state and reference motion. Each component of this joint angle command vector uniquely corresponds to a joint of the robot, and its value represents the target angle that the joint should reach in the current control cycle. Optionally, the reinforcement learning tracking strategy can process data based on the current robot state (i.e., joint configuration vector) and reference motion in the current control cycle to obtain the corresponding initial joint motion. For example, the reinforcement learning tracking strategy calculates target values ​​such as the left hip pitch joint should be adjusted to 25°, the right knee pitch joint to 50°, and the left shoulder pitch joint to 80° based on the deviation between the current robot state (i.e., joint configuration vector) and the reference motion. These target values ​​are then used as the initial joint motions. It should be noted that this reinforcement learning tracking strategy has acquired the ability to track reference motion based on the current state after extensive trial and error training in a simulation environment. Its network structure and training details are not elaborated here.

[0034] In this context, self-collision pairs refer to pre-defined pairings of body parts that are likely to come into contact or collide with each other during actual movement, based on the geometry, kinematic connections, and common range of motion of the robot's various body parts during the offline preparation phase. For example, in a humanoid robot, multiple part pairs such as left thigh and right arm, right thigh and left arm, head and left arm, head and right arm, torso and left thigh, torso and right thigh, between left and right upper arms, between left and right forearms, left arm and side of torso, and right arm and side of torso can be pre-defined as preset self-collision pairs. These self-collision pairs cover most combinations of body parts that are at risk of collision when the robot performs full-body movements, and once the set is determined, it remains unchanged in all subsequent steps.

[0035] The safety distance value is a continuous numerical sequence, with each value corresponding to a pre-defined self-collision pair. Optionally, the safety distance value is a continuous numerical sequence output by a pre-trained safety value prediction model after a single forward propagation calculation of the current joint configuration vector. The magnitude of this safety distance value directly reflects the distance between the two body parts in the corresponding self-collision pair and the critical collision boundary under the current joint configuration. For example, a large positive safety distance value indicates that there is a sufficient safety gap between the two parts; a gradually decreasing safety distance value indicates that the two parts are approaching each other; a safety distance value approaching 0 indicates that the two parts are about to make contact; and a negative safety distance value indicates that the two parts have undergone geometric penetration.

[0036] In one embodiment, at the beginning of each control cycle, the current robot state is first acquired via sensors, including joint configuration vectors such as the current angles and angular velocities of each joint. Simultaneously, the upper-layer motion generation module generates reference actions based on input motion commands (such as dance commands), and the lower-layer reinforcement learning tracking strategy outputs initial joint actions based on the current robot state and the reference actions. Subsequently, the current robot state (i.e., the joint configuration vectors) is input into a pre-trained and deployed safety value prediction model. This safety value prediction model predicts safety distance values ​​for multiple pre-specified self-collision pairs in the offline phase based on the input joint configuration vectors, outputting the corresponding safety distance values ​​for each collision pair. The safety distance values ​​are continuous values. For example, the output safety distance values ​​are 18 cm between the left thigh and right arm, 20 cm between the right thigh and left arm, 5 cm between the head and left arm, 30 cm between the head and right arm, 35 cm between the torso and left thigh, and 4 cm between the left arm and the side of the torso.

[0037] Unlike traditional binary classification that only outputs collision or no collision, this embodiment outputs a continuous safety distance value, which provides precise quantitative information about how far away a collision is from subsequent correction processing. The larger the safety distance value, the more room there is for action adjustment; the smaller the safety distance value, the more urgent the buffer time left for correction processing. This fine quantitative information allows subsequent correction processing to apply intervention proportionally according to the degree of risk, avoiding one-size-fits-all overcorrection, thereby improving the accuracy of subsequent action correction.

[0038] As described above, by acquiring the current robot state to perceive the robot's current true physical posture, by acquiring the initial joint movements corresponding to the reference movements to obtain the initial joint commands for the robot's motion target, and by using the safety distance value to assess the safety risk level between the monitored body parts in the current posture, this embodiment simultaneously completes three key tasks within a control cycle time window: perceiving the robot's current true physical posture, acquiring the initial joint commands that conform to the motion target, and assessing the safety risk level between the monitored body parts in the current posture. This provides complete input information for the next step of corrective decision-making.

[0039] S12. Select active collision pairs that are less than the preset activation threshold based on the safety distance value.

[0040] After obtaining the preset safe distance value for the self-collision pair in S11, active collision pairs with a safe distance value less than a preset activation threshold are selected. The preset activation threshold is a pre-set positive parameter used to determine whether a self-collision pair needs to trigger subsequent corrective intervention. Its value determines the timing and sensitivity of the corrective intervention. A larger preset activation threshold results in earlier intervention and a more conservative safety profile; a smaller preset activation threshold results in less intervention and a movement performance closer to the original strategy. An active collision pair refers to a self-collision pair with a safe distance value less than the preset activation threshold. This indicates that the two body parts in the collision pair are close to the collision boundary under the current joint configuration and must be included within the constraint range of the corrective intervention. Conversely, self-collision pairs with a safe distance value greater than or equal to the preset activation threshold are in a safe state and no safety constraints are applied during this control cycle.

[0041] In one embodiment, after obtaining the preset safe distance value for the self-collision pair in S11, the safe distance value of all monitored self-collision pairs is compared one by one with a preset activation threshold. Self-collision pairs with safe distance values ​​less than the preset activation threshold are filtered out and marked as active collision pairs. For example, if the preset activation threshold is set to 10 cm, and the safe distance value between the head and the left arm obtained in S11 is 5 cm, since 5 cm is less than the preset activation threshold of 10 cm, this self-collision pair is marked as active. Similarly, if the safe distance between the left arm and the side of the torso is 4 cm, since 4 cm is less than the preset activation threshold of 10 cm, this self-collision pair is marked as active. If the safe distance between the left thigh and the right arm is 18 cm, since 18 cm is greater than the preset activation threshold of 10 cm, it is not marked (i.e., not activated). If the safe distance between the right thigh and the left arm is 20 cm, since 20 cm is greater than the preset activation threshold of 10 cm, it is not marked (i.e., not activated). The aforementioned S11 yields a safe distance of 30 cm between the head and the right arm. Since 30 cm is greater than the preset activation threshold of 10 cm, it is not marked (i.e., not activated). The aforementioned S11 also yields a safe distance of 35 cm between the torso and the left thigh. Since 35 cm is greater than the preset activation threshold of 10 cm, it is not marked (i.e., not activated). Through the aforementioned screening, among the 10 monitored self-collision pairs, 2 self-collision pairs were marked as active collision pairs in this control cycle, while the remaining 8 collision pairs did not participate in subsequent gradient calculations and constraint construction.

[0042] As described above, by using a preset activation threshold screening mechanism, the number of constraints for subsequent optimization problems is significantly reduced from the total number of monitored self-collision pairs (10 in this embodiment) to the actual number of activated collision pairs that need intervention (only 2 in this embodiment). This makes the scale of variables that need to be constructed and optimized in each control cycle proportional to the actual risk level of the current posture. When the robot is in a safe posture (all safe distance values ​​are greater than the activation threshold), the constraint construction and optimization solution can even be completely skipped, and only a fast safe distance value comparison needs to be performed once, thereby effectively ensuring the real-time performance of the correction process.

[0043] S13. Perform gradient prediction processing on the activated collision pairs according to the preset prediction model to obtain the joint space gradient of each activated collision pair with respect to the current joint configuration.

[0044] After selecting the active collision pairs in S12, gradient prediction processing is performed on the active collision pairs according to the preset prediction model to obtain the joint space gradient of each active collision pair with respect to the current joint configuration. The preset prediction model is a target safety value prediction model trained offline and deployed to the online control system. This model is a multi-layer neural network with fixed parameters, which establishes a deterministic differentiable mapping from the joint configuration vector (input) to the safety distance value (output) of each collision pair. The joint space gradient is a vector with a dimension equal to the total number of degrees of freedom of the robot joints (23 dimensions in this example). Each component in this vector represents the instantaneous change in the safety distance value of the corresponding active collision pair when the angle of the corresponding joint changes slightly under the current joint configuration. For example, a positive component indicates that increasing the joint angle will increase the safety distance value (i.e., the two body parts move away from each other), while a negative component indicates that increasing the joint angle will decrease the safety distance value (i.e., the two body parts move closer to each other). The larger the absolute value of the component, the more significant the influence of the joint on the safety distance value of the collision pair.

[0045] For example, after selecting active collision pairs in the aforementioned S12, for each active collision pair, the partial derivatives of the safe distance value of the active collision pair with respect to each joint angle in the current joint configuration are calculated through backpropagation of the preset prediction model. The partial derivatives of each joint angle are combined to form the joint space gradient of each active collision pair. For instance, for each active collision pair selected in the aforementioned S12, the automatic differentiation capability of the preset prediction model is used, with the safe distance value of the active collision pair as the starting point of backpropagation, and the gradient is propagated layer by layer from the output layer to the input layer along the computation graph of the network using the chain rule. Finally, the partial derivatives of the safe distance value with respect to each input component (i.e., each joint angle) are obtained at the input layer of the network. The partial derivatives of all joint angles are arranged in the same joint number order as the joint configuration vector, which is combined to form the joint space gradient vector of the active collision pair.

[0046] For example, for the active collision pair of the head and left arm, with a current safe distance of 5 cm, the joint space gradient vector of this active collision pair is calculated through backpropagation. Assume that the calculated partial derivatives for the left shoulder pitch joint are +0.06, the partial derivative for the trunk yaw joint is -0.05, the partial derivative for the left elbow joint is +0.02, and the partial derivative for the left knee pitch joint is close to 0 (approximately 0.001). The partial derivatives for the remaining 19 joints are also distributed near values ​​close to 0. The gradient distribution pattern of the calculated partial derivatives clearly reveals that adjusting the left shoulder pitch joint to move in the positive direction (raising the left arm further upward and outward) is the most effective way to increase the safe distance between the head and left arm. Secondly, adjusting the trunk yaw joint to move in the negative direction (slightly rotating the trunk around the vertical axis to the right to move the head away from the left arm) also has a significant effect. Adjusting the lower limb joints far from the collision area (such as the left knee pitch) has almost no effect on the safe distance of this collision pair.

[0047] As described above, the precise partial derivatives of the activation collision pair with respect to all joints can be obtained simultaneously through a single backpropagation of the prediction model. The computational cost is only about a constant multiple of a single forward propagation, far less than the large number of forward propagations required by traditional methods to perform finite difference numerical calculations for each joint individually. This significantly reduces the computational load and improves the real-time performance of robot motion control. Furthermore, each component of the joint space gradient precisely indicates the direction and magnitude of each joint's influence on the safety distance value, providing efficient numerical guidance for the subsequent construction of constraints and the determination of the minimum correction direction.

[0048] In one embodiment, for the first For each active collision pair, a safety value prediction model is established based on the joint configuration vector. To the self-collision safe distance value mapping Where N is the total number of joint degrees of freedom, and in this embodiment N equals 23. This indicates that the safety value prediction model, after training, has solidified the values ​​from the input to the... The subnetwork mapping function output by each self-collision pair is used to obtain the safe distance value through backpropagation. Regarding the angles of each joint The partial derivative (i.e., partial differential) is denoted as / ,in This means that, while keeping the angles of other joints constant, the first joint... Safety distance value when a single joint angle experiences a tiny increment The instantaneous rate of change; all The partial derivatives of the nth joint are arranged in order of joint number, thus forming the nth joint. The gradient vector of the joint space gradient of each activated collision pair , where the symbol This represents the gradient operator, where the dimension of the gradient vector is the same as that of the joint configuration vector. Completely identical, both are Dimension. In this embodiment, the head and left arm are considered as an active collision pair, and their safe distance value is set to 1. At the angle of the left shoulder extension joint Equal to 80°, trunk yaw joint angle =0°, left elbow joint angle Equal to 30° and the left knee flexion-extension joint angle The current joint configuration consists of 23 joint angle values ​​equal to 25°. The partial derivative values ​​obtained through backpropagation are as follows: / = (+0.06) (meaning that for every 1° increase in the left shoulder pitch angle, the head-to-arm safe distance increases by approximately 0.06 cm). / = (-0.05) (This means that for every 1° increase in the torso yaw angle, the head-to-arm safe distance decreases by approximately 0.05 cm as the body rotates in the positive direction; in other words, rotating in the negative direction increases the safe distance). / = (+0.02) / The partial derivatives of the remaining 19 joints are also distributed near zero. Arranging these partial derivative values ​​in order of joint numbering constitutes the gradient vector of the joint space gradient of the activated collision pair. .

[0049] As described above, the joint space gradient calculation relies on a pre-trained and deployed safety value prediction model. This model has learned the mapping law from joint configuration to safety distance from a large amount of high-fidelity geometric collision data during the learning phase. Therefore, the gradient obtained by backpropagation naturally reflects the collision sensitivity under the real geometric relationship. Compared with the traditional method of using simplified geometric models (such as capsule approximation) for online gradient calculation, this embodiment significantly reduces the probability of missed detection. In addition, the partial derivatives of all joints can be obtained in a single backpropagation calculation, and its computational cost is much less than that of the traditional finite difference method. This allows the gradient calculation to be completed in microseconds without taking up valuable time budget in the control cycle. This ensures that the complete activation screening, gradient calculation and constraint solving process can be reliably executed in each cycle in high-frequency (such as 500 Hz to 1000 Hz) control loops. The safety correction step will not be skipped due to the calculation timeout of a certain cycle, effectively ensuring the continuity and real-time performance of self-collision safety protection.

[0050] S14. Construct function constraints based on the safe distance values ​​of each active collision pair, the joint space gradient, and the preset safety threshold. Under the function constraints, solve for the corresponding target joint action with the goal of minimizing the difference between the target and the initial joint action.

[0051] After obtaining the joint space gradient of each active collision pair in S13, a function constraint is constructed based on the safety distance value of each active collision pair, the joint space gradient, and a preset safety threshold. Under the function constraint, the target joint action is obtained by minimizing the difference from the initial joint action. The safety threshold is a positive parameter smaller than the activation threshold; for example, it is set to 6 cm in this embodiment, representing the absolute lower limit of the safety distance value that cannot be lowered. Even after the joint action has been corrected, it must ensure that the safety distance value of any active collision pair does not fall below the safety threshold within the current control cycle. The function constraint is a linear inequality based on the control barrier function theory. It means that within the current control cycle, the decrease in safety distance value caused by changes in joint action cannot exceed the constraint value. This preset value is the difference between the current safety distance value and the safety threshold multiplied by a decay coefficient, thereby ensuring that the safety distance value is still higher than the safety threshold at the beginning of the next control cycle.

[0052] For example, for each activated collision pair, the gradient vector is obtained using its current joint space gradient. (The output of S13 mentioned above), current safe distance value And a preset safety threshold, to construct linear inequality constraints. For example The transpose of the first value is multiplied by the correction factor, and the attenuation coefficient is multiplied by the second value. The second value is obtained, and the attenuation coefficient is multiplied by the safety threshold to obtain the third value. A linear inequality constraint is constructed where the sum of the first and second values ​​is greater than or equal to the third value. This linear inequality constraint defines a feasible half-space in the joint motion correction space. Only corrections that allow the corrected joint motion to fall within this half-space are considered safe. For example, for the head and left arm active collision pair, the corresponding safe distance value is 5 cm and the safety threshold is 6 cm. The constructed function constraint requires that any joint correction must ensure that the safe distance value of the self-collision pair will not further decrease to below 6 cm within the current control cycle. For the left arm and torso side active collision pair, the corresponding safe distance value is 4 cm and the safety threshold is 6 cm. The corresponding function constraint is constructed similarly. In the solution phase, the function constraints of all active collision pairs and the physical limit constraints of each joint (i.e., the upper and lower limits of the mechanical travel of each joint angle) are used as joint constraints. The optimization objective is to minimize the weighted distance between the target joint motion and the initial joint motion. A standard quadratic programming problem is constructed and solved.

[0053] In one embodiment, during the solution of the aforementioned standard quadratic programming problem, the correction amount of the target joint motion relative to the initial joint motion is used as the optimization variable, and an objective function is constructed that includes a weighted sum of squares of the correction amount and a relaxation variable penalty term. The functional constraints that introduce relaxation variables and the physical limits of the joints are defined as the objective constraints. Under the objective constraints, the optimal correction amount that minimizes the objective function is solved, and the sum of the initial joint motion and the optimal correction amount is taken as the target joint motion. The objective function consists of two parts: a weighted sum of squares of the correction amount (vector) and a relaxation variable penalty term corresponding to each activated collision pair. The weighted sum of squares measures the cost of the correction magnitude, and the size of each element on the diagonal of the weight matrix corresponding to the weighted sum of squares determines the cost of correcting the corresponding joint. For example, core motion joints (such as leg joints) are typically assigned larger weights to maintain the original motion intention as much as possible, while safety-sensitive joints (such as shoulder joints) are assigned smaller weights to allow for necessary safety adjustments. The purpose of the slack variable penalty term is to allow the constraints to be appropriately relaxed when the constraints are strictly infeasible (e.g., multiple safety constraints are activated at the same time under extreme attitude and their directions conflict with each other). This is done at the cost of slack variables in exchange for a feasible approximate solution, thereby avoiding the interruption of the control loop due to the unsolvable optimization problem.

[0054] For example, under the target constraint, the optimal correction amount that minimizes the objective function is solved. The optimal correction amount is to increase the left shoulder pitch joint angle by 5°, adjusting it from the initial joint motion of 80° to 85°, and decrease the torso yaw joint angle by 6°, adjusting it from the initial joint motion of 0° to -6°. The relaxation variables corresponding to the two active collision pairs are all 0, indicating that the target constraint condition can be fully satisfied and no relaxation is needed. The correction amounts for the remaining 21 joints are all 0. The initial joint motion (vector) is added component by component to the above optimal correction amount to obtain the target joint motion (vector). This correction process increases the safe distance between the head and the left arm from 5 cm to 9 cm, which is greater than the safety threshold of 6 cm; the safe distance between the left arm and the side of the torso increases from 4 cm to 8 cm, which is also greater than the safety threshold of 6 cm; thus effectively eliminating the collision risk.

[0055] As described above, since the function constraints strictly guarantee that the modified joint motion is self-collision safe, this process does not rely on heuristic rules or random trial and error, and has determinism and verifiability. Moreover, the objective function explicitly minimizes the weighted sum of squares of the correction amount, so that the correction amount is concentrated on the few joints that are most effective in increasing the safety distance value (only two joints are corrected in this embodiment). Under the premise of achieving the same safety improvement effect, the correction magnitude is reduced to the minimum, and the motion style of the original strategy is preserved to the greatest extent. In addition, the introduction of slack variables enables the solver to return a feasible approximate solution even under extreme postures with multiple constraint conflicts, enhancing the robustness and uninterrupted operation capability of the system.

[0056] In one embodiment, during the constraint construction and optimization solution process, the initial joint motion vector within the current control cycle is assumed to be... The target joint motion vector is The correction vector is , These are the optimization variables to be solved. For the th One activated collision pair ( , In this embodiment, the total number of collision pairs activated during the current control cycle is [number]. (equal to 2), let its current safe distance value be 2. The joint space gradient vector is (Calculated from S13 above), the corresponding slack variable is ( For a scalar greater than or equal to 0, when the constraint can be satisfied... The value is equal to 0 (only greater than 0 when the constraint is strictly infeasible), the preset attenuation coefficient is α (α is a positive number between 0 and 1, and in this embodiment, α is taken as 0.5), and the preset safety threshold is... (In this embodiment) If the distance is equal to 6 cm, then the functional constraint condition for the activated collision pair can be expressed as a linear inequality: Where T denotes the transpose of a vector. The first term on the left-hand side of this inequality... The first-order approximation lower joint correction amount The resulting change in the safety distance value, according to Taylor expansion, at the current joint configuration, is approximately equal to the inner product of the gradient vector and the joint change; the second term on the left. Used to limit the natural decay rate of the safety distance value without correction action, on the right. This indicates the conservative lower limit that the safe distance value must not fall below after one control cycle, as shown on the right. The term allows for the relaxation of constraints using slack variables when necessary.

[0057] In one embodiment, the physical limiting constraints of each joint are expressed as follows: ,in and These are the lower and upper limit angle vectors of the mechanical travel of each joint, respectively. The objective function is expressed as: , where T represents the transpose of the vector. for positive definite diagonal weight matrix of order 1. ,in Represents a diagonal matrix. Greater than 0 indicates the first The correction cost weight for each joint The larger the value, the more likely the joint will remain unchanged and not be modified. For the first The relaxation penalty coefficient corresponding to each activated collision pair The value is positive and set to be much greater than 1. The order of magnitude is used to strongly suppress unnecessary relaxation. In the resulting quadratic programming problem, the objective function is a quadratic convex function, meaning the first term is about... The quadratic form, the second term is about The sum of the squared terms; the constraint is about and The system of linear inequalities can be efficiently solved using a convex quadratic programming solver to obtain the globally optimal correction vector. and slack variable values Thus, the target joint movement is obtained. For example, substituting the specific values ​​from the aforementioned embodiments, The vector is composed of the nominal values ​​of 23 joints, including left shoulder pitch of 80°. Equal to 5 centimeters (head and left arm), Equal to 4 centimeters (left arm and side of torso). Equals 6 centimeters, α equals 0.5. The left shoulder pitch component is +0.06, the trunk yaw component is -0.05, the left elbow component is +0.02, and the components of the other joints are close to 0. The values ​​of each component are similarly calculated from the safety value prediction model. The weights for left shoulder pitch and torso yaw are set to smaller values ​​(e.g., 0.1) to allow for necessary safety corrections, while the weights for the remaining joints are set to larger values ​​(e.g., 1.0) to maintain the original movement intention as much as possible. and All values ​​are set to large values ​​(e.g., 100) to strongly suppress relaxation. The solution yields... The component corresponding to the left shoulder pitch is +5° (i.e.) The component corresponding to the torso yaw is -6° (equivalent to +5°). (equal to -6°), the remaining 21 components are 0, equal to 0 Equal to 0, the final target joint movement The left shoulder flexion joint is 85° and the trunk yaw joint is -6°.

[0058] As described above, the introduction of slack variables enables the optimization problem to return a feasible solution instead of directly failing when faced with extreme postures where multiple constraints conflict. For example, the constraints between the head and left arm require the left shoulder to be abducted, while the constraints between the left arm and torso also require the left shoulder to be abducted, but the required angles of the left shoulder differ. Or, multiple active collisions simultaneously impose contradictory requirements on the correction direction of the same joint. Without slack variables, the solver would return no solution when constraints conflict, resulting in no safety correction output for the current control cycle. The initial joint action would be directly issued and executed, potentially triggering a real collision, which is equivalent to a missed detection. Therefore, this embodiment, based on the introduction of slack variables, ensures that each cycle outputs a correction instruction that is as close as possible to the safety requirements with the minimum constraint violation cost (reflected in the penalty term of the objective function). This effectively eliminates missed detections caused by solution failure, thereby significantly reducing the self-collision missed detection rate in the overall process of robot motion control, and thus significantly reducing the risk of self-collision in the robot control process.

[0059] Furthermore, the design of the weighted sum of squares of the correction amount in the objective function establishes a quantitative trade-off between the correction magnitude and safety requirements. Different cost coefficients are assigned to different joints in the weight matrix of the objective function, so that the correction amount is preferentially allocated to joints with low correction cost and high efficiency in improving the safety distance value. For example, in this embodiment, the correction is concentrated on the left shoulder pitch and torso yaw joints, while the leg joints with higher cost are completely unaffected. This precise cost-oriented allocation avoids the coarse correction of overall deformation in order to meet safety constraints, so that the self-collision risk elimination behavior itself will not introduce new unstable factors or task failure risks, thereby improving the reliability of robot motion control.

[0060] As described above, S12 employs an activation screening mechanism, which involves real-time comparison of continuous safe distance values ​​output by the safety value prediction model with preset activation thresholds. This means that in each control cycle, the risk level of all monitored self-collision pairs is reassessed based on the latest joint configuration. Therefore, even if the safe distance value of a self-collision pair was within the safe range in the previous cycle (e.g., 30 cm between the head and the right arm), if the left arm swings significantly to the right in the current cycle due to the guidance of the reference action, the safe distance value output by the model will decrease in real time. Once it falls below the 10 cm activation threshold, it is immediately marked as an activated collision pair and enters the correction process. This cycle-by-cycle full reassessment mechanism ensures that new collision risks are not missed due to the inertia of historical states, effectively eliminating the missed detection window where collision risks have occurred but have not yet reached the next detection time in static rule tables or intermittent detection schemes, thereby significantly reducing the self-collision missed detection rate and thus significantly reducing the self-collision risk in the robot control process.

[0061] Furthermore, gradient prediction in S13 and constraint solving in S14 form a complete closed-loop link from risk perception to precise correction. Each component of the gradient vector precisely indicates the adjustment direction and efficiency of each joint. Constraints transform this directional information into a guaranteed safety boundary. The optimization solver automatically finds the joint adjustment scheme with the smallest correction magnitude while satisfying all safety constraints. The three work together to achieve efficient and accurate self-collision avoidance. Taking the activated collision pair in the aforementioned embodiment as an example, if a fixed safety offset is applied to the left shoulder pitch joint based solely on empirical rules (such as increasing by 10° regardless of the risk level), it may cause unnecessary overcorrection when the risk is small, thereby disrupting the smoothness of the dance movement. However, the +5° correction precisely guided by the gradient in this embodiment is just enough to restore the safety distance value to above the safety threshold, avoiding overcorrection.

[0062] Figure 2 This is a first schematic diagram of a robot action provided in an embodiment of this application, referring to... Figure 2 , Figure 2 The current robot state, captured by the joint encoder, is shown. At this time, the left shoulder pitch joint is 55°, the left hip pitch joint is 20°, and the right knee pitch joint is 55°. The left arm is raised diagonally upward, and there is a clear safe distance between the arm and the head. All body parts are within the safe area.

[0063] Figure 3 This is a second schematic diagram of a robot action provided in an embodiment of this application, referring to... Figure 3 , Figure 3 The image shows the robot's posture corresponding to the initial joint movements output by the reinforcement learning tracking strategy based on the current robot state and reference movements. At this point, the left shoulder pitch joint is adjusted to 80°, the left hip pitch joint to 25°, and the right knee pitch joint to 50°. The left arm is significantly close to the head, and the hand is very close to the side of the head, creating a clear risk of collision. Figure 3 The collision risk areas are marked with dashed ellipses. The safe distance between the head and the left arm is 5 cm, less than the preset activation threshold of 10 cm; therefore, the head and left arm are marked as an active collision pair. The safe distance between the left arm and the side of the torso is 4 cm, also less than the preset activation threshold of 10 cm; therefore, the left arm and the side of the torso are marked as an active collision pair. The safe distance between the left thigh and the right arm is marked with a leader line; this is greater than the preset activation threshold of 10 cm and is therefore not marked.

[0064] Figure 4 This is a third schematic diagram of a robot action provided in an embodiment of this application, referring to... Figure 4 , Figure 4The diagram shows the robot's posture after performing motion controlled by the target joint movement. At this point, the left shoulder pitch joint has been corrected from the initial joint movement of 80° to 85°. Figure 4 The arrow indicates a +5° safety correction direction. The trunk yaw joint has been corrected from the initial joint action of 0° to -6°. In the diagram, the trunk is represented by a parallelogram outline to show the slight yaw around the vertical axis. The 25° of the left hip pitch joint, the 50° of the right knee pitch joint, and the remaining 21 joints remain consistent with the initial joint action and have not been corrected. At this point, the safe distance values ​​for each active collision pair have recovered to above the safe threshold, and the corresponding collision risk has been eliminated.

[0065] S15. Control the robot to perform motion based on the target joint movement.

[0066] After obtaining the target joint motion in S14, the robot is controlled to perform motion based on the target joint motion. The target joint motion is the final joint angle command vector obtained in S14 under functional constraints, with the objective of minimizing the difference from the initial joint motion. Each component of this joint angle command vector simultaneously satisfies the self-collision safety requirements and is a command that can be safely executed on a real physical robot. Controlling the robot to perform motion means sending the joint angle command vector corresponding to the target joint motion to the actuators (such as servo motors or hydraulic drives) of each joint through the robot's underlying control communication link. The actuators' local closed-loop controllers (such as position servo controllers or torque servo controllers) drive each joint of the robot to move from the current angle to the target angle, thereby causing the robot to produce actual motion in physical space.

[0067] In one embodiment, the target joint motion obtained in S14, i.e., the joint angle command vector containing the target angle values ​​of each joint, is sent to the actuators of each underlying joint via a bus. The actuators of each joint convert each target angle value into drive commands for the corresponding joint motors, controlling the joint actuators to move at the target angle. For example, the target joint motion vector calculated in S14 includes 23 joint target angle values, such as 25° for the left hip pitch joint, 50° for the right knee pitch joint, 85° for the corrected left shoulder pitch joint, and -6° for the corrected trunk yaw joint. These joint target angle values ​​are encapsulated into control command messages, joint by joint or frame by frame, according to the robot control system's communication protocol, and sent to the servo drivers of each joint via a real-time data bus at a fixed frequency (e.g., 500 Hz, i.e., once every 2 milliseconds). The control command message includes the target angle command for the corresponding joint. After receiving the target angle command, the servo drivers of each joint perform position or torque tracking control at a higher frequency (e.g., 20kHz) in their local closed loop, driving the motors to rotate to the specified angle position, thereby causing the robot's left arm to make a slight outward adjustment and the torso to rotate slightly to avoid the collision risk area, while the lower limbs continue to complete the dance gait according to the guidance of the initial movement.

[0068] After this step is completed, the entire process of the current control cycle, from perception, prediction, correction to execution, is finished. The next control cycle then begins immediately, starting again from S11 to read the updated joint angle values ​​(at which point the robot's joints have moved to new positions under the drive of the previous cycle's instructions), obtain the reference action for the next moment, and re-execute the safety value prediction and correction process. This cycle repeats continuously, forming a closed-loop protection for the robot's self-collision safety. Through the complete online control link formed by S11 to S15, this embodiment, without changing the internal mechanism of the reinforcement learning tracking strategy or increasing the overhead of online high-fidelity geometric collision query, adds a layer of self-collision safety filtering capability to the humanoid robot's full-body motion control with an additional computational cost at the microsecond level per cycle. This allows the robot to closely adhere to and faithfully present the motion intent and expression style defined by the reference action when performing various full-body motion tasks such as text-driven dance, motion capture redirection, or autonomous walking. Simultaneously, it can automatically make minimal avoidance adjustments when body parts approach the collision threshold, achieving a dynamic unity of motion performance and body safety at the real-time level.

[0069] The above aims to obtain the initial joint motion corresponding to the current robot state and reference motion during robot motion control. Based on the current robot state, a safety value prediction is performed to obtain multiple preset safety distance values ​​for self-collision pairs. These self-collision pairs are pre-specified pairs of parts that will collide with different body components of the robot. Activated collision pairs with safety distance values ​​less than a preset activation threshold are selected. Gradient prediction processing is performed on the activated collision pairs using a preset prediction model to obtain the joint space gradient of each activated collision pair with respect to the current joint configuration. Functional constraints are constructed based on the safety distance values ​​of each activated collision pair, the joint space gradient, and the preset safety threshold. Under these constraints, the target joint motion is obtained by minimizing the difference from the initial joint motion. The target joint motion is a joint angle command vector composed of the corrected target angle values ​​of each robot joint. The robot's motion is then controlled according to the target joint motion.

[0070] By employing the aforementioned technical means, the safe distance value of a preset self-collision pair can be obtained through safety value prediction. This quantifies the distance to the self-collision, allowing for early identification and quantified warning of critical states near the safety boundary that have not yet made actual contact. Compared to the traditional binary classification labeling method for collisions, this embodiment reduces missed detections due to insufficient information granularity, thereby significantly reducing the self-collision missed detection rate and consequently significantly reducing the risk of self-collision during robot control. Furthermore, by pre-setting multiple self-collision pairs, it effectively covers various interaction relationships such as leg and arm, head and arm, torso and limbs, and arm and arm. Compared to the traditional method that only uses simplified geometric approximations such as capsules or bounding boxes and can only cover a portion of collision pairs, this embodiment effectively covers multiple monitored self-collision pairs, avoiding the omission of collisions between certain body parts due to incomplete collision pair sets, further reducing the self-collision missed detection rate. Furthermore, by re-correcting the robot based on its latest current state in each control cycle, this embodiment solves the problem that the reference trajectory after offline correction is safe but the actual execution trajectory is unsafe, compared to the traditional offline correction method. This embodiment can make real-time safety judgments and necessary action corrections based on the current real posture, further reducing the risk of self-collision during robot control.

[0071] Furthermore, the correction process intervenes only when the safe distance value of the self-collision pair exceeds the activation threshold. Through precise guidance of the joint space gradient, the correction amount is concentrated on the few joints that are most effective in increasing the safe distance value. This minimizes the correction magnitude while achieving the same safety improvement effect. Therefore, the target joint motion that is safe from self-collision can be obtained with the minimum correction amount while ensuring the original motion style. This significantly reduces the risk of self-collision while ensuring the accuracy of robot motion control, thereby significantly improving the safety of robot motion control.

[0072] Figure 5 This is a flowchart of another robot motion control method provided in the embodiments of this application, referred to... Figure 5 When determining the safe distance value, the robot motion control method specifically includes: S111. Extract features from the current robot state to obtain global pose features.

[0073] After obtaining the current robot state in S11, feature extraction is performed on the current robot state to obtain global pose features. Feature extraction refers to the computational process of converting the current joint configuration vector (i.e., the original input vector composed of joint angle values ​​arranged in numerical order) contained in the current robot state into a fixed-dimensional global pose feature vector. Optionally, feature extraction refers to the computational process of converting the current joint configuration vector contained in the current robot state into a fixed-dimensional global pose feature vector through a shared whole-body encoding network. The global pose features are high-level semantic representations of the current joint configuration after transformation. They encode the robot's overall pose information at the current moment, including the relative positional relationships between limbs, the approximate distribution of the body's center of gravity, and the linkage patterns of each joint. The shared whole-body encoding network consists of several fully connected layers stacked together, with non-linear activation functions between each layer. The shared whole-body encoding network progressively extracts hierarchical features from local joint relationships to global pose semantics from the bottom layer to the top layer.

[0074] In one embodiment, after obtaining the current robot state in S11, the current robot state is input into a shared whole-body encoding network. This network converts the current robot state into a fixed-dimensional global pose feature vector. The shared whole-body encoding network outputs this global pose feature vector, i.e., the corresponding global pose features. For example, the current robot state includes the current angle values ​​of 23 joints, such as left hip pitch 20°, right knee pitch 55°, and left shoulder pitch 55°. The current angle values ​​are combined into a 23-dimensional vector, which is then input into the encoding network. After matrix multiplication and nonlinear activation through multiple fully connected layers in the shared whole-body encoding network, the corresponding global pose feature vector is output. For example, the first layer in the multi-layer fully connected network maps 23 dimensions to 256 dimensions, the second layer maintains 256 dimensions, and the third layer maps to 128 dimensions, finally outputting a 128-dimensional global pose feature vector. Each component in this global pose feature vector does not directly correspond to any specific joint angle, but rather represents the projection value of the current overall pose onto a certain high-level semantic dimension.

[0075] As described above, by using a shared encoding approach, multiple different self-collision pairs (such as head and left arm, left arm and side of torso, and left thigh and right arm) reuse the posture features extracted by the same encoding network. This avoids the parameter expansion and computational redundancy caused by building a separate encoder for each collision pair, significantly improving computational speed and thus enhancing the real-time performance of subsequent robot motion control. Simultaneously, multi-layer nonlinear transformations enable the network to automatically learn posture representations that are discriminative for collision prediction. Compared to manually designed geometric features, the global posture features learned in this embodiment have stronger generalization ability and adaptability to complex postures.

[0076] S112. Perform coarse-grained safety prediction based on global attitude characteristics to obtain the preset initial safety distance value for self-collision pairs.

[0077] After obtaining the global pose features in S111, coarse-grained safety prediction is performed based on these features to obtain the initial safety distance values ​​for the preset self-collision pairs. Coarse-grained safety prediction refers to the process of outputting preliminary safety distance estimates for all preset self-collision pairs at once using a fully connected prediction head, based on the global pose features (vectors) extracted in S111. The initial safety distance value is the first-round prediction result for each self-collision pair before grouping and refinement correction. Its purpose is to provide a good initial estimate for subsequent grouping correction, allowing each grouping and refinement network to perform local fine-tuning based on a relatively accurate initial value. The fully connected prediction head used in coarse-grained safety prediction is a fully connected layer with an output dimension equal to the total number of preset self-collision pairs, for example, 10 dimensions, corresponding to 10 monitored self-collision pairs. Its parameter count is much smaller than that of the encoding network.

[0078] In one embodiment, the global pose features obtained in S111 are input into the fully connected prediction head for coarse-grained safety prediction. Based on the input global pose features, the fully connected prediction head outputs preliminary safety distance estimates for all preset self-collision pairs at once, thus obtaining the initial safety distance values ​​for all preset self-collision pairs. For example, the aforementioned 128-dimensional global pose feature vector is directly input into the fully connected layer (i.e., the fully connected prediction head), and through a single matrix multiplication operation, the initial safety distance values ​​for 10 self-collision pairs are output simultaneously. For example, the initial safety distance between the head and the left arm is approximately 6 cm, the initial safety distance between the left arm and the side of the torso is approximately 5.5 cm, the initial safety distance between the left thigh and the right arm is approximately 16 cm, the initial safety distance between the right thigh and the left arm is approximately 18 cm, the initial safety distance between the head and the right arm is approximately 28 cm, and the initial safety distance between the torso and the left thigh is approximately 33 cm, etc.

[0079] As mentioned above, since coarse-grained safety prediction outputs the initial safety distance values ​​of all preset self-collision pairs through only one fully connected operation, it significantly improves computational efficiency. Furthermore, since it shares the global features extracted by the encoding network, it can still capture the attitude correlation between different collision pairs even with a parameter size much smaller than the independent modeling method for each self-collision pair, providing a unified and effective initial estimate for subsequent grouping refinement.

[0080] S113. Based on the interaction type of different body parts, the initial safe distance value of the self-collision pair of the corresponding interaction type is grouped and corrected to obtain the corresponding safe distance value.

[0081] After obtaining the initial safety distance value in S112, the initial prediction value still has room for improvement in accuracy because the coarse-grained safety prediction (i.e., the fully connected prediction head) does not differentiate between different interaction types. Although the 6 cm obtained by the coarse-grained safety prediction roughly reflects the fact that the collision pair is at a relatively close distance, there is a certain deviation in the value. Therefore, in order to reduce the risk of self-collision, after obtaining the initial safety distance value, the initial safety distance values ​​of self-collision pairs of different interaction types are grouped and corrected according to the interaction types of different body parts to obtain the corresponding safety distance values.

[0082] Interaction type refers to the method of classifying all monitored self-collision pairs into several categories based on the kinematic and geometric relationship characteristics of the two body parts involved. Self-collision pairs with different interaction types differ fundamentally in their geometric relative motion patterns, collision mechanisms, and sensitivity to joint influence, thus making them suitable for differentiated processing by a dedicated network branch. Body part interaction types include leg-to-leg interactions (e.g., left thigh to right thigh and left calf to right calf), leg-to-arm interactions (e.g., left thigh to right arm and right thigh to left arm), head-to-arm interactions (e.g., head to left arm and head to right arm), trunk-to-arm interactions (e.g., trunk to left arm and trunk to right arm), and arm-to-arm interactions (e.g., between left and right upper arms, between left and right forearms, left arm to the side of the trunk, and right arm to the side of the trunk). Group correction involves concatenating the initial safe distance value corresponding to each interaction type group with the global pose features (vectors) of that interaction type group, and then feeding the concatenation into a dedicated group refinement network for that interaction type group. The group refinement network then outputs the corrected final safe distance values ​​for each collision pair within that interaction type group.

[0083] In one embodiment, after obtaining the initial safety distance value in S112, a preset interaction type for the self-collision pair is determined, such as a head-arm interaction type group. Based on the determined interaction type, the initial safety distance value of the corresponding self-collision pair is concatenated with the global pose feature (vector) of the interaction type group, and then fed into a dedicated grouping refinement network for that interaction type group. The grouping refinement network outputs the corrected final safety distance value for each collision pair within the interaction type group. For example, taking the head-arm interaction type group as an example, the head-arm interaction type group includes self-collision pairs such as head and left arm, and head and right arm. The grouping refinement network receives the input after concatenating the initial safety distance value (e.g., 6 cm for head and left arm) with a 128-dimensional global pose feature vector for the head-arm interaction type group. It performs a nonlinear transformation through a dedicated fully connected layer sequence and outputs the corrected safety distance value. For example, the head-left arm is corrected from the initial 6 cm to 5 cm, and the left arm-to-thigh side is corrected from the initial 5.5 cm to 4 cm, thereby significantly improving prediction accuracy.

[0084] As mentioned above, different interaction types have distinctly different physical characteristics and joint sensitivity patterns. The grouped refinement network can perform specialized learning and parameter tuning for the unique interaction patterns of each group. For example, the branch responsible for head-arm interaction will focus on learning the influence patterns of the shoulder and neck joints on the distance between the head and arms, while the branch responsible for leg-leg interaction will mainly focus on the influence of the hip and knee joints. This significantly improves the prediction accuracy of samples near the boundary without significantly increasing the total number of parameters, providing accurate and reliable safe distance values ​​for subsequent correction processing.

[0085] The mechanism described above, which groups and corrects collision pairs based on the interaction types of different body parts, allows for targeted optimization of self-collision pairs with different interaction types by their respective dedicated network branches. This differentiated modeling ensures the prediction accuracy for each collision pair. Particularly for critical samples near the safety boundary (within a 10cm activation threshold), grouping and correction effectively eliminates the initial bias of coarse-grained predictions, keeping the error between the safety distance value and the actual geometric margin at the sub-centimeter level, providing an accurate numerical basis for subsequent correction processing. More importantly, since the safety distance value essentially serves as an input parameter for the subsequent construction function constraints, its accuracy directly determines whether the constraints can trigger correction at the correct joint and in the correct direction. If the prediction error of the safety distance value is too large, the self-collision pair will not be activated and enter the correction process, resulting in missed detections and actual collisions. Conversely, the grouping and refinement network, through the synergistic effect of capturing global patterns through shared encoding and eliminating local biases through grouping and refinement, significantly compresses the prediction error of critical collision pairs near the safety boundary, effectively reducing missed detections due to inaccurate predictions, and thus significantly reducing the risk of self-collision in the subsequent robot motion control process.

[0086] Figure 6 This is a flowchart of another robot motion control method provided in the embodiments of this application, referred to... Figure 6 During the training of the safety value prediction model, the robot motion control method specifically includes: S21. Perform offline collision detection based on the preset high-fidelity geometric model, and calculate the real safety margin of multiple body parts under different joint configurations.

[0087] Before obtaining the current robot state and the initial joint motion corresponding to the reference motion in S11, i.e., before executing robot motion control, offline collision detection is performed based on a preset high-fidelity geometric model to calculate the true safety margin of multiple body parts under different joint configurations. The high-fidelity geometric model refers to the digital geometric data obtained by finely modeling the true three-dimensional shape of each robot body part (such as head, torso, left upper arm, left lower arm, left hand, right upper arm, right lower arm, right hand, left thigh, left calf, left foot, right thigh, right calf, and right foot) using triangular meshes or convex hulls. Its representational accuracy is far higher than traditional simplified geometric approximations such as capsules, spheres, or bounding boxes. The true safety margin is the signed minimum Euclidean distance obtained by performing a precise distance query on the geometric models of two body parts through the offline collision detection program. A positive true safety margin indicates a physical gap between the two parts, i.e., a safe state; a true safety margin of 0 indicates just contact, i.e., a critical state; and a negative true safety margin indicates that the geometry of the two parts has penetrated each other, i.e., a collision state.

[0088] For example, during offline collision detection, a large number of reference motion sequences are first collected from sources such as human motion databases, text-generated motion, video-reconstructed motion, or motion capture retargeting. These sequences are then converted into joint trajectories for the target humanoid robot, resulting in a large number of joint configuration samples covering various typical and atypical postures within the robot's normal working space. Subsequently, for each joint configuration sample, a flexible collision detection library is invoked to perform precise distance queries on all monitored body parts, recording the minimum distance between each pair of parts in that posture as the true safety margin value.

[0089] In one embodiment, to improve the prediction accuracy of the model near the safety boundary, joint configuration samples with smaller absolute values ​​of safety margin (i.e., samples close to the collision boundary) are preferentially retained during sampling. The samples near the boundary can be moderately augmented, for example, by superimposing random noise in the range of 0.5° to 1° on the joint angle to generate neighboring samples that are still near the boundary after small perturbations in posture, so that the sample density of training data in the high-risk area is significantly higher than that in the safe area.

[0090] As described above, by centrally calling high-fidelity geometric collision detection in the offline stage, all the expensive mesh or convex hull distance calculations are completed before online execution. The resulting accurate safety margin labels serve as supervision signals for subsequent model training, enabling the neural network to learn a safety assessment capability that is highly consistent with the real geometry. In the real-time control stage, no high-fidelity geometric queries are required, thereby significantly improving the timeliness of motion control during subsequent online real-time control.

[0091] S22. Using each joint configuration as input feature and the corresponding real safety margin as safety label, construct the training dataset and calibration dataset.

[0092] After obtaining the true safety margins of multiple body component pairs under different joint configurations in S21, training and calibration datasets are constructed using each joint configuration as input features and the corresponding true safety margins as safety labels. The input features refer to the raw input data received by the safety value prediction model, which consists of a joint configuration vector (i.e., a vector composed of joint angle values ​​arranged in numerical order). The dimension of this vector is equal to the total number of degrees of freedom of the robot's joints (e.g., 23 dimensions in this embodiment), and each component is the angle value of the corresponding joint. The safety label refers to the true safety margin value of each monitored self-collision pair under the corresponding joint configuration, obtained through high-fidelity geometric collision detection in S21. The safety label is a continuous value; in this embodiment, the label dimension of each sample is 10 dimensions, corresponding to 10 self-collision pairs. Because the safety label uses continuous values ​​instead of traditional binary collision classification labels, the model, during training, must not only learn the judgment of safety but also learn the precise numerical mapping of how far away from the collision boundary.

[0093] For example, when constructing the dataset, all joint configuration samples collected in S21 and their corresponding true safety margins are first used as safety labels. The safety labels are randomly divided into training and calibration datasets according to a predetermined ratio (e.g., 80% for training and 20% for calibration). The two sets of data come from the same distribution but the samples do not overlap to ensure the statistical independence of the calibration results. For example, if 100,000 valid joint configuration samples were collected in S21, the training dataset contains 80,000 samples and the calibration dataset contains 20,000 samples.

[0094] As described above, random partitioning ensures the identical distribution of the training and calibration sets, enabling the model bias obtained from the calibration set to reliably reflect the model's performance in a real deployment environment, thus providing unbiased statistical basis for subsequent security calibration.

[0095] S23. Train the preset safety value prediction model based on the training dataset, and perform safety calibration on the trained safety value prediction model based on the calibration dataset to obtain the target safety value prediction model.

[0096] After constructing the training and calibration datasets in S22, the pre-defined safety value prediction model is trained using the training dataset, and then the trained safety value prediction model is calibrated using the calibration dataset to obtain the target safety value prediction model. Training the safety value prediction model involves using the inputs (label pairs) from the training dataset to iteratively optimize the model parameters, enabling the model to learn the mapping relationship from joint configurations to the continuous safety distance values ​​of their respective collision pairs. After training, the model output is calibrated using the calibration dataset to eliminate any remaining optimistic bias in the predictions, resulting in the final target safety value prediction model.

[0097] For example, during training, this embodiment uses an asymmetric loss function to train the safety value prediction model. The asymmetric loss function refers to a loss function design that applies different penalty weights to different types of prediction errors. For instance, the asymmetric loss function applies a higher first penalty weight to samples that are actually unsafe but predicted as safe than samples that are actually safe but predicted as unsafe. Samples that are actually unsafe but predicted as safe are those whose predicted safe distance value is greater than the actual safety margin label. This is equivalent to the model underestimating the collision risk, constituting a dangerous misjudgment, and therefore requires a higher first penalty weight. Samples that are actually safe but predicted as unsafe are those whose predicted safe distance value is less than the actual safety margin label. This is equivalent to the model overestimating the collision risk; although not entirely accurate, they are on the safe side, and therefore require a lower second penalty weight.

[0098] In one embodiment, the first penalty weight is significantly greater than the second penalty weight. This asymmetric loss function can be understood as the model being deliberately penalized during training to output more conservative safety distance values. Even if this means the model might give a slightly smaller safety distance value than the true value in some scenarios with sufficient safety margins (overly conservative), it is still far better than the model giving an overly optimistic safety distance value in truly dangerous scenarios (missed detection). For example, if the true safety margin between the head and left arm in a certain joint configuration sample is 5 cm, close to the collision boundary; but the model predicts 8 cm, the predicted value is greater than the true value, indicating the model is overly optimistic and considers the safety margin larger than it actually is. This is a dangerous misjudgment and should be penalized with a high weight. If the model predicts 3 cm, the predicted value is less than the true value, indicating the model conservatively considers the safety margin smaller than it actually is. Although this is not precise enough, it will prompt subsequent correction processing to intervene earlier, preventing missed detections, and should be penalized with a low weight.

[0099] It should be noted that the ratio of the first penalty weight to the second penalty weight can be set according to the actual situation. For example, in this embodiment, the ratio of the first penalty weight to the second penalty weight is set to a range of 5:1 to 10:1. The larger the ratio, the more conservative the prediction of the trained model.

[0100] S24. Predict the safety value of the current robot state using the target safety value prediction model.

[0101] After obtaining the target safety value prediction model in S23, the robot motion control in S11-S15 is executed. During S11, the target safety value prediction model obtained in S23 is used to predict the safety value of the current robot state. In this embodiment, the target safety value prediction model is the final deployment model obtained after the complete offline preparation process of S21-S23. This model takes the joint configuration vector as input and, through a single forward propagation calculation, synchronously outputs the target safety distance values ​​(including calibration tightening) of all monitored self-collision pairs. For example, the current joint configuration vector (23-dimensional in this embodiment) collected by the sensors during the online control cycle is directly input into the target safety value prediction model. This model, through forward computation of several layers of fully connected networks, outputs the target safety distance values ​​of all preset self-collision pairs within microseconds, i.e., the safety distance values ​​in S11. These target safety distance values ​​(i.e., the safety distance values ​​in S11) are then used in the correction processing flow of S12-S14 to activate the selection of collision pairs and the construction of function constraints.

[0102] As mentioned above, since the accuracy of high-fidelity geometric collision information has been distilled into the lightweight neural network (i.e., the target safety value prediction model) through the training and calibration process during the offline preparation stage, only a single forward propagation of the neural network is required during the online inference stage to obtain a safety distance value with near-real geometric accuracy, thus achieving a balance between high-fidelity accuracy and real-time computing efficiency.

[0103] Figure 7 This is a flowchart of another robot motion control method provided in the embodiments of this application, referred to... Figure 7 During the calibration of the safety value prediction model, the robot motion control method specifically includes: S231. Input the calibration dataset into the trained safety value prediction model for data processing to obtain the predicted safety distance value.

[0104] During model calibration in S23, the calibration dataset is first input into the trained safety value prediction model for data processing to obtain the predicted safety distance values. The trained safety value prediction model refers to a neural network model whose parameters have been optimized on the training dataset using the asymmetric loss function in S23. At this point, all weights and bias parameters of the model are fixed, but it has not yet undergone one-sided conservative calibration; its output is the original predicted safety distance value. The calibration dataset is an independent subset (e.g., 20,000 joint configuration samples) randomly divided proportionally from all collected samples in S22. The samples in this subset were not involved in model training, thus objectively reflecting the model's true predictive performance when facing unseen joint configurations. Data processing refers to inputting each joint configuration vector from the calibration dataset into the model to perform a single forward propagation calculation, obtaining the original predicted safety distance values ​​for all self-collision pairs corresponding to that sample. For example, 20,000 calibration samples are input one by one into the trained safety value prediction model. The input of each sample is a 23-dimensional joint configuration vector, and the output is a 10-dimensional predicted safety distance value vector. All 20,000 forward propagations can be completed in batches in an offline computing environment, with a total time of less than a second.

[0105] As described above, by performing batch inference on independent calibration data that the model has never seen before, a comprehensive and unbiased statistical profile of the model's prediction performance for each collision pair under each joint configuration was obtained, providing a reliable data foundation for the accurate statistics of optimistic bias and the reasonable setting of conservative buffer values.

[0106] S232. Statistically predict the optimistic bias of the safety distance value relative to the corresponding safety label in the calibration dataset, where the safety label is the true safety margin of the corresponding sample.

[0107] After obtaining the predicted safety distance value in S231, the optimistic bias of the predicted safety distance value relative to the corresponding safety label in the calibration dataset is calculated. The safety label represents the true safety margin of the corresponding sample. The optimistic bias refers to the amount by which the model's predicted safety distance value is greater than the corresponding true safety margin label. In other words, the model's estimate of the safety margin is more optimistic than the true value obtained from high-fidelity geometric collision detection, meaning the predicted value is too high. This optimistic bias directly corresponds to the risk of missed detections during the deployment phase; that is, the model believes there is still a certain safety margin, while the actual situation may have already approached or entered a collision state. The safety label is the true safety margin value (continuous signed value) obtained through high-fidelity geometric collision detection in S21, serving as a benchmark for measuring the accuracy of the model's prediction.

[0108] For example, when calculating the optimistic bias, firstly, for each joint configuration sample and each monitored self-collision pair in the calibration dataset, the predicted safety distance value obtained in S231 is subtracted from the corresponding safety label value to obtain a difference, i.e., the bias value. If the bias value is positive, it indicates that the model has made an optimistic prediction on that self-collision pair of the sample. Secondly, according to the dimension of the self-collision pair, the bias values ​​of all 20,000 samples in the calibration dataset on their respective collision pairs are grouped by collision pairs to form a set of bias values ​​of a corresponding number of groups (e.g., 10 groups). Each group contains 20,000 bias values, each corresponding to a specific self-collision pair. Finally, for each set of bias values, the subset with positive bias values ​​is extracted for statistical analysis, and the predetermined percentile of the subset (e.g., the 95th percentile or the maximum value) is calculated as the optimistic bias statistic for that self-collision pair.

[0109] In one embodiment, taking a head-arm interaction type self-collision pair as an example, for the head and left arm self-collision pair, out of 20,000 calibration samples, 1,500 samples had predicted safety distance values ​​greater than the actual safety margin label (i.e., optimistic predictions occurred). These optimistic deviation values ​​ranged from 0.01 cm to 0.8 cm, and the 95th percentile of these values ​​was taken as 0.55 cm as the optimistic deviation statistic for the collision pair. For the left arm and side of the torso self-collision pair, the 95th percentile of the optimistic deviation was 0.4 cm.

[0110] As described above, by grouping and statistically analyzing the optimistic bias by collision pair, each self-collision pair can obtain a bias metric customized based on its own predictive characteristics, rather than using a globally uniform bias value indiscriminately. Different collision pairs have different prediction bias patterns due to the different geometry and range of motion of the body parts involved. Grouping and statistical analysis accurately captures this difference.

[0111] S233. Set a conservative buffer value for each preset self-collision pair based on the optimistic bias.

[0112] After obtaining the optimistic bias in S232, a conservative buffer value is set for each preset self-collision pair based on the optimistic bias. The conservative buffer value is a safety offset set individually for each collision pair based on the optimistic bias obtained in S232. This offset is directly subtracted from the model output during deployment, making the final output value systematically conservative, i.e., tending to output a safe distance value smaller than the original prediction value. The direct basis for setting the conservative buffer value is the optimistic bias statistics obtained for each collision pair in S232. The conservative buffer value can be directly taken as the optimistic bias statistics themselves (i.e., the 95th percentile), or it can be multiplied by a safety factor greater than 1 (e.g., 1.1 to 1.2 times) to leave an additional safety margin.

[0113] For example, for the head and left arm self-collision pair, the optimistic deviation of the predicted safe distance value of this self-collision pair relative to the corresponding safety label in the calibration dataset is calculated, and the 95th percentile of its optimistic deviation is found to be 0.5 cm. The conservative buffer value is set to 0.6 cm, which is 1.2 times the optimistic deviation statistic. For the left arm and side of the torso self-collision pair, the optimistic deviation of the predicted safe distance value of this self-collision pair relative to the corresponding safety label in the calibration dataset is calculated, and the 95th percentile of its optimistic deviation is found to be 0.4 cm. The conservative buffer value is set to 0.5 cm, which is also 1.2 times the safety factor. For collision pairs such as the left thigh and right arm, which typically have a large safety margin and an optimistic deviation statistic close to 0, the conservative buffer value can be set to 0, i.e., no tightening is required. The conservative buffer value for each self-collision pair is set independently and remains fixed after calibration, deployed along with the model.

[0114] The above-mentioned approach achieves a refined safety and conservatism strategy by setting conservative buffer values ​​for each collision pair based on statistical characteristics of independent calibration data. For high-risk collision pairs with large model prediction deviations (such as collision pairs that are often close in the head-arm interaction group and arm-torso interaction group), a larger buffer value is applied to fully eliminate the risk of missed detection. For low-risk collision pairs with small prediction deviations (such as collision pairs that are usually well-spaced in the leg-leg interaction group), a smaller or zero buffer value is applied to avoid meaningless over-conservatism, so that conservatism and accuracy are optimally balanced at the level of each collision pair.

[0115] S234. Determine the tightened target safety distance value based on the predicted safety distance value and the conservative buffer value, and update the safety value prediction model based on the target safety distance value to obtain the target safety value prediction model. The target safety value prediction model takes the joint configuration as input and outputs the corresponding target safety distance value.

[0116] After setting conservative buffer values ​​for each preset self-collision pair in S233, the tightened target safety distance value is determined based on the predicted safety distance value and the conservative buffer value. The safety value prediction model is then updated based on the target safety distance value to obtain the target safety value prediction model. The tightened target safety distance value refers to the final output value obtained by subtracting the conservative buffer value set for the self-collision pair in S233 from the model's original predicted safety distance value. This value will be directly provided as the safety distance value for subsequent correction processes during the deployment phase. The target safety value prediction model refers to the final deployment model that incorporates the conservative buffer mechanism after the model update operation. Externally, this model is represented as an end-to-end network that receives joint configuration vectors and outputs target safety distance value vectors.

[0117] For example, when updating the safety value prediction model, firstly, after the output layer of the original trained safety value prediction model, an element-wise fixed offset subtraction layer is connected in series. The parameters of this layer are the conservative buffer value vectors set for each collision pair in S233 above. During forward propagation, the corresponding conservative buffer value is automatically subtracted from each component of the original output of the model, and the tightened target safety distance value is output. This update method only involves adding a subtraction operation at the end of the model, without changing the weights and bias parameters inside the original network. Therefore, the differentiability of the original network is completely preserved, and the backpropagation gradient calculation in the aforementioned embodiment can still be used directly because the derivative of the constant term is 0, and the gradient value is not affected by the final constant subtraction. For example, taking a frame in the online control cycle as an example, for the current joint configuration vector (left shoulder pitch 80° and left hip pitch 25°, etc.), the model's original output predicted safe distance between the head and the left arm is 5.5 cm. After a conservative buffer of 0.6 cm, the actual output target safe distance is 4.9 cm. The original prediction for the left arm and the side of the torso is 4.5 cm, which is reduced to 4.0 cm after a conservative buffer of 0.5 cm. After the conservative buffer, the target safe distance values ​​for both collision pairs are smaller than the original predicted values ​​(i.e., more conservative), thus triggering activation earlier and intervening in avoidance more promptly in subsequent correction processing, effectively reducing the risk of missed detection.

[0118] The above only adds an output layer constant offset operation without increasing any online computation or trainable parameters, achieving a safe and conservative transformation of the model at extremely low implementation cost. Furthermore, the end subtraction does not affect the differentiable structure inside the network, allowing the gradient calculation mechanism based on automatic differentiation in the aforementioned embodiments to be seamlessly integrated.

[0119] As mentioned above, although the model training incorporates a certain conservative tendency at the parameter optimization level through the asymmetric loss function, the limited training data and the randomness of the optimization process mean that the trained model may still retain optimistic biases on some self-collision pairs. For example, in some extreme joint configuration regions that are sparsely covered in the training set (such as a compound posture in which the arm is raised and twisted at the same time), the safe distance value predicted by the model may be systematically large due to insufficient training samples, forming a hidden risk of missed detection. Therefore, this embodiment provides a one-sided safety calibration mechanism to statistically quantify the optimistic bias on a collision-pair basis on the calibration dataset (unseen samples independent of the training set) and explicitly remove these residual optimistic biases from the model output in the form of conservative buffer values. This achieves systematic detection and filling of the risk of missed detections during the training stage, which greatly reduces the probability of missed detections when the target safety value prediction model is used for subsequent safety value prediction.

[0120] Furthermore, by setting conservative buffer values ​​independently for each collision pair, collision pairs with different risk levels receive differentiated levels of safety protection. For example, for high-risk collision pairs with complex geometry, large range of motion, and high collision incidence in historical data (such as head and arm, arm and torso side), the model's prediction uncertainty for these collision pairs is inherently large, and the statistically obtained optimistic bias is also correspondingly large. Therefore, a larger conservative buffer value is obtained, forming a stronger safety protection layer. On the other hand, for low-risk collision pairs with simple geometry and low collision incidence, their conservative buffer value is usually close to 0, which will not introduce unnecessary over-conservatism. This ensures precise intervention in the correction process rather than blindly tightening it across the board, allowing limited safety protection resources to be concentrated and allocated to where they are truly needed.

[0121] Figure 8 This is a flowchart of another robot motion control method provided in the embodiments of this application, referred to... Figure 8 When determining the deployment parameters of the function constraints, the robot motion control method specifically includes: S31. Generate multiple sets of candidate parameters for configuring function constraints and their solution process.

[0122] Before obtaining the current robot state and the initial joint motion corresponding to the reference motion in S11, i.e., before executing robot motion control, multiple sets of candidate parameters are generated for configuring function constraints and their solution process. Candidate parameters refer to multiple combinations of parameters to be evaluated generated within a preset parameter search space through sampling or optimization strategies. Each set of candidate parameters contains candidate values ​​for various parameters used to configure the construction and optimization solution process of function constraints in online correction processing. These parameters specifically include two main categories: constraint parameters and solution parameters. Constraint parameters are used to configure the construction process of function constraints, such as preset activation thresholds (determining at what value self-collision pairs are activated and enter the correction process below the safety distance), decay coefficients of function constraints (determining the allowable decay rate of the safety distance value without correction motion), conservative tightening margins (applying additional conservative offsets to the safety distance value), and correction strength (adjusting the tightness of the constraints). Solution parameters are used to configure the solution process of the quadratic programming problem, such as relaxation penalties (determining the penalty intensity when constraints are violated) and motion correction weights (determining the allocation of correction costs for each joint).

[0123] For example, when generating candidate parameters, uniform stratified sampling can be performed within a preset parameter search space to maximize the coverage uniformity of each group of candidate parameters in the search space; alternatively, optimization algorithms such as covariance matrix adaptive evolution strategies can be used to adaptively generate candidate parameters in the search space, biased towards promising regions. For instance, for six parameters to be tuned: activation threshold, decay coefficient, conservative tightening margin, correction strength, relaxation penalty, and action correction weight, within their respective preset value ranges, such as the activation threshold ranging from 5 to 20 cm, the decay coefficient from 0.3 to 0.8, the conservative tightening margin from 0 to 2 cm, the correction strength from 0.5 to 2.0, the relaxation penalty from 10 to 1000, and the action correction weight from 0.1 to 1.0, 200 sets of candidate parameter combinations can be generated through sampling.

[0124] As described above, a representative set of parameter combinations is generated in the preset search space through a systematic sampling strategy, covering a complete parameter spectrum from conservative (high activation threshold and low decay coefficient) to radical (low activation threshold and high decay coefficient). This provides a sufficient and diverse source of candidates for subsequent screening and evaluation, avoids the blindness and one-sidedness of manual parameter tuning, and thus significantly improves the objectivity of the deployment parameters of function constraints.

[0125] S32. Based on the preset constraint proxy model, perform safety screening on each group of candidate parameters to obtain the candidate parameter groups that pass the screening.

[0126] After generating multiple sets of candidate parameters in step S31, a safety screening is performed on each set of candidate parameters according to a pre-defined constraint surrogate model to obtain the candidate parameter sets that pass the screening. The constraint surrogate model is a lightweight approximate evaluation model that can quickly estimate whether a given set of candidate parameters is likely to meet the pre-defined safety and performance conditions in a simulation environment at a computational cost far lower than that of a full simulation evaluation. This constraint surrogate model can be constructed based on a small number (e.g., dozens) of sample parameter sets that have already obtained real evaluation results through full simulation evaluation. For example, using these sample parameter sets and their corresponding real evaluation results, a simple classifier or regressor can be trained to predict whether a parameter set is likely to pass the safety and performance thresholds in a full simulation based on its values. Safety screening refers to using the constraint surrogate model to quickly predict all candidate parameter sets generated in step S31, directly excluding parameter sets that the surrogate model predicts will not meet the conditions, and only retaining the parameter sets predicted to be likely to pass in the next stage of full simulation evaluation.

[0127] For example, firstly, 30 sets of candidate parameters are randomly selected from 200 sets. Each set undergoes a complete simulation evaluation, such as running a full derivation of multiple reference action sequences in a simulation environment, recording real evaluation metrics like self-collision rate and task success rate, resulting in 30 labeled samples with known real evaluation results. Then, a constraint surrogate model is trained using these 30 labeled samples. This model receives one set of parameter values ​​as input and outputs a prediction of whether the parameter set can simultaneously satisfy both the conditions of a self-collision rate below 0.1% and a task success rate above 95%. Finally, the trained constraint surrogate model is used to quickly predict the remaining 170 sets of candidate parameters one by one. Approximately 150 sets are predicted as failing to meet the conditions and are directly excluded, while approximately 20 sets are predicted as potentially passing and proceeding to the next stage. For the excluded parameter sets, no further evaluation using expensive full simulation resources is required.

[0128] As described above, through the security screening of the proxy model, about 85% of obviously infeasible candidate parameter groups are quickly eliminated with extremely low computational cost. That is, each group only requires one lightweight model inference, and only about 15% of the promising candidate parameter groups are subjected to subsequent complete simulation evaluation. This reduces the total computational resource consumption of parameter tuning by an order of magnitude and significantly improves the efficiency of parameter tuning.

[0129] S33. Perform simulation evaluation on the selected candidate parameter groups, and determine the candidate parameter groups that meet the preset safety conditions and preset performance conditions as deployment parameters. The deployment parameters are used to construct and solve the function constraints in the configuration correction process.

[0130] After obtaining the selected candidate parameter groups in S32, simulation evaluation is performed on these groups. The candidate parameter groups that meet the preset safety and performance conditions are then determined as the deployment parameters. Simulation evaluation refers to conducting comprehensive multi-scenario and multi-sequence simulation tests on each selected candidate parameter group in a complete simulation environment that includes robot kinematics and dynamics models, a self-collision detection module, reference action sequences, and random perturbation injection. This obtains the true values ​​of various performance indicators that the parameters might exhibit under real deployment conditions. Preset safety conditions refer to the threshold requirements that evaluation indicators directly related to self-collision safety must meet. For example, the self-collision rate (the proportion of control cycles in which self-collisions occur during simulation) must be less than 0.1%. Preset performance conditions refer to the threshold requirements that evaluation indicators related to the quality of motion task completion must meet. For example, the task success rate (i.e., the proportion of simulations in which the robot successfully completes the specified motion task out of the total number of simulations) must be higher than 95%, the tracking error (i.e., the average deviation between the robot's actual joint trajectory and the reference motion) must be lower than 0.05 radians, and the motion intervention amplitude (i.e., the average correction amount between the target joint motion and the initial joint motion after correction processing) must be lower than 0.1 radians. Deployment parameters refer to the final values ​​of various parameters that are ultimately selected and deployed to the online control system and used to actually configure the correction processing flow. Once determined, the deployment parameters remain fixed during the online operation phase.

[0131] For example, the 20 candidate parameters selected through S32 are subjected to complete simulation evaluation in a simulation environment. For instance, each parameter group undergoes 10 simulations with random perturbations on 10 different reference action sequences (covering various typical full-body movements such as walking, dancing, turning, waving, and squatting), for a total of 100 simulations per parameter group. The actual values ​​of the four evaluation indicators—self-collision rate, task success rate, tracking error, and action intervention amplitude—are recorded for each parameter group. For each candidate parameter group, it is checked whether all four evaluation indicators meet the preset threshold conditions, and one or more parameter groups that meet all the criteria are selected. If multiple parameter groups meet the conditions, the optimal group can be further selected as the final deployment parameter based on a comprehensive score (such as a weighted sum of the indicators).

[0132] For example, the final deployment parameters are set as follows: activation threshold = 10 cm, attenuation coefficient = 0.5, conservative tightening margin = 0.5 cm, correction strength = 1.0, relaxation penalty = 100, and in the motion correction weights, 0.1 is taken for safety-sensitive joints (such as shoulder and trunk joints) and 1.0 is taken for core motion joints (such as leg joints). This set of deployment parameters is then deployed to the online control system along with the target safety value prediction model to configure the entire process of activation collision pair screening (such as preset activation threshold of 10 cm), function constraint construction (such as attenuation coefficient of 0.5 and conservative tightening margin of 0.5 cm), and quadratic programming problem solving (such as relaxation penalty of 100 and correction weights as allocated as described above) in the aforementioned embodiments.

[0133] As described above, by concentrating simulation resources on a small number of promising candidate parameter groups selected by the proxy model, it is ensured that each group of parameters entering the complete simulation evaluation has undergone preliminary feasibility testing. This avoids wasting a large amount of simulation budget on obviously infeasible parameter regions, and improves the overall efficiency of parameter tuning by about an order of magnitude compared to traditional full grid search or full random search. At the same time, the simulation evaluation design with multiple scenarios, multiple sequences, and random perturbations ensures that the selected deployment parameters have sufficient robustness and generalization ability, and can stably balance self-collision safety and motion tracking performance after being deployed to the robot's actual operating environment.

[0134] In one embodiment, after obtaining the target safety value prediction model and determining the deployment parameters, actual deployment is performed. The components deployed to the robot control system include the following four parts: The first part is the target safety value prediction model, which is the final safety value prediction network obtained after the training process and one-sided safety calibration in the aforementioned embodiment. This network takes the joint configuration vector as input and outputs a 10-dimensional target safety distance value vector after conservative buffering. Its network parameters remain fixed after deployment. The second part is the one-sided calibration buffer value vector, which is the conservative buffer value independently set for each collision pair in the aforementioned embodiment. This vector is stored in the control system as a fixed constant and is added and subtracted at the output of the model after forward propagation, rather than being embedded in the network as a trainable parameter. Therefore, it can be flexibly adjusted without changing the network structure. The third part is the constraint solver, which is a lightweight solver capable of solving quadratic programming problems with linear inequality constraints online. It integrates the activation collision pair screening logic, gradient calculation logic based on backpropagation, and optimization solution logic based on function constraints and joint physical limit constraints in the aforementioned embodiment. The fourth part is the deployment parameter group, which consists of various constraint parameters and solution parameters determined during the deployment parameter determination process in the aforementioned embodiments. These include, for example, an activation threshold of 10 cm, a decay coefficient of 0.5, a conservative tightening margin of 0.5 cm, a relaxation penalty of 100, and the weight allocation for motion correction of each joint. These parameters are written into the control system's parameter file as configuration constants and are read and used by the constraint solver during runtime. All four components are deployed on the robot's onboard computing unit (embedded processor), requiring no cloud or external computing resources; all calculations are completed locally in real time.

[0135] In one embodiment, after deployment, the robot cyclically executes the following six steps within each control cycle, forming a closed-loop safety control link from perception to execution. The first step includes receiving the current robot state and reference motion. For example, the current angle values ​​of each joint are read in real time through the robot's joint encoders and inertial measurement units to form the current joint configuration vector, while the reference motion (i.e., the desired motion trajectory) for the next moment is obtained from the upper-level motion generation module.

[0136] The second step involves outputting initial joint motions from a reinforcement learning tracking strategy. For example, the pre-trained reinforcement learning tracking strategy takes the current joint configuration vector and a reference motion as input, and outputs initial joint motion vectors, such as a 23-dimensional vector composed of the target angle values ​​of each joint, through forward inference of the policy network. The reinforcement learning tracking strategy can be deployed on the same computing unit as the safety control loop, or it can be deployed on a separate motion planning unit and the results are transmitted via a data bus. The functionality and interface of the safety control loop remain consistent in both deployment methods.

[0137] The third step involves predicting safety values ​​using a target safety value prediction model. For example, the current joint configuration vector is input into the deployed target safety value prediction model, and the target safety distance values ​​for all monitored self-collision pairs are obtained by subtracting the output of a single neural network forward propagation and a one-sided calibration buffer value.

[0138] The fourth step includes filtering active collision pairs. For example, the target safe distance value of each collision pair is compared with the activation threshold (10 cm) in the deployment parameters one by one. Collision pairs with a safe distance value less than 10 cm are marked as active collision pairs. If the safe distance values ​​of all collision pairs are greater than or equal to the activation threshold, the fifth step is skipped and the initial joint motion is directly output as the target joint motion.

[0139] The fifth step involves calculating the joint space gradient and solving for the target joint motion. For example, for each active collision pair, the joint space gradient vector of the collision pair is calculated using backpropagation of the target safety value prediction model. Then, function constraints are constructed based on the attenuation coefficient (e.g., 0.5), conservative tightening margin (e.g., 0.5 cm), and safety threshold (e.g., 6 cm) in the deployment parameters. Using the relaxation penalty and motion correction weights in the deployment parameters as the solution configuration, the constraint solver is called to obtain the optimal correction amount. The initial joint motion is then added to the optimal correction amount to obtain the target joint motion.

[0140] The sixth step involves sending the target joint motion to the underlying robot control interface. For example, the target joint motion vector is encapsulated into a joint command message according to the robot control system's communication protocol, and sent to the servo drivers of each joint at a frequency of 500 Hz via a real-time data bus (such as a controller area network bus or Ethernet bus). The servo drivers then perform the underlying joint position or torque closed-loop control, driving each joint of the robot to move to a safe target angle.

[0141] The above six steps are executed sequentially within each control cycle, with a total cycle time of approximately 0.5 to 1 millisecond (depending on the number of activated collision pairs and the number of iterations of the constraint solver), fully adapting to real-time control frequency requirements of 500 Hz to 1000 Hz.

[0142] In one embodiment, the deployment scheme provided in this embodiment uses triangular mesh distance calculation or convex hull penetration detection only in the offline training and offline parameter evaluation stages. In the online stage, it does not rely on any high-fidelity geometric collision queries. In the real-time control stage, it only uses lightweight neural network forward propagation and small-scale quadratic programming solutions, resulting in a constant and predictable computational load. Furthermore, all parameters of the target safety value prediction model are determined and fixed in the offline stage. The one-sided calibration buffer value and deployment parameter set are also stored in constant form. There is no parameter update step during runtime (backpropagation is only used for gradient calculation and not for updating weights). Therefore, no neural network training or parameter updates are required in the online stage. In addition, the safety control loop is transparent to the original reinforcement learning tracking strategy. The tracking strategy itself does not require any modification. Its output initial joint motion serves as the input to the safety control loop. The target joint motion obtained after safety filtering replaces the original motion and is executed. The presence or absence of the safety filter does not affect the internal structure and operation of the tracking strategy. Therefore, this scheme can be flexibly integrated into various existing humanoid robot motion control systems as an independent safety intermediate layer.

[0143] In one embodiment, a safety value prediction model is trained using high-fidelity geometric collision detection in the offline phase as a supervisory signal, enabling the model to learn a safety distance value mapping capability that is highly consistent with the real geometry. After real-time online deployment, no more expensive mesh or convex hull distance queries are performed; the safety distance values ​​and their joint space gradients for all monitored self-collisions can be obtained simultaneously through a single forward and backward propagation of the neural network. For example, in a deployment instance containing 23 joints and 10 monitored self-collisions, the time taken for a single high-fidelity geometric distance query is approximately in the millisecond range, which is completely insufficient to meet real-time requirements at a control frequency of 500 Hz. The forward propagation of the safety value prediction model only involves matrix multiplication and nonlinear activation of several fully connected layers, taking approximately tens of microseconds on an embedded processor, and the time taken for backpropagation gradient calculation is approximately a constant multiple of the forward propagation time. The combined time of both is still far less than the time budget of one control cycle (2 milliseconds). This architecture, which combines offline high-fidelity training with online lightweight inference, allows the high-fidelity geometric collision information to be fully distilled into a lightweight neural network. In the online phase, it achieves a safety assessment capability with near-real geometric accuracy at a computational cost of microseconds, thus resolving the fundamental contradiction in traditional solutions where high-fidelity accuracy and real-time computational efficiency are mutually exclusive.

[0144] In one embodiment, traditional online collision detection schemes using simplified geometries such as capsules, spheres, or bounding boxes are limited by their insufficient ability to represent complex body parts (such as the concave area between the thigh and calf at the lower limb joint, the narrow gap between the inner side of the elbow and the torso when the arm is bent, and the overlapping area of ​​multiple parts near the shoulder joint). They typically only reliably cover a portion of geometrically simple collision pairs, easily leading to over-conservatism and insufficient coverage for geometrically complex collision pairs. This embodiment addresses this by using a high-fidelity geometric model to accurately annotate the distances of all monitored collision pairs during the training phase. This allows the safety value prediction model to learn the true safety distance mapping for each collision pair, achieving complete coverage of all monitored collision pairs during the deployment phase. Furthermore, by incorporating a conservative bias into the training phase using an asymmetric loss function and explicitly eliminating residual optimistic bias in subsequent phases using unilateral safety calibration, the model's missed detection probability is systematically compressed.

[0145] In one embodiment, unlike existing methods that only perform offline reference motion correction, the correction process in this embodiment re-runs the entire process of safety value prediction, collision pair screening, and constraint optimization solution based on the robot's latest actual joint configuration (i.e., the current robot state) in each control cycle. Taking the dance motion scenario in the aforementioned embodiment as an example, if the reinforcement learning tracking strategy pushes the left shoulder pitch joint from the initial joint motion of 80° to 82° (tracking deviation of 2°) due to model generalization error, the safety value prediction model will immediately re-evaluate the safety distance values ​​of each collision pair based on the current actual 82° (not the 80° preset in the offline stage). That is, the safety distance value between the head and the left arm may further decrease from 5 cm to 3.5 cm. The correction process then recalculates the correction amount based on the latest safety distance value in the next control cycle, correcting the left shoulder from 82° to the safe direction, eliminating the additional risk introduced by the tracking deviation. This closed-loop safety correction mechanism based on real-time feedback makes the entire system inherently robust to the combined effects of reference motion redirection error, strategy tracking deviation, and external disturbances.

[0146] In one embodiment, the safety distance values ​​output by this embodiment are continuous values, such as 5 cm between the head and the left arm, 4 cm between the left arm and the side of the torso, and 18 cm between the left thigh and the right arm. The magnitude of these values ​​accurately reflects the distance of each collision pair from the collision boundary, providing a fine quantitative input for comparing activation thresholds and constructing constraints. At the same time, the joint space gradient obtained through the automatic differentiation capability of the prediction model provides complete information on the direction and efficiency of the influence of each joint on the safety distance value, enabling the subsequent quadratic programming solver to accurately find the optimal joint adjustment scheme that achieves the safety requirements with the minimum correction amount, rather than blindly applying tentative adjustments to all joints.

[0147] In one embodiment, the quadratic programming objective function provided in this embodiment explicitly includes a weighted distance minimization term of the correction vector relative to the initial joint action. That is, the transpose of the correction vector is multiplied by the weight matrix and then multiplied by the correction vector. This design ensures that the optimizer will prioritize the correction scheme that minimizes the deviation from the initial action, provided that all safety constraints are met. At the same time, the different values ​​of the elements on the diagonal of the weight matrix allow for differentiated settings of the correction costs for different joints. That is, core motion joints (such as the joints of the legs) have a greater impact on the overall motion task (such as walking stability and gait quality), so their weights are set to larger values ​​(such as 1.0), and the optimizer tends to avoid modifying these joints as much as possible. Joints that are sensitive to safety but have a smaller impact on motion expression (such as the shoulder joint and trunk yaw joint) are set to smaller values ​​(such as 0.1), allowing these joints to undertake the main correction tasks. For example, the entire correction involves only two joints (increasing left shoulder pitch by 5° and decreasing torso yaw by 6°), while the target angle values ​​for the remaining 21 joints remain completely consistent with the initial joint movements. The correction has no impact on the leg gait or the overall direction of torso movement in the dance, and the audience can hardly perceive the existence of the safety correction. This precise correction strategy, which makes only the minimum necessary adjustments to the necessary joints, allows the self-collision safety protection mechanism of this embodiment to eliminate the risk of collision while hardly impairing the movement style and semantic expression defined by the reference movement.

[0148] In one embodiment, the effects of various parameters in the correction process on safety and motion performance are highly coupled and non-monotonic. For example, lowering the activation threshold reduces the frequency of correction intervention but may increase the risk of missed detections; increasing the relaxation penalty inhibits constraint relaxation but may lead to solution failure when constraints conflict. If each set of candidate parameters needs to run a complete simulation to evaluate its actual effect, the total number of simulations required to find a satisfactory set of parameters in the parameter search space through grid search or random search is usually unacceptable. For example, in a six-dimensional parameter space, 10 sampling points per dimension would require 1 million simulations. This embodiment introduces a constraint surrogate model to perform pre-screening before the complete simulation evaluation. That is, a lightweight classifier is trained as a surrogate model using a small number (e.g., 30 sets) of samples that have undergone complete simulation evaluation. Then, the surrogate model is used to quickly predict whether the remaining large number of candidate parameters are likely to pass the safety and performance thresholds. Only a small number of candidate parameters predicted to be likely to pass (e.g., 15% of the total number of candidates) are subjected to expensive complete simulation evaluation. Thus, the total computational cost of parameter tuning is reduced by more than an order of magnitude, and deployment parameters that balance safety and motion performance are obtained within a limited computational budget.

[0149] Based on the above embodiments, Figure 9 This is a schematic diagram of a robot motion control device provided in an embodiment of this application. (Reference) Figure 9The robot motion control device provided in this embodiment specifically includes: an acquisition module 21, a safety distance value determination module 22, an activation filtering module 23, a spatial gradient determination module 24, a correction module 25, and a motion control module 26.

[0150] The acquisition module 21 is used to acquire the current robot state and the initial joint action corresponding to the reference action; The safety distance value determination module 22 is used to predict the safety value based on the current robot state and obtain the safety distance values ​​of multiple preset self-collision pairs, wherein the self-collision pair is a pair of parts that are pre-specified to collide between different body parts of the robot. The activation filtering module 23 is used to filter out active collision pairs that are less than the preset activation threshold based on the safety distance value; The spatial gradient determination module 24 is used to perform gradient prediction processing on the active collision pairs according to the preset prediction model, and obtain the joint spatial gradient of each active collision pair with respect to the current joint configuration. The correction module 25 is used to construct function constraints based on the safe distance values ​​of each active collision pair, the joint space gradient, and the preset safety threshold. Under the function constraints, the corresponding target joint action is obtained by minimizing the difference between the target joint action and the initial joint action. The target joint action is a joint angle command vector composed of the target angle values ​​of each joint of the robot after correction. The motion control module 26 is used to control the robot to perform motion based on the target joint movements.

[0151] In one embodiment, the safe distance value determination module 22 includes: an attitude determination submodule, an initial value acquisition submodule, and a safe value determination submodule.

[0152] The attitude determination submodule is used to extract features from the current robot state to obtain global attitude features; The initial value acquisition submodule is used to perform coarse-grained safety prediction based on global attitude features to obtain the preset initial safety distance value of the self-collision pair. The safety value determination submodule is used to group and correct the initial safety distance values ​​of self-collision pairs of different interaction types according to the interaction types of different body parts, so as to obtain the corresponding safety distance values.

[0153] In one embodiment, the correction module 25 includes: a function construction submodule, a constraint determination submodule, and a correction submodule; The function construction submodule is used to construct an objective function containing a weighted sum of squares of the correction amount of the target joint motion relative to the initial joint motion, with the correction amount of the target joint motion as the optimization variable and a relaxation variable penalty term. The constraint determination submodule is used to determine the function constraints and joint physical limits that introduce relaxation variables as target constraints. The correction submodule is used to solve for the optimal correction amount that minimizes the objective function under the objective constraints, and the sum of the initial joint motion and the optimal correction amount is taken as the target joint motion.

[0154] In one embodiment, the spatial gradient determination module 24 includes: a partial derivative calculation submodule and a gradient calculation submodule; The partial derivative calculation submodule is used to calculate the partial derivatives of the safe distance value of each active collision pair with respect to the joint angles in the current joint configuration, through backpropagation of the preset prediction model. The gradient calculation submodule is used to combine the partial derivatives of each joint angle into the joint space gradient of each active collision pair.

[0155] In one embodiment, the robot motion control device further includes: a safety margin calculation module, a dataset construction module, and a prediction model determination module; The safety margin calculation module is used to perform offline collision detection based on a preset high-fidelity geometric model and calculate the real safety margin of multiple body parts under different joint configurations. The dataset construction module is used to construct training and calibration datasets by taking each joint configuration as input features and the corresponding true safety margin as safety labels. The prediction model determination module is used to train a preset safety value prediction model based on a training dataset, and to perform safety calibration on the trained safety value prediction model based on a calibration dataset to obtain the target safety value prediction model. Based on the above implementation, the safety distance value determination module 22 is also used to predict the safety value of the current robot state through the target safety value prediction model.

[0156] In one embodiment, the prediction model determination module includes: a training submodule; The training submodule is used to train the safety value prediction model using an asymmetric loss function; wherein, the asymmetric loss function applies a first penalty weight to samples that are actually unsafe but are predicted to be safe, which is higher than the second penalty weight applied to samples that are actually safe but are predicted to be unsafe.

[0157] In one embodiment, the prediction model determination module includes: an initial prediction submodule, a deviation statistics submodule, a buffer value setting submodule, and a calibration submodule; The initial prediction submodule is used to input the calibration dataset into the trained safety value prediction model for data processing to obtain the predicted safety distance value. The bias statistics submodule is used to calculate the optimistic bias of the predicted safety distance value relative to the corresponding safety label in the calibration dataset, where the safety label is the true safety margin of the corresponding sample. The buffer value setting submodule is used to set a conservative buffer value for each preset self-collision pair based on the optimistic deviation. The calibration submodule is used to determine the tightened target safety distance value based on the predicted safety distance value and the conservative buffer value, and to update the safety value prediction model based on the target safety distance value to obtain the target safety value prediction model. The target safety value prediction model takes the joint configuration as input and outputs the corresponding target safety distance value.

[0158] In one embodiment, the robot motion control device further includes: a parameter generation module, a parameter filtering module, and a simulation evaluation module; The parameter generation module is used to generate multiple sets of candidate parameters for configuring function constraints and their solution process; The parameter filtering module is used to perform safety filtering on each group of candidate parameters according to the preset constraint proxy model, and obtain the candidate parameter group that passes the filtering. The simulation evaluation module is used to perform simulation evaluation on the selected candidate parameter groups and determine the candidate parameter groups that meet the preset safety conditions and preset performance conditions as deployment parameters. The deployment parameters are used to construct and solve the function constraints in the configuration correction process.

[0159] The robot motion control device provided in this application embodiment can be used to execute the robot motion control method provided in the above embodiment, and has corresponding functions and beneficial effects.

[0160] This application provides a robot motion control device, referring to... Figure 10 The robot motion control device includes: a processor 31, a memory 32, a communication module 33, an input device 34, and an output device 35. The number of processors and the number of memories in the robot motion control device can be one or more. The processor, memory, communication module, input device, and output device of the robot motion control device can be connected via a bus or other means.

[0161] The memory 32, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and modules, such as program instructions / modules corresponding to the robot motion control method described in any embodiment of this application (e.g., acquisition module, safe distance value determination module, activation filtering module, spatial gradient determination module, correction module, and motion control module in a robot motion control device). The memory may primarily include a program storage area and a data storage area. The program storage area may store the operating system and at least one application program required for a function; the data storage area may store data created based on the use of the device, etc. Furthermore, the memory may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to the device via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0162] The communication module 33 is used for data transmission.

[0163] The processor 31 executes various functional applications and data processing of the device by running software programs, instructions and modules stored in the memory, thereby realizing the above-mentioned robot motion control method.

[0164] Input device 34 can be used to receive input digital or character information, and to generate key signal inputs related to user settings and function control of the device. Output device 35 may include display devices such as a display screen.

[0165] The robot motion control device provided above can be used to execute the robot motion control method provided in the above embodiments, and has corresponding functions and beneficial effects.

[0166] This application embodiment also provides a storage medium for storing computer-executable instructions. When executed by a computer processor, these computer-executable instructions are used to execute a robot motion control method. The robot motion control method includes: acquiring the current robot state and initial joint actions corresponding to a reference action; predicting safety values ​​based on the current robot state to obtain multiple preset safety distance values ​​for self-collision pairs, wherein the self-collision pairs are pre-specified pairs of parts that collide with different body parts of the robot; filtering out active collision pairs with safety distance values ​​less than a preset activation threshold; performing gradient prediction processing on the active collision pairs according to a preset prediction model to obtain the joint space gradient of each active collision pair with respect to the current joint configuration; constructing function constraints based on the safety distance values ​​of each active collision pair, the joint space gradient, and the preset safety threshold; and, under these function constraints, solving for the corresponding target joint action with the objective of minimizing the difference from the initial joint action, wherein the target joint action is a joint angle command vector composed of the corrected target angle values ​​of each joint of the robot; and controlling the robot to perform motion based on the target joint action.

[0167] Storage medium – any type of memory device or storage apparatus. The term “storage medium” is intended to include: mounting media, such as CD-ROMs, floppy disks, or magnetic tape devices; computer system memory or random access memory, such as DRAM, DDR RAM, SRAM, EDO RAM, Rambus RAM, etc.; non-volatile memory, such as flash memory, magnetic media (e.g., hard disks or optical storage); registers or other similar types of memory elements. Storage media may also include other types of memory or combinations thereof. Furthermore, storage media may reside in a first computer system in which a program is executed, or may reside in a different second computer system connected to the first computer system via a network (such as the Internet). The second computer system may provide program instructions to the first computer for execution. The term “storage medium” may include two or more storage media residing in different locations (e.g., in different computer systems connected via a network). Storage media may store program instructions (e.g., specifically implemented as a computer program) executable by one or more processors.

[0168] Of course, the computer-executable instructions provided in the embodiments of this application are not limited to the robot motion control method described above, but can also execute related operations in the robot motion control method provided in any embodiment of this application.

[0169] The robot motion control device, storage medium, and robot motion control equipment provided in the above embodiments can execute the robot motion control method provided in any embodiment of this application. For technical details not described in detail in the above embodiments, please refer to the robot motion control method provided in any embodiment of this application.

[0170] The above description is merely a preferred embodiment and the technical principles employed in this application. This application is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions that can be made by those skilled in the art will not depart from the scope of protection of this application. Therefore, although this application has been described in detail through the above embodiments, this application is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of this application, the scope of which is determined by the scope of the claims.

Claims

1. A robot motion control method, characterized in that, include: The robot obtains the initial joint motion corresponding to the current robot state and the reference motion, predicts the safety value based on the current robot state, and obtains the safety distance values ​​of multiple preset self-collision pairs. The self-collision pairs are pre-specified pairs of parts that collide between different body parts of the robot. Activation collision pairs that are less than a preset activation threshold are selected based on the safety distance value; The active collision pairs are subjected to gradient prediction processing according to the preset prediction model to obtain the joint space gradient of each active collision pair with respect to the current joint configuration. Based on the safe distance value, joint space gradient and preset safety threshold of each active collision pair, construct function constraints, and use the correction amount of the target joint action relative to the initial joint action as the optimization variable to construct an objective function containing the weighted sum of squares of the correction amount and a relaxation variable penalty term; The functional constraints and joint physical limits that introduce relaxation variables are determined as target constraints. Under the target constraint, the optimal correction amount that minimizes the objective function is solved, and the sum of the initial joint motion and the optimal correction amount is taken as the target joint motion, which is a joint angle command vector composed of the corrected target angle values ​​of each joint of the robot. The robot is controlled to perform motion based on the target joint movement.

2. The method according to claim 1, characterized in that, The step of predicting safety values ​​based on the current robot state to obtain multiple preset safe distance values ​​for self-collision pairs includes: The current robot state is used to extract features to obtain global pose features; Based on the global attitude features, coarse-grained safety prediction is performed to obtain the initial safety distance value of the preset self-collision pair; Based on the interaction type of different body parts, the initial safe distance value of the self-collision pair of the corresponding interaction type is grouped and corrected to obtain the corresponding safe distance value.

3. The method according to claim 1, characterized in that, The step of performing gradient prediction processing on the activated collision pairs according to a preset prediction model to obtain the joint space gradient of each activated collision pair with respect to the current joint configuration includes: For each active collision pair, the partial derivative of the safe distance value of the active collision pair with respect to each joint angle in the current joint configuration is calculated through backpropagation of the preset prediction model. The partial derivatives of each joint angle are combined to form the joint space gradient of each activated collision pair.

4. The method according to any one of claims 1-3, characterized in that, Before obtaining the current robot state and the initial joint motion corresponding to the reference motion, the method further includes: Offline collision detection is performed based on a pre-set high-fidelity geometric model, and the real safety margin of multiple pre-set self-collision pairs under different joint configurations is calculated. Using each joint configuration as input feature and the corresponding true safety margin as safety label, a training dataset and a calibration dataset are constructed. The preset safety value prediction model is trained based on the training dataset, and the trained safety value prediction model is calibrated based on the calibration dataset to obtain the target safety value prediction model. Accordingly, the step of predicting the safety value based on the current robot state includes: The target safety value prediction model is used to predict the safety value of the current robot state.

5. The method according to claim 4, characterized in that, The step of training a preset safety value prediction model based on the training dataset includes: The safety value prediction model is trained using an asymmetric loss function; wherein, the asymmetric loss function applies a first penalty weight to samples that are actually unsafe but are predicted to be safe, which is higher than the second penalty weight applied to samples that are actually safe but are predicted to be unsafe.

6. The method according to claim 4, characterized in that, The step of performing security calibration on the trained security value prediction model based on the calibration dataset to obtain the target security value prediction model includes: The calibration dataset is input into the trained safety value prediction model for data processing to obtain the predicted safety distance value. The optimistic deviation of the predicted safe distance value relative to the corresponding safe label in the calibration dataset is calculated, where the safe label is the true safety margin of the corresponding sample; A conservative buffer value is set for each preset self-collision pair based on the optimistic deviation. The target safety distance value after tightening is determined based on the predicted safety distance value and the conservative buffer value, and the safety value prediction model is updated based on the target safety distance value to obtain the target safety value prediction model, wherein the target safety value prediction model takes the joint configuration as input and outputs the corresponding target safety distance value.

7. The method according to claim 1, characterized in that, Before obtaining the current robot state and the initial joint motion corresponding to the reference motion, the method further includes: Generate multiple sets of candidate parameters for configuring the function constraints and their solution process; Based on the preset constraint proxy model, the candidate parameters in each group are safely screened to obtain the candidate parameter groups that pass the screening. The selected candidate parameter groups are evaluated through simulation. The candidate parameter groups that meet the preset safety conditions and preset performance conditions are determined as deployment parameters. The deployment parameters are used to configure the construction and solution process of the function constraints in the correction process.

8. A robot motion control device, characterized in that, include: Memory and one or more processors; The memory is used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the robot motion control method as described in any one of claims 1-7.

9. A storage medium for storing computer-executable instructions, characterized in that, The computer-executable instructions, when executed by a processor, are used to perform the robot motion control method as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Non-contact early warning method and mechanical arm anti-collision method and system

    CN122125699A

  • Dynamic obstacle avoidance method and apparatus for robot, and robot

    WO2023024279A1