A method for optimizing the trajectory of a robotic arm and a digital twin system of a robotic arm
By combining the trajectory optimization methods of Minimal Jerk and CCDIK, a natural and smooth robotic arm motion trajectory is generated, which solves the problems of joint angle discontinuity and non-smoothness in traditional inverse kinematics algorithms, and improves the accuracy of robotic arm motion and system compatibility.
Patent Information
- Application Number
- CN202510773413.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-11
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2045-06-11
AI Technical Summary
Traditional inverse kinematic algorithms such as CCDIK have discontinuity and non-smoothness of joint angles when processing complex paths, resulting in insufficient natural and smooth movement of the robotic arm.
The trajectory optimization method combined with the Minimal Jerk algorithm and the CCDIK skeletal model is used to represent the motion trajectory through the five-degree polynomial function, and the smooth trajectory is generated by the Minimal Jerk process, and combined with the inverse kinematic solution of CCDIK, smoothness detection and joint angle optimization are performed to generate a natural and smooth robotic arm motion trajectory.
It improves the accuracy and smoothness of the robotic arm movement, enhances the compatibility and flexibility of the system, adapts to the needs of different motor drivers, reduces jitter and emergency stops during the robotic arm movement, and improves the stability and reliability of task execution.
Smart Images

Figure CN120269583B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical fields of robotic arm control and digital twin design, and particularly to a method for optimizing the trajectory of a robotic arm and a digital twin system of a robotic arm. Background Art
[0002] With the rapid development of robotic arm technology, robotic arms are increasingly widely used in industries, medical care, services and other fields. In these applications, the motion planning of robotic arms is a key issue, which determines the efficiency and accuracy of robotic arms when performing tasks. Inverse kinematics is an important link in robotic arm motion planning. It determines the joint angles of the robotic arm so that the end effector of the robotic arm can reach a specific target position. However, traditional inverse kinematics algorithms such as CCDIK have some problems when dealing with complex paths, such as discontinuity and non-smoothness of joint angles, resulting in unnatural and non-smooth motion of the robotic arm. Summary of the Invention
[0003] The technical objective of this application is to provide at least a method for optimizing the trajectory of a robotic arm and a digital twin system of a robotic arm for the technical problems that traditional inverse kinematics algorithms such as CCDIK have discontinuity and non-smoothness of joint angles when dealing with complex paths.
[0004] To achieve the above technical objectives, the embodiments of this application adopt the following technical solutions.
[0005] In a first aspect, the embodiments of this application provide a method for optimizing the trajectory of a robotic arm, including:
[0006] Determine the initial position of the end effector of the robotic arm, the initial rotation angles of each joint, and the target position of the end effector;
[0007] Based on the initial position, the initial rotation angles, and the target position, use the inverse kinematics solution of the CCDIK skeletal model to obtain the rotation angles and positions of each joint in the world coordinate system;
[0008] Determine the trajectory corresponding to the CCDIK instruction according to the rotation angles and positions of each joint in the world coordinate system; determine the positions, velocities, accelerations, and jerks of each joint at different times according to the rotation angles of each joint in the world coordinate system;
[0009] The motion trajectory is represented as a fifth-degree polynomial function of time. A function for generating a polynomial trajectory is defined to process the Minimal Jerk procedure. The sizes of the M matrix and the b matrix are determined according to the number of path points. The matrix is filled with the positions, velocities, accelerations, and jerks of each joint at different times as constraint conditions. The equation M × coeffMatrix = b is solved to obtain the coefficient matrix coeffMatrix. According to the given time series t and the trajectory segment index number, combined with the coefficient matrix coeffMatrix, the position information of the end effector of the robotic arm at different times is calculated through the fifth-degree polynomial function to generate a Minimal Jerk trajectory.
[0010] Based on the trajectory corresponding to the CCDIK instruction and the Minimal Jerk trajectory, a smoothness detection is performed, and the trajectory that meets the preset conditions in both is selected as the optimized robotic arm trajectory.
[0011] Furthermore, by using the inverse kinematics solution of the CCDIK skeleton model, the rotation angles and positions of each joint in the world coordinate system are obtained, including:
[0012] The joint closest to the end effector is selected from each joint of the robotic arm as the starting joint. Starting from the starting joint, all joints are traversed, and an iterative step is performed for each joint:
[0013] The first vector from the joint to the end effector is calculated. The first vector is scaled proportionally with the second vector from the end effector to the target position using a scaling coefficient to obtain the updated position of the end effector. The updated position is used as the new target position, and the position and rotation angle of the current joint in the world coordinate system are calculated.
[0014] The iterative step is repeated until the end effector reaches the target position or the iteration count limit is reached, and the rotation angles and positions of each joint in the world coordinate system are obtained.
[0015] Still further, the iterative step further includes: during the iteration process, if any of the following failure situations is judged, a failure state is returned:
[0016] Situation 1: The end effector exceeds the target position. During iterative calculation, continuously track the position of the end effector. If the distance between the position of the end effector and the target position exceeds a preset maximum distance;
[0017] Situation 2: The distance from the joint to the end effector is too small. Set a reference value. When the distance from the joint to the end effector is less than the reference value;
[0018] Case 3: The projection distance from the joint to the target position is too small: When the projection distance from the joint to the target position is less than the reference value.
[0019] Further, based on the trajectory corresponding to the CCDIK instruction and the Minimal Jerk trajectory, a smoothness comparison is performed, and the trajectory that meets the preset conditions in both is selected as the optimized robotic arm trajectory, including:
[0020] Respectively determine the jerk integral values of the trajectory corresponding to the CCDIK instruction and the Minimal Jerk trajectory;
[0021] Select the trajectory with a smaller total jerk integral value as the optimized robotic arm trajectory.
[0022] Further, the method further includes: If the total jerk integral value is abnormal, return and recalculate.
[0023] Further, when using the inverse kinematics solution of the CCDIK bone model, create a machine joint angle limit function for all rotating joints to limit the joint rotation angle within a specified range.
[0024] Further, when solving the equation M × coeffMatrix = b, use the FullPivLU() method for solving.
[0025] Further, when determining the sizes of the M matrix and the b matrix, the number of path points is determined according to the number of key nodes of the robotic arm trajectory.
[0026] In a second aspect, an embodiment of the present application provides a digital twin system for optimizing a robotic arm trajectory, including:
[0027] A trajectory optimization task component, configured to execute the robotic arm trajectory optimization method provided in any possible implementation manner of the first aspect;
[0028] A control task component, configured to generate an output sequence of motor instructions based on the optimized robotic arm trajectory as required;
[0029] A UI rendering task component, configured to complete the graphic rendering work of the digital twin in real time according to the outputs of the trajectory optimization task component and the control task component.
[0030] Further, the control task component further has an instruction receiving function and can receive instructions from user input, sensor data, or other system signals.
[0031] Compared with the prior art, the robotic arm trajectory optimization method provided by the embodiments of the present application has the following beneficial technical effects: In the motion planning of the robotic arm, inverse kinematics and trajectory optimization are two key technical links. The ability of the robotic arm to perform inverse kinematics calculation and output an optimized trajectory instruction sequence determines the performance upper limit of the whole machine system under some complex working conditions. By using the Minimal Jerk algorithm to minimize the acceleration change rate, the generated trajectory is smoother. After the CCDIK algorithm is optimized, a new proportional scaling factor roll-off adjustment mechanism is added to accelerate the calculation and exception handling. Combined with the smoothing optimization of the output trajectory by the Minimal Jerk algorithm, the motion accuracy of the robotic arm is improved. This method can uniformly provide the speed, position or acceleration instruction sequences required by different motor drivers. When different motor drivers are selected for building the robotic arm, it can convert and provide appropriate instructions according to the requirements of the manufacturer and communication bandwidth, enhancing the compatibility and flexibility of the robotic arm system.
[0032] The beneficial technical effects achieved by the digital twin system for robotic arm trajectory optimization provided by the embodiments of the present application compared with the prior art include: The embodiments of the present application provide a digital twin framework for the robotic arm, which aims to complete the UI rendering task component, the trajectory optimization task component, and the control task component within a unified control cycle. The control task component can change the output sequence of the motor instructions depending on the output pipeline of the front end and the requirements of different manufacturers. The UI rendering task component can utilize the outputs of the trajectory optimization task component and the control task component to complete the graphic rendering work of the digital twin in real time. A coroutine implementation method in the trajectory planning task component is adopted to provide real-time support and call support for the control component task and the graphical rendering component task at the back end in a unified digital twin event loop framework. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] The drawings described herein are for illustrative purposes only and are not intended to limit the scope of the disclosure of the present application in any way. Additionally, the shapes and proportional dimensions of the components in the drawings are only schematic for facilitating the understanding of the present application and do not specifically limit the shapes and proportional dimensions of the components of the present application. Those skilled in the art can, under the teaching of the present application, select various possible shapes and proportional dimensions according to specific circumstances to implement the present application. In the drawings:
[0034] Figure 1 Schematic diagram of the digital twin system process provided for the embodiment;
[0035] Figure 2 Schematic diagram of the CCDIK process in the robotic arm trajectory optimization method provided for the embodiment;
[0036] Figure 3 Schematic diagram of the Minimal Jerk process in the robotic arm trajectory optimization method provided for the embodiment;
[0037] Figure 4 Schematic diagram of the UI rendering task component process in the digital twin system provided for the embodiment;
[0038] Figure 5 Schematic diagram of the control task component process in the digital twin system provided for the embodiment;
[0039] Figure 6 Schematic diagram of the coroutines of each component in the digital twin system provided for the embodiment;
[0040] Figure 7 Schematic diagram of the performance optimization of the coroutine event loop of each component in the digital twin system provided for the embodiment;
[0041] Figure 8 Schematic diagram of the appearance of the upper limb robotic arm for the embodiment;
[0042] Figure 9 Schematic diagram of the appearance of the control module of the upper limb robotic arm for the embodiment;
[0043] Figure 10 Schematic diagram of a section of the spatial circular operation process one for the embodiment;
[0044] Figure 11 Schematic diagram of a section of the spatial circular operation process two for the embodiment;
[0045] Figure 12 Schematic diagram of a section of the spatial circular operation process three for the embodiment;
[0046] Figure 13 Schematic diagram of a section of the spatial orbital operation process one for the embodiment;
[0047] Figure 14 Schematic diagram of a section of the spatial orbital operation process two for the example;
[0048] Figure 15 Schematic diagram of a section of the spatial orbital operation process three for the example;
[0049] Figure 16 Schematic diagram of the X-axis control instruction curve for the example;
[0050] Figure 17 is a schematic diagram of the Y-axis control instruction curve for the example;
[0051] Figure 18 Schematic diagram of the Z-axis control instruction curve for the example;
[0052] Figure 19 is a schematic diagram of the trajectory detail one for the example;
[0053] Figure 20 Schematic diagram of the digital twin display motion trajectory one for the example;
[0054] Figure 21 is a second schematic diagram of the digital twin displaying the motion trajectory in the example. Specific implementation manner
[0055] In order to enable those skilled in the art to better understand the technical solutions in this application, the following will clearly and completely describe the technical solutions in the embodiments of this application in conjunction with the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are only a part of the embodiments of this application, rather than all the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the scope of protection of this application.
[0056] In the description of this application, the terms "first" and "second" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more features.
[0057] Some embodiments of this application aim to provide a robotic arm trajectory optimization method combining Minimal Jerk and CCDIK, which is convenient for developers to perform program integration and provides optimization in terms of trajectory tracking. The following further explains in conjunction with specific embodiments and the accompanying drawings of the specification.
[0058] Embodiment 1. A robotic arm trajectory optimization method includes:
[0059] Step 1: Determine the initial position of the end effector of the robotic arm, the initial rotation angles of each joint, and the target position of the end effector;
[0060] Step 2: Based on the initial position, initial rotation angles, and target position, use the inverse kinematics solution of the CCDIK skeletal model to obtain the rotation angles and positions of each joint in the world coordinate system;
[0061] Determine the trajectory corresponding to the CCDIK instruction according to the rotation angles and positions of each joint in the world coordinate system; determine the positions, velocities, accelerations, and jerks of each joint at different times according to the rotation angles of each joint in the world coordinate system;
[0062] Step 3: Represent the motion trajectory as a fifth-degree polynomial function of time. Define a function to generate the polynomial trajectory to process the Minimal Jerk procedure. Determine the sizes of the M matrix and the b matrix according to the number of path points. Fill the matrices with the positions, velocities, accelerations, and snap accelerations of each joint at different times as constraint conditions. Solve the equation M × coeffMatrix = b to obtain the coefficient matrix coeffMatrix. Based on the given time series t and the trajectory segment index number, combine the coefficient matrix coeffMatrix, and calculate through the fifth-degree polynomial function to obtain the position information of the end effector of the robotic arm at different times, and generate the Minimal Jerk trajectory.
[0063] Step 4: Perform a smoothness detection based on the trajectory corresponding to the CCDIK instruction and the Minimal Jerk trajectory, and select the trajectory that meets the preset conditions from the two as the optimized robotic arm trajectory.
[0064] For the inverse kinematics solution task of the robotic arm, the robotic arm trajectory optimization method provided by the embodiments of the present application, in combination with the optimized CCDIK solution method, obtains the rotation angles of each joint.
[0065] The working principle of CCDIK was proposed by LCT.Wang et al., and other scholars added constraints on the rotation angles of the robotic arm joints in subsequent work. Its core advantage lies in being completed based on an iterative method and single-joint fine-tuning. Only one joint parameter is changed in each iteration, which can reduce the cumulative position error caused by multiple pose adjustments back and forth. The iterative process of CCDIK starts from the end effector and traverses to the base joint to end. After a single iteration, the end effector approaches the target point position by a little. Through repeated iterations, when the distance between the end effector and the set target point meets the preset error requirement and the current iteration count is less than the maximum iteration count, it means the end effector is in place. If the distance error range is still not met after exceeding the preset maximum iteration count, it means that the final joint angle solution cannot be found.
[0066] The general process of the current CCDIK algorithm is as follows:
[0067] Module initialization: 1. Determine the initial position of the end and the initial angles of the joints; 2. Determine the target position.
[0068] Iterative calculation: 1. Select a starting joint, usually a joint near the end;
[0069] 2. Calculate the vector from the current starting joint to the end, and scale it with the vector from the end to the target position to obtain a new end position;
[0070] 3. Take the new end position as the target position and calculate the angle of the current starting joint so that the end position approaches the target position;
[0071] 4. Repeat the above steps until all joints have been iterated once.
[0072] Set termination conditions:
[0073] 1. An upper limit on the number of iterations can be set, and the iteration stops when this number is reached;
[0074] 2. An error threshold can be set, and the iteration stops when the distance between the end position and the target position is less than this threshold.
[0075] Output result: Return the final joint angles to achieve an accurate approximation of the end position to the target position.
[0076] In the embodiment, in step 2, the inverse kinematics solution of the CCDIK skeletal model is used to obtain the rotation angles and positions of each joint in the world coordinate system, including:
[0077] Select the joint closest to the end effector from each joint of the robotic arm as the starting joint, and traverse all joints starting from the starting joint. For each joint, perform the iterative steps:
[0078] Calculate the first vector from the joint to the end effector, and use the scaling factor to scale the first vector and the second vector from the end effector to the target position to obtain the updated position of the end effector; Take the updated position as the new target position and calculate the position and rotation angle of the current joint in the world coordinate system;
[0079] Repeat the iterative steps until the end effector reaches the target position or the upper limit of the number of iterations is reached, and obtain the rotation angles and positions of each joint in the world coordinate system.
[0080] In some embodiments, the above iterative steps further include: during the iteration, if any of the following failure situations occur, return a failure state:
[0081] Situation 1: The end effector exceeds the target point: During the iterative calculation, continuously track the position of the end effector. If the distance between the position of the end effector and the target position exceeds the preset maximum distance;
[0082] Situation 2: The distance from the joint to the end is too small: Set a reference value. When the distance from the joint to the end effector is less than the reference value;
[0083] Situation 3: The projection distance from the joint to the target position is too small: When the projection distance from the joint to the target position is less than the reference value.
[0084] Combine Figure 1Flow schematic diagram of the middle trajectory optimization task component and Figure 2 In some embodiments, the optimized CCDIK calculation process includes the following:
[0085] 1. Initialize the digital twin coroutine class CCDIK;
[0086] 2. Create a robot joint rotation angle limit function AngleConstraint for all rotating joints within the class to limit the rotation angle of the joint within a specified range to handle the boundary cases of the rotation angle.
[0087] 3. Define a Joint_World class within the class to represent the position and rotation angle of the joint in the world coordinate system and store the rotation angle of the joint. Enumerate CCDResult to represent the running status of the CCDIK algorithm, including success, in progress, and failure, which is convenient for other tasks to query the current status when calling.
[0088] 4. Create a Joint_Scaler class within the class to store the number of times of each scaling and the scaling factor.
[0089] Iterate the following calculation process until the termination condition is met:
[0090] 5. Set a very small reference value epsilon to prevent division by zero errors in division operations. Define a maximum distance maxLength to determine whether the end effector cannot reach the target position. Create a list worldJoints to store the data of the joints in the world coordinate system. Initialize the data of the root joint and add it to the worldJoints list. Traverse other joints, calculate the position and rotation angle of the joints in the world coordinate system, and add them to the worldJoints list. Track the position of the end effector.
[0091] 6. Calculate the vector from the end effector to the target position and calculate its distance from the target position.
[0092] 7. If the end effector has reached the target position or, return the success status.
[0093] 8. Iterate from the end joint to the root joint, calculate the vector from the current joint to the end effector and the vector to the target position (i.e., the target point).
[0094] 9. Calculate the joint rotation angle and limit it within the specified range. Update the rotation angle of the joint. Update the position of the end effector.
[0095] 10. Check whether a fault state occurs, including that the end effector exceeds the specified range of the target position (the distance between the position of the end effector and the target position exceeds the preset maximum distance), the distance from the joint to the end effector is less than epsilon, or the projected distance to the target position is less than epsilon.
[0096] 11. Determine whether the maximum number of iterations is reached according to the number of iterations. If so, return the in-progress state. At the same time, judge the upper limit of the scaling times of the end effector in-place ratio. If it is reached, adjust the scaling coefficient. If it is necessary to accelerate the time (in-place time) for the end effector to reach the target position, increase the proportional scaling coefficient. If it is necessary to improve the in-place accuracy, decrease the coefficient.
[0097] 12. Return the failure state, indicating that the end effector cannot reach the target position.
[0098] CCDIK is a heuristic algorithm for solving the inverse kinematics problem, especially suitable for scenarios that require fast response. Its working principle is to minimize the position and orientation errors by transforming one joint variable at a time. The core idea of CCDIK is that each bone rotates from the direction of its own axis point to the tail leaf node to the direction of its own axis point to the target point to start approaching. This method is simple and has low computational cost, suitable for simple problems, especially for non-human measurement bones (such as spiders, insects). However, one of the main limitations of CCDIK is that it may produce unnatural or biomechanically infeasible actions and gestures because it does not consider the spatio-temporal correction between nearby joints. An optimized CCDIK method is proposed in the embodiments of the present application, which is applied to the human upper limb and meets certain real-time requirements.
[0099] In the embodiment, the CCDIK module in step 2 obtains the position sequence of the digital twin end effector, starts the optimized traversal using the optimized CCDIK calculation process, and iteratively executes the adjustment from the end joint to the root joint on the premise of ensuring that the rotation angle of the joint remains within the limit angle of the joint until the exit condition is met and returns the angle numbers of each motor to form a position sequence instruction, and forms velocity and acceleration instructions by taking the derivative. The position instruction and the end velocity therein are sent to the Minimal Jerk component in step 3 for trajectory optimization.
[0100] Aiming at the problems of unevenness and outliers in the CCDIK trajectory of the robotic arm, the present application proposes a Minimal Jerk trajectory optimization method and a calculation method for segmented processing, which can obtain a smoother motion trajectory. In the embodiment, step 4 implements the Minimal Jerk implementation method in the trajectory optimization task.
[0101] The Minimal Jerk algorithm is a smooth trajectory generation algorithm that generates a continuous and natural path by minimizing the rate of change of acceleration. The Minimal Jerk algorithm assumes that the rate of change of the acceleration of the robotic arm's motion is minimized, thereby generating the smoothest trajectory. This algorithm has been widely used in human kinematics research and can generate trajectories similar to human motion, and is used in fields such as robotics, motion control, and biomechanics. The core idea is actually to achieve smoothness by minimizing the rate of change of acceleration.
[0102] The basic principle of the Minimal Jerk algorithm is based on optimal control theory and optimization methods. It determines a motion trajectory by solving an optimization problem such that, given the initial and target states, the rate of change of the system's acceleration is minimized.
[0103] First, the motion trajectory is represented as a polynomial function, usually a fifth-degree polynomial. This polynomial function contains information about position, velocity, and acceleration. By adjusting the coefficients of the polynomial, the smoothness and speed of the motion can be controlled.
[0104] Then, Minimal jerk usually defines an objective function that represents the rate of change of acceleration. Minimizing this objective function makes the motion trajectory smoother. At the same time, some constraint conditions need to be satisfied, such as the position, velocity, and acceleration of the initial and target states. The optimization problem of the Minimal Jerk algorithm can be formulated as a quadratic programming problem. In the embodiments, numerical optimization methods such as Newton's method or gradient descent method can be used to solve this optimization problem. By iterative solution, the optimal polynomial coefficients can be obtained, thereby obtaining a smooth motion trajectory.
[0105] Combined with Figure 3 , the Minimal Jerk algorithm in the embodiments is further described below.
[0106] 1. M matrix generation:
[0107] Represent the motion trajectory as a fifth-degree polynomial function of time, which can be easily differentiated. Define the polynomials of position , velocity and acceleration as follows, where t represents time and c i represents the polynomial parameters of each order of time terms.
[0108] (1)
[0109] In the embodiment, a function for generating a polynomial trajectory is defined to process the Minimal Jerk process, which is used to solve the equation M × coeffMatrix = b. This is essentially an orthogonal triangular decomposition process. The size of M varies according to the number of path points and is (3 × segments, 3 × segments), and the size of the matrix b is (6 × segments, 3), where segments is the number of segments. When determining the sizes of the M matrix and the b matrix, the number of path points is determined based on the number of key nodes of the robotic arm trajectory. If there are 4 key points, sengments is 3, and then the function fills the M matrix and the b matrix according to the constraints. The constraints include the starting point and the position of the end point , speed , acceleration (all set to 0 here), and the continuity of the position, speed, acceleration, jerk, and snap of the intermediate points. The M matrix and the b matrix at this time are shown as follows.
[0110] (2)
[0111] (3)
[0112] Finally, the function uses the FullPivLU() method to solve the equation M × coeffMatrix = b to obtain the coefficient matrix coeffMatrix with a size of (segments × 3, 3). coeffMatrix is a matrix with a size of (6 × segments, dim). Since there are three directions (xyz) in space, the number of dimensions dims = 3, and there are a total of 6 parameters c0 to c5, so it is 6segments, a total of 54 parameters. Then the coeffMatrix matrix can be understood as storing the trajectory information of 3 segments in a matrix of (6 × segments, 3). Each segment contains information of 3 dimensions, and each dimension contains a set of polynomial coefficients of c0 to c5. Substituting t into this polynomial can obtain the position at time t, taking the derivative can obtain the speed at time t, and taking the derivative again can obtain the acceleration at time t.
[0113] (4)
[0114] 2. Generation of Minimal Jerk position, speed, and acceleration trajectories:
[0115] Minimal Jerk is a trajectory optimization method that aims to optimize the smoothness of the path by minimizing the jerk of the trajectory, thereby improving the usage comfort or saving energy. This method solves for the coefficients of each segment of the trajectory to minimize the total jerk while satisfying the constraint conditions, so it is a constrained optimization problem. Minimal Jerk directly constrains the positions, velocities, and accelerations at the beginning and end, which results in 6 equality constraints. Since a fifth-order polynomial has 6 coefficients, the minimum order of the polynomial that meets the requirements is 5. This method can be transformed into a quadratic programming problem to achieve smooth trajectory planning by optimizing the polynomial coefficients of the trajectory. The present invention will propose a specific matrix solution to solve such trajectories.
[0116] Through the coeffMatrix matrix, the time parameter matrices of different segments of the P, V, and A trajectories can already be saved in matrix form. As long as the incrementing time series t (the increment step can be set, such as 0.1 s or 0.01 s) and the segment index number segments_index of the trajectory are cyclically assigned to getPosition(), getVelocity(), and getAcceleration(), smooth position, velocity, and acceleration trajectories with head and tail velocity and acceleration constraints can be obtained through the previously set polynomial. At the same time, these three different point sequences can also provide a unified sending interface for the adaptation of different drivers.
[0117] getPosition() function: The function is to obtain the position information of the end effector of the robotic arm at different times and generate a position trajectory through specific polynomial calculations based on the given time series t and the trajectory segment index number segments_index, in combination with the coefficient matrix coeffMatrix. Its calculation formula is:
[0118] (5)
[0119] Where c0 - c5 are the polynomial coefficients in the coeffMatrix. The generated position trajectory provides a basis for the spatial position planning of the movement of the robotic arm, ensuring that the robotic arm can accurately reach the target position. It is the basis for realizing the precise control of the robotic arm and an important source of position commands during the adaptation of different drivers.
[0120] getVelocity() function: This function uses the parameters in the coefficient matrix coeffMatrix, the input time series t, and the trajectory segment index number segments_index, according to the specific formula as follows:
[0121] (6)
[0122] Calculate the speed information of the end effector of the robotic arm at each moment, and thus generate a speed trajectory. The speed trajectory is crucial for the smoothness and efficiency of the robotic arm's movement. It can help control the speed change of the robotic arm during movement, avoid the impact and vibration caused by sudden speed changes, make the movement of the robotic arm more fluent, and at the same time provide a speed command reference for the driver.
[0123] The getAcceleration() function: The getAcceleration() function calculates the acceleration information of the end effector of the robotic arm and generates an acceleration trajectory according to the coefficient matrix coeffMatrix, the time series t, and the trajectory segment index number segments_index, based on the following formula:
[0124] (7)
[0125] Calculate the acceleration information of the end effector of the robotic arm and generate an acceleration trajectory. The acceleration trajectory plays a key role in ensuring the stability and accuracy of the robotic arm's movement. By controlling the change of acceleration, the jitter during the movement of the robotic arm can be effectively reduced, and the instability or accuracy decline of the robotic arm caused by excessive acceleration can be prevented, providing stable power support for the robotic arm when performing tasks, and at the same time providing data support for the setting of the acceleration command of the driver.
[0126] In the embodiment, as Figure 3 shown, the trajectory smoothness check is performed in step 5. As an example, after obtaining the trajectory corresponding to the CCDIK instruction and the trajectory corresponding to the Minimal Jerk instruction, the trajectory planning instruction will perform a smoothness check. The comparison method is to compare the total Jerk integral values of the two trajectories at both ends, and select the smaller one to be sent to the controller for execution. For the Minimal Jerk trajectory, the trajectory with an abnormal jerk integral value will be returned for recalculation.
[0127] During the process of building the robotic arm (the shape of the robotic arm is as Figure 8 shown), different motor drivers often need to be selected according to different scenarios, and their received instruction types are often slightly different. According to indicators such as the motor manufacturer and the communication bandwidth of the driver, it is often necessary to convert between various different types of instructions such as speed instructions, position instructions, and acceleration instructions.
[0128] The trajectory optimization method combining CCDIK and Minimal Jerk in the embodiment of the present application can provide an effective solution to facilitate developers to obtain the optimized trajectory and perform program integration on this basis. CCDIK can quickly calculate the joint angles, while Minimal Jerk can optimize the trajectories of these angles changing with time, and use the synthetic information to output a motor instruction sequence suitable for the actual driver (which can be sent to the robotic arm control module, such asFigure 9 as shown), making the movement of the robotic arm more natural and smooth. In this way, it is possible to uniformly provide the speed, position, or acceleration instruction sequences required by different motor drivers, so as to adapt to different application scenarios and motor characteristics, and meet the requirements of different manufacturers and communication bandwidths.
[0129] When delivering the robotic arm device to the user, the user often needs a digital twin interface for synchronous display. However, in the existing system, the UI rendering task component, trajectory optimization task component, and control task component are often arranged dispersedly in each control link, which will introduce a certain lag and noise, bringing certain challenges to the real-time performance of the whole machine and sacrificing the user experience. In response to this, the embodiments of the present application propose to place the three tasks in a unified coroutine event loop and give a performance optimization method.
[0130] Embodiment 2. The embodiments of the present application also provide a robotic arm digital twin system, including a trajectory optimization task component, a control task component, and a UI rendering task component.
[0131] The trajectory optimization task component is configured to execute the robotic arm trajectory optimization method as described above.
[0132] The control task component is configured to generate an output sequence of motor instructions according to requirements based on the optimized robotic arm trajectory.
[0133] The UI rendering task component is configured to complete the graphic rendering work of the digital twin in real time according to the outputs of the trajectory optimization task component and the control task component.
[0134] In the embodiment, native coroutines are implemented within the same event loop framework, so that the three tasks of the trajectory optimization task component, the control task component, and the UI rendering task component can be completed within the same event cycle, which can facilitate the user to have a synchronous and consistent control experience. In this rendering framework, the actual robotic arm state and the robotic arm state of the graphic interface can be synchronized to achieve the digital twin following state of "displaying as it moves".
[0135] In practical applications, the context information of each component can be mutually referenced, reducing the discontinuity and unevenness in the movement of the robotic arm, and improving the efficiency and accuracy of the movement. By optimizing the trajectory, the jitter and sudden stop of the robotic arm can be reduced, thereby improving the stability and reliability of task execution.
[0136] Please refer to Figure 5 In some embodiments, the control task component is responsible for receiving and sending three types of driver instructions to achieve precise control of the robotic arm. The design of this component allows it to operate efficiently in the coroutine system of Unity, ensuring the timely transmission and execution of instructions. The following are the main functions of the control task component:
[0137] 1. Instruction Reception: The component can receive instructions from different sources, including user input (such as directly controlling the joint angle with a slider on the GUI), sensor data (such as directly controlling the end effector trajectory block in the above digital twin software with a force sensor, and the trajectory block generates a heuristic trajectory container to calculate the joint angle, joint velocity, and joint acceleration through CCDIK and Minimal Jerk), or other system signals (the user directly drags the end effector trajectory block in the digital twin software, and the trajectory block generates a heuristic trajectory container to calculate the joint angle, joint velocity, and joint acceleration through CCDIK and Minimal Jerk).
[0138] 2. Instruction Processing: Parse and process the received instructions, and convert them into specific actions that the robotic arm can execute.
[0139] 3. Instruction Sending: Send the processed instructions to the actuator of the robotic arm to execute the corresponding actions.
[0140] 4. Status Feedback: Monitor the status of the robotic arm and feedback the execution result to the control system for further adjustment or optimization.
[0141] Please refer to Figure 4 , the UI rendering component is responsible for receiving real-time information from the actuator and updating the physical information of the rigid body tree. The design of this component aims to provide real-time feedback for the user interface while ensuring the accuracy of physical simulation. The following are the main functions of the UI rendering component:
[0142] 1. Real-time Information Reception: Receive real-time operating status and sensor data from the actuator of the robotic arm.
[0143] 2. Physical Information Update: Update the physical simulation display on the UI, such as the position and velocity of the robotic arm, according to the received information.
[0144] 3. User Interaction: Allow users to interact with the robotic arm through the UI, such as adjusting parameters or sending control instructions.
[0145] Performance Optimization: Improve the response speed and overall performance of the UI by reducing unnecessary calculations and optimizing the rendering process.
[0146] Please refer to Figure 6 and Figure 7 As shown, in the embodiment, the frequency of calling GetComponent() is reduced by caching Rigidbody (the robotic arm rigid body class resource) in the Awake method. At the same time, a sub-stepping loop for physical simulation can be introduced, and this loop performs physical updates multiple times in each frame to improve the accuracy of physical simulation. This method can ensure that physical operations are executed at the appropriate time, reduce GC generation and CPU consumption, and increase the probability of physical updates within a single frame.
[0147] In the results of Experimental Figures 10, Figure 11 , and Figure 12, the execution process of a set of spatial points that are planar circular but with the z - coordinates of some points higher than the circular plane is shown (a small 3D coordinate system representing the end - effector pose of the robotic arm runs on the planned trajectory). The green points are the set of input points, and the cyan part is the set of points after interpolation. It can be seen that the cyan points are significantly denser and smoother. In another set of irregular trajectories simulating a roller - coaster track Figure 13 , Figure 14 , Figure 15 the same verification is obtained.
[0148] The smoothness of the speed and acceleration point sequences needs to be observed by calling getPosition(), getVelocity(), and getAcceleration() in real - time to read and send real - time plots. In Figure 16 , Figure 17 , and Figure 18, the position point sequence, speed point sequence, and acceleration point sequence generated in real - time for the trajectory are grouped by the X, Y, and Z axes respectively, sent out in the form of messages and plotted for observation. It is found that the position, speed, and acceleration sequences are all smooth, continuous, and without mutations. In Figure 19 when magnifying the time gaps between each point, the trajectory still has no burrs, which is consistent with the applicant's expectation. In Figure 20 , Figure 21 , when the end - effector of the robotic arm runs to complete a section of the trajectory respectively, the spatial trajectory sequence formed by the red small balls can be seen, and the robotic arm also updates the physical rigid - body position and follows the trajectory according to the design.
[0149] The embodiment of the present application provides a robotic - arm digital - twin system, including a trajectory planning and graphics rendering method, aiming to combine the CCDIK and Minimal Jerk algorithms to improve the effect of robotic - arm motion planning, adapt to multi - vendor drivers, and provide a unified digital - twin application program.
[0150] In some embodiments, the specific solution is to organize the UI rendering task, trajectory optimization task, and control task in a unified manner as coroutine components in an event - loop container of a Unity application program on an industrial computer of the X86 platform, perform unified calculations and unified rendering, and the components reference the context relationship with each other to accelerate calculations and improve efficiency. Among them, the trajectory planning component and the control task component have independent designs. The Minimal Jerk optimization method based on CCDIK is used as the trajectory planning component of the digital - twin program, and this component includes the CCDIK part and the Minimal Jerk part.
[0151] The core idea of combining CCDIK and Minimal Jerk is to use the Minimal Jerk algorithm to generate a smooth trajectory based on CCDIK. First, the user gives the initial position and the final position, and sets the required initial velocity, initial acceleration, required final velocity, and final acceleration. Then, the Minimal Jerk algorithm is used to generate smooth position, velocity, and acceleration trajectories of the end effector in the world coordinate system. Finally, through the iterative optimization of CCDIK, the joint angles are gradually adjusted to approach the target position, and the smooth trajectory is given to the motor actuators of each joint. In terms of the specific idea, in the embodiment, the CCDIK module is used as the conversion module between the world coordinate system and the joint coordinate system. CCDIK calculates fast, and using it can conveniently achieve trajectory following. Minimal Jerk makes the movement of the robotic arm more natural and continuous.
[0152] The control component of the Minimal Jerk optimization method based on CCDIK in the embodiment is used to uniformly generate the motor instructions required by each manufacturer. The robotic arm digital twin system provided by the embodiment realizes a robotic arm graphics rendering component for digital twin, which is used to support digital twin rendering and robotic arm synchronization.
[0153] The robotic arm trajectory optimization method and the robotic arm digital twin system provided by the present application have been introduced in detail above. Specific examples are used in this article to elaborate on the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the concept of the present application and should not be construed as a limitation on the protection scope of the present application.
Claims
1. A method for optimizing the trajectory of a robotic arm, characterized in that, Including: Determine the initial position of the end effector of the robotic arm, the initial rotation angles of each joint, and the target position of the end effector; Based on the initial position, initial rotation angles, and the target position, use the inverse kinematics solution of the CCDIK skeletal model to obtain the rotation angles and positions of each joint in the world coordinate system; According to the rotation angles and positions of each joint in the world coordinate system, determine the trajectory corresponding to the CCDIK instruction; according to the rotation angles of each joint in the world coordinate system, determine the positions, velocities, accelerations, and jerk accelerations of each joint at different times; Represent the motion trajectory as a fifth-degree polynomial function of time, define a function to generate the polynomial trajectory to process the MinimalJerk process, determine the sizes of the M matrix and b matrix according to the number of path points, fill the matrix with the positions, velocities, accelerations, and jerk accelerations of each joint at different times as constraint conditions, solve the equation M×coeffMatrix = b to obtain the coefficient matrix coeffMatrix; based on the given time series t and the trajectory segment index number, combine the coefficient matrix coeffMatrix, and calculate through the fifth-degree polynomial function to obtain the position information of the end effector of the robotic arm at different times, and generate the Minimal Jerk trajectory; Based on the trajectory corresponding to the CCDIK instruction and the Minimal Jerk trajectory, perform smoothness detection, and select the trajectory that meets the preset conditions among the two as the optimized robotic arm trajectory.
2. The robotic arm trajectory optimization method according to claim 1, wherein Use the inverse kinematics solution of the CCDIK skeletal model to obtain the rotation angles and positions of each joint in the world coordinate system, including: Select the joint closest to the end effector from each joint of the robotic arm as the starting joint, start traversing all joints from the starting joint, and perform iterative steps for each joint: Calculate the first vector from the joint to the end effector, scale the first vector and the second vector from the end effector to the target position using the scaling factor to obtain the updated position of the end effector; use the updated position as the new target position, and calculate the position and rotation angle of the current joint in the world coordinate system; Repeat the iterative steps until the end effector reaches the target position or reaches the upper limit of the number of iterations to obtain the rotation angles and positions of each joint in the world coordinate system.
3. The robotic arm trajectory optimization method according to claim 2, wherein The iterative steps further include: during the iteration, if any of the following failure situations is judged, return the failure state: Situation 1: The end effector exceeds the target position: During the iterative calculation, continuously track the position of the end effector. If the distance between the position of the end effector and the target position exceeds the preset maximum distance; Situation 2: The distance from the joint to the end effector is too small: Set a reference value. When the distance from the joint to the end effector is less than the reference value; Situation 3: The projected distance from the joint to the target position is too small: When the projected distance from the joint to the target position is less than the reference value.
4. The robotic arm trajectory optimization method according to claim 1, wherein Compare the smoothness of the trajectory corresponding to the CCDIK instruction and the Minimal Jerk trajectory, and select the trajectory that meets the preset conditions from the two as the optimized robotic arm trajectory, including: Determine the jerk integral values of the trajectory corresponding to the CCDIK instruction and the Minimal Jerk trajectory respectively; Select the trajectory with a smaller total jerk integral value as the optimized robotic arm trajectory.
5. The robotic arm trajectory optimization method according to claim 4, wherein, The method further includes: if the total jerk integral value is abnormal, return to recalculate.
6. The robotic arm trajectory optimization method according to claim 1, wherein, When using the inverse kinematics solution of the CCDIK bone model, create a machine joint angle limit function for all rotating joints to limit the joint rotation angle within a specified range.
7. The robotic arm trajectory optimization method according to claim 1, characterized in that When solving the equation M × coeffMatrix = b, use the FullPivLU( ) method for solution.
8. The robotic arm trajectory optimization method according to claim 1, wherein When determining the sizes of the M matrix and the b matrix, the number of path points is determined according to the number of key nodes of the robotic arm trajectory.
9. A robotic arm digital twin system, characterized in that, Including: A trajectory optimization task component configured to execute the robotic arm trajectory optimization method described in any one of claims 1 to 8; A control task component configured to generate an output sequence of motor instructions according to requirements based on the optimized robotic arm trajectory; A UI rendering task component configured to complete the graphic rendering work of the digital twin in real time according to the outputs of the trajectory optimization task component and the control task component.
10. The robotic arm digital twin system according to claim 9, characterized in that, The control task component also has an instruction receiving function and can receive instructions from user input, sensor data or other system signals.
Citation Information
Patent Citations
Multi-target trajectory planning and solving method for industrial mechanical arm
CN117901119A
Transition method and device for Cartesian track and joint track of robot
CN118906044A