Medical robot arm coordination control method and system based on global redundancy optimization
By constructing redundant transition intersections and optimizing the graph theory framework, the problem of redundant parameter mutations in transcranial magnetic stimulation (TMS) treatment of medical robotic arms was solved, achieving global smoothness and stable control of the robotic arm and improving treatment accuracy and safety.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHONGQING UNIV
- Filing Date
- 2026-04-13
- Publication Date
- 2026-06-09
Smart Images

Figure CN122165416A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of medical robot technology, and more specifically, to a coordinated control method and system for medical robotic arms based on global redundancy optimization. Background Technology
[0002] With the rapid development of precision medicine technology, medical robots are increasingly widely used in neurosurgical navigation, orthopedic surgery, and rehabilitation therapy. Particularly in transcranial magnetic stimulation (TMS) therapy, robotic arms must precisely position treatment coils to multiple specific anatomical targets in the patient's brain according to the path planned by the surgeon. Because the treatment process typically involves complex spatial posture adjustments and stringent human-robot collaboration safety requirements, six-axis or seven-axis robotic arms with redundant degrees of freedom are gradually becoming the mainstream actuators in this scenario due to their flexible obstacle avoidance capabilities and superior motion space. In practical clinical applications, how to fully utilize redundant degrees of freedom to meet the precision requirements of end-effector treatment while also ensuring smoothness, safety, and real-time response to patient movements is a core challenge that urgently needs to be addressed in the field of medical robot control.
[0003] In the prior art, Chinese Patent No. CN101804627B discloses a redundancy-based robotic arm motion planning method. This method uses a host computer to analyze the inverse kinematics of the robotic arm at the velocity level using quadratic optimization. It utilizes a linear variational inequality primal-dual neural network solver to handle the velocity Jacobian equation and joint angular velocity limit constraints, aiming to improve computational efficiency and adapt to joint velocity changes. Chinese Patent No. CN114227672B discloses a robotic arm safe collision trajectory planning method, device, storage medium, and equipment. This scheme uses fifth-order B-spline trajectory interpolation, establishes running time and safe collision quantity as optimization objectives, and uses a fast non-dominated multi-objective optimization algorithm to solve the optimal solution for multi-objective trajectory planning, aiming to solve the trajectory continuity and end-effector obstacle avoidance problems of transcranial magnetic stimulation (TMS) medical robots.
[0004] However, while existing solutions have made some progress in single-point kinematics solution efficiency or path obstacle avoidance optimization, they still suffer from a certain risk of "coordination continuity imbalance" when facing complex medical scenarios such as transcranial magnetic stimulation (TMS), which involves continuous multi-target sequences and requires real-time compensation for patient micro-movements. Specifically, existing strategies based on pseudo-inverse methods or local multi-objective optimization typically treat each treatment target as an independent optimization object, pursuing only the local optimum of performance indicators (such as minimum joint velocity or maximum obstacle avoidance distance) at each discrete point, while ignoring the topological continuity constraints of redundant parameters across the entire target sequence. This "single-point optimal" discrete solution mechanism leads to a fatal flaw: when the robotic arm moves from one target point to a nearby adjacent target point, or performs millisecond-level real-time position compensation for patient head micro-movements, the mathematical solver may "jump" to a completely different redundant configuration branch in the solution space that satisfies the end-effector pose constraints. This implicit "redundant mutation" forces the intermediate joints of the robotic arm (such as the elbow joint) to complete a large-scale posture reconstruction in a very short time to match the small displacement of the end effector, thereby triggering joint jerk (Jerk, unit: This includes sudden spikes and microscopic tremors in the terminal coils. These tremors not only cause the magnetic field to deviate from the intended brain region, reducing the therapeutic effect, but more seriously, the motion breakpoints generated during dynamic tracking may be misjudged as out of control by the safety monitoring system, leading to frequent abrupt stops of the equipment, which seriously affects the smoothness of the treatment and the safety of the patient. Summary of the Invention
[0005] The patient medical imaging data (including head MRI image data) and body characteristic data (including the physical spatial coordinates of infrared reflective markers, etc.) involved in this invention have all been explicitly authorized by the patients themselves. The scope of authorization covers the data acquisition, processing and application stages required for the implementation of the technical solution of this invention, and does not exceed the usage scenarios authorized by the patients.
[0006] To overcome the aforementioned shortcomings of existing technologies, this invention provides a coordinated control method and system for medical robotic arms based on global redundancy optimization. By constructing the redundant transition intersection of medical safety subsets between adjacent target points and solving for the globally optimal redundant parameter sequence within a graph theory framework, the method eliminates the risk of abrupt changes in redundant parameters during multi-target switching and dynamic following processes. This method not only achieves globally smooth and shock-free joint spatial trajectories but also ensures the absolute safety and stability of the robotic arm when compensating for patient micro-movements through real-time estimation of dynamic safety subsets, significantly improving the accuracy and comfort of treatment.
[0007] To achieve the above objectives, the present invention provides the following technical solution:
[0008] A coordinated control method for medical robotic arms based on global redundancy optimization includes:
[0009] The system collects MRI images of the patient's head and establishes a multi-coordinate system-to-transformation chain from the image coordinate system to the robot arm's base coordinate system. It obtains the sequence of target points to be treated and generates a head collision detection mesh model based on the multi-coordinate system-to-transformation chain. For each single target point in the sequence of target points to be treated, it determines the end-task constraints and defines redundant parameters. It discretizes and samples the redundant parameters to generate a set of candidate redundant parameters. Based on the head collision detection mesh model, it performs a three-level progressive screening of the candidate redundant parameter set to obtain the medical safety subset corresponding to each single target point.
[0010] Calculate the redundant transition intersection between the medical safety subsets of adjacent single targets in the sequence of targets to be treated, construct a redundant configuration transition graph based on the redundant transition intersection and calculate the globally optimal redundant parameter sequence, and generate a joint space trajectory based on the globally optimal redundant parameter sequence.
[0011] During the execution of the joint space trajectory by the robotic arm, the new target pose that the robotic arm end needs to compensate for is calculated, and the new medical safety subset corresponding to the new target pose is estimated; the current actual redundancy parameters are obtained, and fine-tuning joint commands are generated based on the positional relationship between the actual redundancy parameters and the new medical safety subset.
[0012] The method for establishing the transformation chain of the multi-coordinate system includes:
[0013] Four anatomical landmarks were identified from the patient's head MRI images, and the physical spatial coordinates of four infrared reflective markers on the positioning cap were collected.
[0014] The physical space coordinates of four image anatomical landmarks and four infrared reflective markers are registered by rigid body transformation, and the first transformation matrix from the image coordinate system to the head coordinate system is solved.
[0015] Control the robotic arm to move to multiple non-coplanar poses, establish a second transformation matrix between the robotic arm base coordinate system and the head coordinate system, and combine the first transformation matrix and the second transformation matrix to form a multi-coordinate system unified transformation chain from the image coordinate system to the robotic arm base coordinate system.
[0016] The method for generating the head collision detection mesh model includes:
[0017] The patient's head MRI image data is registered to the robot arm's base coordinate system using a multi-coordinate system transformation chain. The three-dimensional skin surface contour of the patient's head is extracted from the registered MRI image data. A head safety fence surface is formed by extending a preset safety distance outward along the outer normal direction of the three-dimensional skin surface contour. The head safety fence surface is then spatially meshed to generate a head collision detection mesh model.
[0018] The method for performing a three-level progressive screening of the candidate redundant parameter set includes:
[0019] The candidate redundant parameter set is selected by collision screening using a head collision detection mesh model to obtain a feasible redundant parameter set. The feasible redundant parameter set is then selected by joint physical constraint screening and jerk constraint screening to obtain the medical safety subset corresponding to each single target point.
[0020] The method for calculating the redundant transition intersection includes:
[0021] Obtain the medical safety subset of the current single target in the sequence of targets to be treated and the medical safety subset of the next adjacent single target. Calculate the mathematical intersection of the two medical safety subsets as the redundant transition intersection. If the redundant transition intersection is empty, insert an auxiliary transition point between the two adjacent single targets as a new single target and add it to the sequence of targets to be treated. Calculate the medical safety subset of the auxiliary transition point. Continue until the redundant transition intersection of all adjacent single target pairs is not empty.
[0022] Each element in the global optimal redundancy parameter sequence is the target redundancy value at the corresponding single target point;
[0023] The method for calculating the globally optimal redundancy parameter sequence includes:
[0024] The geometric center value of the redundant transition intersection is calculated. A backward transition center and a forward transition center are defined for each single target in the sequence of targets to be treated. When the single target is neither the first nor the last single target, the target redundancy value of the single target is the arithmetic mean of the backward and forward transition centers. When the single target is the first single target, the target redundancy value is the geometric center value of the redundant transition intersection between the first and second single targets. When the single target is the last single target, the target redundancy value is the geometric center value of the redundant transition intersection between the last single target and its preceding adjacent single target. The target redundancy values of each single target sequentially form a globally optimal redundancy parameter sequence from the first single target to the last single target.
[0025] The method for generating the joint space trajectory includes:
[0026] Using time as the independent variable, a polynomial interpolation fitting is performed between the sequence of treatment target points and the globally optimal redundant parameter sequence. During the interpolation process, continuous acceleration boundary conditions and jerk constraints are set to generate continuous joint space trajectories.
[0027] The method for calculating the new target pose includes:
[0028] Calculate the real-time head position and pose of the patient's head, and compare the real-time head position and pose with the initial head position and pose during planning to obtain the head micro-motion deviation matrix;
[0029] The dynamic follow-up compensation mode is determined based on the head micro-motion deviation matrix. If the dynamic follow-up compensation mode is triggered, the new target pose is calculated based on the head micro-motion deviation matrix.
[0030] The method for generating fine-tuning joint commands based on the positional relationship between actual redundancy parameters and the new medical safety subset includes:
[0031] Determine whether the actual redundant parameters fall within the new medical safety subset. If the actual redundant parameters fall within the new medical safety subset, keep the actual redundant parameters unchanged and fine-tune the joint angle to generate a fine-tuning joint command. If the actual redundant parameters do not fall within the new medical safety subset, calculate the redundancy increment pointing to the center of the new medical safety subset and generate a fine-tuning joint command based on the redundancy increment.
[0032] A medical robotic arm coordination control system based on global redundancy optimization, used to implement the aforementioned medical robotic arm coordination control method based on global redundancy optimization, characterized in that the system includes:
[0033] Coordinate unification module: Collects MRI image data of the patient's head, establishes a multi-coordinate system-to-transformation chain from the image coordinate system to the robot arm base coordinate system; obtains the sequence of target points to be treated, generates a head collision detection mesh model based on the multi-coordinate system-to-transformation chain, determines the end-task constraints and defines redundant parameters for each single target point in the sequence of target points to be treated, discretizes and samples the redundant parameters to generate a set of candidate redundant parameters, and performs a three-level progressive screening of the candidate redundant parameter set based on the head collision detection mesh model to obtain the medical safety subset corresponding to each single target point;
[0034] Redundancy optimization module: used to calculate the redundancy transition intersection between the medical safety subsets of adjacent single targets in the sequence of targets to be treated, construct a redundancy configuration transition graph based on the redundancy transition intersection and calculate the global optimal redundancy parameter sequence, and generate joint space trajectory based on the global optimal redundancy parameter sequence;
[0035] Dynamic compensation module: used to calculate the new target pose that the robotic arm end needs to compensate for during the execution of joint space trajectory by the robotic arm, estimate the new medical safety subset corresponding to the new target pose; obtain the current actual redundancy parameters, and generate fine-tuning joint commands based on the positional relationship between the actual redundancy parameters and the new medical safety subset.
[0036] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0037] This invention improves the motion continuity and coordination of medical robotic arms under complex constraints by constructing a global optimization framework based on the intersection of medical safety subsets and redundant transitions. This transforms traditional discrete inverse kinematics solutions into path planning over continuous intervals. Specifically, the method constructs a redundant configuration transition graph using the redundant transition intersection between adjacent single-target medical safety subsets. Mathematically, it forces redundant parameters to remain within a common overlapping region satisfying both preceding and following constraints during target switching, fundamentally eliminating abrupt joint velocity changes and end-effector micro-tremors caused by discontinuous redundant configurations, ensuring global smoothness of joint spatial trajectories. Simultaneously, during the dynamic following phase, by estimating the new medical safety subset corresponding to the new target pose in real time and generating fine-tuning joint commands based on this, the robotic arm can adaptively adjust according to the dynamic positional relationship of the actual redundant parameters relative to the safety interval when compensating for minor head movements in the patient. This ensures the safety boundary of redundant degrees of freedom during real-time control and avoids motion breakpoints caused by instability in single-point optimization solutions, thus achieving compliant and stable coordinated control of the robotic arm while ensuring treatment accuracy. Attached Figure Description
[0038] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0039] Figure 1 A flowchart illustrating the coordinated control method for a medical robotic arm based on global redundancy optimization, provided in an embodiment of the present invention.
[0040] Figure 2 This is a schematic diagram of a multi-coordinate system transformation chain from the image coordinate system to the robot arm base coordinate system provided in an embodiment of the present invention;
[0041] Figure 3 A schematic diagram of the three-dimensional skin surface contour of the head and the curved surface of the head safety fence provided in an embodiment of the present invention;
[0042] Figure 4 A flowchart for solving the medical safety subset provided in an embodiment of the present invention;
[0043] Figure 5 This is a schematic diagram of the intersection of adjacent target medical safety subsets provided in an embodiment of the present invention;
[0044] Figure 6 This is a flowchart of the fine-tuning joint instruction generation provided in an embodiment of the present invention;
[0045] Figure 7A functional block diagram of a medical robotic arm coordination control system based on global redundancy optimization provided in an embodiment of the present invention. Detailed Implementation
[0046] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0047] Example 1
[0048] Please see Figure 1 As shown, this embodiment provides a coordinated control method for a medical robotic arm based on global redundancy optimization, including:
[0049] Step S10: Collect MRI image data of the patient's head, establish a multi-coordinate system-to-transformation chain from the image coordinate system to the robot arm base coordinate system; obtain the sequence of target points to be treated, generate a head collision detection mesh model based on the multi-coordinate system-to-transformation chain, and solve the medical safety subset corresponding to each single target point in the sequence of target points to be treated based on the head collision detection mesh model.
[0050] Step S10 establishes a precise mathematical correlation between the patient's individualized anatomical information and the robotic arm's motion space, and on this basis, establishes a quantifiable safety boundary for the robotic arm's redundant degrees of freedom. In the transcranial magnetic stimulation (TMS) treatment scenario, the six-axis robotic arm needs to precisely position the treatment coil to a specific target point on the patient's skull surface, and the coil's normal vector must be strictly aligned with the skull's curved surface normal vector. Since the coil position needs to satisfy three translational degrees of freedom constraints and the coil posture needs to satisfy two rotational degrees of freedom constraints to make it perpendicular to the skull, the end effector only constrains five degrees of freedom, while the six-axis robotic arm has six degrees of freedom, thus generating one redundant degree of freedom. The redundant degree of freedom is manifested as the coil's rotation angle around its own normal axis. That is, when the coil's center position is fixed and its normal is aligned with the skull, the coil can still rotate around its normal axis without affecting the treatment effect. This rotation angle constitutes a redundant parameter. Traditional inverse kinematics solutions typically employ pseudo-inverse methods to calculate individual joint angles. However, these methods fail to consider the continuity of redundant parameters across adjacent target points. When the robotic arm moves from one target point to an adjacent one, the redundant parameters may abruptly change, causing some joints to undergo compensatory, violent movements, which in turn triggers microscopic tremors at the coil ends. Step S10 expands the redundant parameters from single values to continuous intervals by establishing a unified coordinate transformation chain, generating a patient-specific head collision detection mesh model, and solving for the medical safety subset for each single target point. This provides the mathematical foundation and geometric constraints for the global trajectory planning based on interval intersections in the subsequent step S20. The physical meaning of the medical safety subset is: for each treatment target point, there exists a continuous range of values for one or more redundant parameters. Any redundant parameter value within these intervals ensures that the links of the robotic arm do not collide with the patient's head, the joint angles do not exceed physical limits, and the jerk of the joint movements does not exceed the medically prescribed threshold. Traditional methods only output the optimal value of a single redundant parameter, while step S10 outputs the feasible range of the redundant parameter. This change enables subsequent trajectory planning to select a transition path at the intersection of the feasible ranges of multiple target points, thereby achieving continuous and smooth changes in the redundant parameter.
[0051] Further, step S10 includes:
[0052] Step S11: Acquire the patient's head MRI image data, identify four anatomical landmarks from the patient's head MRI image data, and collect the physical spatial coordinates of four infrared reflective markers on the positioning cap.
[0053] Specifically, the patient's head MRI images were acquired during the pre-treatment phase using the hospital's MRI equipment. The images were stored in DICOM format and contained three-dimensional voxel information of the patient's brain. Each voxel carried grayscale values and spatial coordinate information, forming a complete three-dimensional model of the brain. The process of identifying anatomical landmarks from the patient's head MRI images relied on standard definitions in human anatomy: the nasal root point is located at the intersection of the line connecting the inner canthi of both eyes and the midline of the nasal bridge, serving as a bony landmark of the skull, appearing as a characteristic bony depression in the coronal and sagittal planes of the MRI images; the external occipital protuberance is located at the bony prominence on the posterior midline of the occipital bone, appearing as the highest point of the posterior part of the skull in the sagittal image; the right and left tragus points are located at the junction of the cartilage and skull anterior to the bilateral external auditory canals, appearing as characteristic bony structures at the anterior margin of the external auditory canal opening in axial images. The four anatomical landmarks were chosen as registration references because: they are distributed in the front, back, left, and right directions of the skull, exhibiting a non-coplanar spatial distribution that uniquely determines the six-degree-of-freedom pose of the rigid body; and all four landmarks are located on the skull surface or in soft tissue adjacent to the skull, maintaining a stable position relative to the skull during treatment and preventing displacement due to changes in patient expression or soft tissue deformation. The positioning cap is a specialized head positioning device worn by the patient during treatment. Made of flexible material to conform to the head contours of different patients, the cap surface is fixed with four infrared reflective markers, each corresponding one-to-one with the four anatomical landmarks. These infrared reflective markers are made of spherical reflective material with a high-reflectivity coating. When the infrared positioning device in the treatment room emits an infrared beam that illuminates the marker surface, the beam is reflected back to the receiving unit of the infrared positioning device. The three-dimensional coordinates of each infrared reflective marker in physical space are calculated using the parallax principle of multiple receiving units. The treatment room is also equipped with a binocular vision camera as a supplement or alternative to the infrared positioning device. The binocular vision camera simultaneously captures images of the marker points on the positioning cap using two cameras with known spatial positions, and calculates the three-dimensional coordinates of the marker points using the principle of stereo vision. Step S11 prepares by associating the patient's medical image information with the real-time position information in physical space, providing two sets of corresponding points for the subsequent rigid body transformation registration. If the identification of the anatomical landmarks in step S11 is missing, the rigid body transformation registration in the subsequent step S12 will lose the reference benchmark at the image end, and it will be impossible to establish the transformation relationship between the image coordinate system and the head coordinate system; if the physical space coordinate acquisition of the infrared reflective markers is missing, the real-time position of the patient's head in the treatment room space cannot be obtained, and the motion planning of the robotic arm will deviate from the actual position of the patient, becoming a blind, off-target movement.
[0054] Step S12: Perform rigid body transformation registration on the physical space coordinates of the four image anatomical landmarks and the four infrared reflective markers, solve the first transformation matrix from the image coordinate system to the head coordinate system, control the robotic arm to move to multiple non-coplanar poses, establish the second transformation matrix between the robotic arm base coordinate system and the head coordinate system, and combine the first transformation matrix and the second transformation matrix to form a multi-coordinate system unified transformation chain from the image coordinate system to the robotic arm base coordinate system.
[0055] See Figure 2 , Figure 2 The diagram illustrates the construction principle of a multi-coordinate system transformation chain from the image coordinate system to the robotic arm base coordinate system. The diagram shows three key coordinate system nodes in logical order: the image coordinate system, the head coordinate system, and the robotic arm base coordinate system, along with three transformation matrix paths connecting these nodes. The mathematical essence of rigid body transformation registration is solving for a combination of a rotation matrix and a translation vector that minimizes the sum of the Euclidean distances between two corresponding point sets. The two point sets output in step S11 are located in the image coordinate system and the head coordinate system, respectively. The image coordinate system is a Cartesian coordinate system automatically established by the MRI equipment during scanning, with its origin and axes determined by the equipment parameters. The head coordinate system is a relative coordinate system based on the patient's head anatomy, typically with the midpoint of the line connecting the root of the nose and the external occipital protuberance as the origin, the direction of the line connecting the two traguss as the horizontal axis, the direction pointing towards the top of the head as the vertical axis, and the anterior-posterior axis perpendicular to the aforementioned two axes and pointing towards the face. Rigid body transformation registration is solved using a closed-form solution based on singular value decomposition (SVD): The two sets of points are decentered to obtain relative coordinates. The covariance matrix of the two sets of relative coordinates is calculated, and SVD is applied to the covariance matrix to obtain a left singular vector matrix and a right singular vector matrix. The rotation matrix is obtained by multiplying the transposes of the left and right singular vector matrices, and the translation vector is obtained by transforming the difference in centroids of the two sets of points using the rotation matrix. Compared to iterative optimization methods, this method has the advantages of high computational efficiency, no need for initial value setting, and global optimum. It can complete the registration calculation in milliseconds, meeting the needs of rapid pre-treatment preparation. The obtained rotation matrix and translation vector are combined to form the first transformation matrix, i.e., Figure 2 The first solid arrow connecting the image coordinate system and the head coordinate system represents the transformation relationship. The first transformation matrix can transform the coordinates of any point in the image coordinate system to the head coordinate system.
[0056] The second transformation matrix between the robot arm's base coordinate system and the head coordinate system is established using a four-point calibration method. An infrared reflective calibration plate is mounted at the end effector of the robot arm, with multiple infrared reflective markers fixed to its surface. The positional relationship of the calibration plate relative to the robot arm's end effector coordinate system is precisely calibrated at the factory. During calibration, the robot arm is controlled to move sequentially to at least four different spatial positions and non-coplanar poses. Encoder readings of the six joints of the robot arm are recorded at each pose. The homogeneous transformation matrix of the end effector coordinate system relative to the base coordinate system is calculated using the robot arm's forward kinematics model, thus obtaining the coordinates of the calibration plate's center in the base coordinate system. The forward kinematics model is a mathematical model in robot kinematics that describes the mapping relationship from joint space to Cartesian space, and is a fundamental model in the field of robotics. The forward kinematics model takes the angle values of each joint of the robot arm as input and calculates the position and orientation of the robot arm's end effector relative to the base through chain multiplication of the homogeneous transformation matrix based on the robot arm's DH parameter table. The end-effector coordinate system is a Cartesian coordinate system fixed to the end effector of the robotic arm. Its origin is usually set at the center of the end flange or the tool center, and the coordinate axes are aligned with the geometric features of the end effector. Simultaneously, an infrared positioner acquires the coordinates of infrared reflective markers on the calibration plate in the head coordinate system. The design principle for the four non-coplanar poses is that the lines connecting the centers of the calibration plate corresponding to the four poses form a spatial tetrahedron rather than a coplanar quadrilateral. This spatial distribution characteristic provides complete six-degree-of-freedom information and avoids the degradation of the transformation matrix solution caused by coplanar poses. Based on the four sets of corresponding coordinate data, the singular value decomposition method is used to solve for the optimal rigid body transformation from the base coordinate system to the head coordinate system, obtaining the second transformation matrix. This matrix establishes... Figure 2 The mathematical mapping of the second solid line path from the head coordinate system to the robot arm base coordinate system.
[0057] The construction of a transformation chain in a multi-coordinate system is achieved through matrix chain multiplication: For example... Figure 2 As indicated by the dashed arrow at the top, multiplying the inverse of the second transformation matrix by the first transformation matrix on the left yields a composite transformation matrix that directly transforms the image coordinate system to the robot arm's base coordinate system. A multi-coordinate system transformation chain refers to the complete coordinate transformation path from the image coordinate system through the head coordinate system to the robot arm's base coordinate system. This path is composed of two concatenated local transformation matrices: the first transformation matrix and the second transformation matrix. The composite transformation matrix is the equivalent mathematical expression of the multi-coordinate system transformation chain. Figure 2The transformation chain is represented by a composite path that crosses the head coordinate system and directly connects the starting and ending points. A single homogeneous transformation matrix is obtained by sequentially multiplying the local transformation matrices in the transformation chain. This matrix directly achieves a one-step transformation from the image coordinate system to the robotic arm's base coordinate system. In subsequent steps, when using a multi-coordinate system-transformation chain for coordinate transformation, matrix multiplication of the composite transformation matrix is actually performed. The physical significance of the composite transformation matrix is that the coordinates of any target point marked by the doctor in the MRI image can be directly transformed into the target coordinates in the robotic arm's base coordinate system through this matrix. The robotic arm's inverse kinematics solver can directly use these target coordinates to calculate joint angles. The establishment of the multi-coordinate system-transformation chain creates a closed-loop mathematical mapping between image planning and robotic arm execution. Any target point adjustments made at the image level can be accurately reflected in the robotic arm's motion planning. The multi-coordinate system-transformation chain enables the accurate transformation of the patient's head 3D skin surface contour extracted in step S13 from the image coordinate system to the robotic arm's base coordinate system, thereby generating a head collision detection mesh model consistent with the robotic arm's motion space. If step S12 is missing, the target coordinates in the MRI image and the patient's actual position in the treatment room will be in two independent coordinate systems. The robotic arm will be unable to convert the image planning into actual motion commands, and precise navigation for treatment will be impossible. The robotic arm's collision detection will also fail due to the lack of information on the position of the patient's head in the base coordinate system, resulting in a collision risk.
[0058] Step S13: Register the patient's head MRI image data to the robot arm base coordinate system using a multi-coordinate system transformation chain. Extract the three-dimensional skin surface contour of the patient's head from the registered patient's head MRI image data. Extend the three-dimensional skin surface contour of the head by a preset safety distance in the direction of the outer normal of the three-dimensional skin surface contour to form a head safety fence surface. Perform spatial meshing processing on the head safety fence surface to generate a head collision detection mesh model.
[0059] Specifically, the process of registering patient head MRI image data to the robotic arm base coordinate system using a multi-coordinate system transformation chain is as follows: Each voxel in the MRI image data is traversed, and the image coordinate system coordinates of the voxel are transformed to the robotic arm base coordinate system coordinates using the composite transformation matrix established in step S12. The transformed set of voxels constitutes the three-dimensional model of the patient's cranium described in the robotic arm base coordinate system. The three-dimensional skin surface contour of the head is extracted from the registered patient head MRI image data using a gray-scale threshold-based isosurface extraction method: there is a significant gray-scale difference between skin tissue and air in the MRI image, with the gray-scale value of skin tissue being higher than that of air. By setting a gray-scale threshold and extracting isosurfaces equal to that threshold, the three-dimensional skin surface contour of the patient's head is obtained. Isosurface extraction is typically implemented using the traveling cube algorithm. This algorithm traverses each voxel cube and determines the intersection pattern between the isosurface and the cube based on the relationship between the gray-scale values of the eight vertices and the threshold, ultimately outputting a surface mesh composed of triangular facets. See also... Figure 3 , Figure 3 The diagram illustrates the generation and positional relationship between the 3D head skin surface contour and the head safety barrier surface. The inner solid line closed shape represents the extracted 3D head skin surface contour, which fully describes the patient's head shape, including the forehead, temples, top, occiput, and all areas that may come into contact with the robotic arm. The head safety barrier surface is generated by expanding outwards from the 3D head skin surface contour. Figure 3 As shown by the arrow pointing from the inner contour to the outer surface, the outward expansion direction is the outward normal direction of each surface vertex. The calculation of the outward normal direction is based on the weighted average of the normal vectors of adjacent triangular facets: for each vertex in the surface mesh, all triangular facets containing that vertex are collected, the normal vector of each triangular facet is calculated, and the normal vector is weighted and averaged according to the area of the triangular facets before being normalized to obtain the outward normal direction of that vertex. The outward expansion operation moves each surface vertex along its outward normal direction by a preset safety distance, i.e. Figure 3 The gap between the inner contour and the outer curved surface, as marked in the diagram, requires careful consideration of the maximum outer diameter of the robotic arm linkage, the size of the treatment coil, and the patient's potential micro-movements. For example, the preset safety distance can be set between 5 mm and 10 mm. This distance ensures a physical distance between the robotic arm and the patient's head without excessively restricting the robotic arm's movement space. The expanded head safety barrier surface appears as follows: Figure 3 The dashed outline of the middle and outer layers, located on the outer side of the patient's scalp, forms a virtual safety boundary surrounding the patient's head. Any robotic arm link that enters this boundary is considered to pose a collision risk.
[0060] The head collision detection mesh model is generated by spatially meshing the head safety barrier surface. The spatial meshing employs a hierarchical spatial partitioning method based on an octree: the bounding box of the head safety barrier surface is used as the root node. The bounding box is the smallest cuboid that completely encloses the target geometry, with each side parallel to the coordinate axes. The bounding box is defined by the minimum and maximum values of the target geometry in the three coordinate axes, used to quickly determine whether two geometries might intersect. The space is recursively partitioned into eight child nodes until the number of triangular faces contained in each child node is below a preset threshold. For example, the preset threshold can be set to 8 to 16 triangular faces. The octree structure allows for the rapid exclusion of spatial regions that do not intersect with the robotic arm links during collision detection, performing fine-grained triangular face intersection tests only on potentially intersecting regions, thereby reducing the time complexity of collision detection from linear to logarithmic. The head collision detection mesh model stores all triangular faces of the head safety barrier surface and their spatial index structure for use in the subsequent collision filtering step S14. Step S13 transforms the patient's individualized anatomical morphology into a geometric constraint data structure that can be directly used for the robotic arm's motion planning. This allows subsequent redundant parameter screening to be based on the actual patient's head shape for collision determination, rather than on a simplified geometric model or a conservative fixed safety region. Using a patient-specific head collision detection mesh model, compared to a fixed, general safety region, allows for more efficient use of the robotic arm's motion space: for patients with smaller heads, the safety fence surface contracts, expanding the feasible range of redundant parameters and granting the robotic arm more degrees of freedom in pose selection; for patients with larger heads or unique head shapes, the safety fence surface is adjusted accordingly to ensure the accuracy of collision detection.
[0061] Step S14, see Figure 4 The process involves obtaining a sequence of target points to be treated, determining end-point task constraints and defining redundant parameters for each single target point in the sequence, discretizing and sampling the redundant parameters to generate a set of candidate redundant parameters, using a head collision detection mesh model to perform collision screening on the candidate redundant parameter set to obtain a set of feasible redundant parameters, and then performing joint physical constraint screening and jerk constraint screening on the set of feasible redundant parameters to obtain the medical safety subset corresponding to each single target point.
[0062] Specifically, the sequence of target points to be treated is determined by the physician during the treatment planning phase. By reviewing the patient's MRI images and considering the patient's condition and treatment plan, the physician marks the brain regions requiring transcranial magnetic stimulation (TMS) on the MRI images. Multiple target points are arranged in the order of treatment to form the sequence of target points to be treated. Each single target point in the sequence contains two parts of information: the three-dimensional position coordinates of the target point in the image coordinate system, i.e., the target point position coordinates, and the normal vector of the cranial surface at the target point. The target point position coordinates determine the spatial position that the center of the treatment coil needs to reach, and the cranial surface normal vector determines the orientation requirements of the treatment coil. The coil normal vector must be aligned with the cranial surface normal vector to ensure that the magnetic field penetrates the skull perpendicularly into the brain tissue. The target point position coordinates and the cranial surface normal vector are transformed from the image coordinate system to the robotic arm base coordinate system through a multi-coordinate system transformation chain. The transformed data is used for subsequent inverse kinematics solutions. The process of determining the end-effector constraints for each single target point is as follows: The three-dimensional position coordinates of the target point are set as the target position of the center of the end-effector coil, constraining three translational degrees of freedom. The normal vector of the skull surface is set as the target direction of the normal vector of the end-effector coil. The coil normal vector must be parallel to the skull surface normal vector to ensure the coil faces the head, constraining two rotational degrees of freedom. These five degrees of freedom constitute the end-effector constraints. The six-axis robotic arm has six degrees of freedom, but the end-effector constraints occupy only five. The remaining degree of freedom represents the rotation of the coil around its own normal axis. This rotation does not change the coil's center position or its normal, therefore it does not affect the treatment effect. This rotation angle is the redundancy parameter. The physical meaning of the redundancy parameter is: under the premise of satisfying the end-effector constraints, the robotic arm can select from an infinite number of joint angle configurations by adjusting the redundancy parameter. Different redundancy parameter values correspond to different joint angle combinations, but the position and orientation of the end-effector coil remain unchanged.
[0063] Discretization sampling of redundant parameters is achieved by selecting sampling points at equal intervals within the theoretical range of the redundant parameters. The theoretical range of redundant parameters is a closed interval from -180 degrees to 180 degrees, which covers the complete cycle of the coil's rotation around the normal axis. The interval of discretization sampling is typically set to 5 degrees to 15 degrees. Smaller sampling intervals can obtain finer feasible interval boundaries but increase computational load, while larger sampling intervals are more computationally efficient but may miss local feasible regions. For example, when the sampling interval is set to 10 degrees, the candidate redundant parameter set contains 37 sampling points, corresponding to redundant parameter values from -180 degrees, -170 degrees, up to 180 degrees. For each sampling point, the basic joint angles that satisfy the end-effector constraints are solved using the pseudo-inverse method of the Jacobian matrix, and then the null-space motion corresponding to the redundant parameters is superimposed to obtain the complete six-joint angle values. The calculation of zero-space motion is based on the zero-space vector of the Jacobian matrix: the Jacobian matrix describes the mapping relationship between joint angular velocity and end-effector velocity. For redundant manipulators, the zero space of the Jacobian matrix is non-empty, and the joint motion corresponding to the zero-space vector does not produce end-effector motion. Therefore, it can be used to adjust the joint configuration without affecting the end-effector pose.
[0064] Collision screening is a process of verifying the safety of each sampling point in the candidate redundant parameter set. For the six joint angle values corresponding to each sampling point, the spatial pose of each link relative to the base coordinate system is calculated using the forward kinematics model of the robotic arm. The geometric model of each link is placed in the corresponding spatial pose and subjected to an intersection test with the head collision detection mesh model generated in step S13. The intersection test is implemented using the separating axis theorem or the Gilbert-Johnson-Kelty algorithm: if any link of the robotic arm has a geometric intersection with the head collision detection mesh model, the redundant parameter value corresponding to that sampling point is determined to not meet the collision constraints and is removed from the candidate redundant parameter set; if all links do not intersect with the head collision detection mesh model, the sampling point is retained. After collision screening, the remaining continuous sampling point region in the candidate redundant parameter set constitutes the feasible redundant parameter set. The feasible redundant parameter set may consist of one or more discontinuous intervals, depending on the specific relationship between the patient's head shape and the robotic arm configuration. Joint physical constraint screening further removes redundant parameter values that cause the joint angles to exceed physical limits based on the feasible redundant parameter set. Each joint of the robotic arm has a limited physical range of motion. For example, the range of motion of each joint in a six-axis collaborative robotic arm is typically set to ±360 degrees or ±180 degrees. For each sampling point in the feasible redundant parameter set, it is checked whether all six joint angle values fall within their respective physical range of motion. If any joint angle exceeds the range, the sampling point is discarded. The jerk constraint screening is combined with information from adjacent target points: based on the spatial distance between the current target point and the previous target point in the treatment target point sequence, and the estimated motion time obtained based on the upper limit of the robotic arm's joint speeds and the spatial distance between adjacent target points, the joint angle jerk required to transition from the geometric center value of the medical safety subset of the previous target point to the redundant parameter value of the current sampling point is calculated. If this jerk exceeds a preset jerk threshold, the sampling point is discarded. The geometric center value of the medical safety subset of the previous target is calculated using the following method: when the medical safety subset contains only one continuous interval, the geometric center value is equal to the arithmetic mean of the lower and upper bounds of that interval; when the medical safety subset contains multiple discontinuous intervals, the geometric center value is equal to the weighted average of the centers of each interval, with the weight being the proportion of the length of each interval to the total length of the medical safety subset. In this embodiment, the above method for calculating the geometric center value is uniformly applied to the calculation of the geometric center value of the intersection of the medical safety subset and the redundant transition. For the first target in the sequence of target points to be treated, since there is no previous target point, the accelerometer constraint screening step is skipped, and only collision screening and joint physical constraint screening are performed. The preset accelerometer threshold is determined according to medical safety specifications. For example, the accelerometer threshold in a transcranial magnetic stimulation (TMS) treatment scenario can be set to... This threshold ensures smooth, impact-free movement of the robotic arm. After screening by joint physical constraints and jerk constraints, the remaining intervals in the set of feasible redundant parameters constitute the medical safety subset for the current single target.
[0065] The medical safety subset is expressed as one or more continuous intervals of redundant parameters, each interval described by two parameters: a lower bound and an upper bound. The physical meaning of the medical safety subset is that, for the current single target point, when the redundant parameters take any value within the medical safety subset, the robotic arm can safely deliver the treatment coil to the target point while maintaining the correct posture, without colliding with the patient's head, without causing any joint to exceed its physical limits, and without generating excessive acceleration impact during the transition from the previous target point to the current target point. The output of the medical safety subset is fundamentally different from the traditional inverse kinematics solver's output of a single optimal joint angle solution: the traditional method outputs a definite redundant parameter value, which may be optimal at the current target point, but cannot guarantee a smooth transition with the redundant parameter values of the previous and subsequent target points; the medical safety subset output in step S14 is an interval, and subsequent step S20 can select redundant parameter values that intersect with the medical safety subsets of adjacent target points within this interval, thereby achieving continuous variation of the redundant parameters throughout the entire target point sequence. Step S14 transforms the redundant degrees of freedom, neglected in traditional inverse kinematics solutions, from a "single-point optimization object" to a "sequence continuity constraint object." By outputting intervals instead of single values, it creates mathematical feasibility for subsequent global trajectory optimization. Collision screening ensures that the medical safety subset naturally possesses collision safety guarantees, joint physical constraint screening ensures accessibility, and jerk constraint screening guarantees motion smoothness. The three-layer progressive screening forms a progressive constraint verification system. Each layer of screening further tightens the feasible interval based on the previous layer. The final output medical safety subset is the range of redundant parameter values that simultaneously satisfy the triple constraints of collision safety, joint accessibility, and motion smoothness.
[0066] Step S10 establishes a complete mapping link between patient image data and redundant spatial constraints executable by the robotic arm by constructing a multi-coordinate system-transformation chain, generating a patient-specific head collision detection mesh model, and solving for the medical safety subset of each single target point. The establishment of the multi-coordinate system-transformation chain allows the treatment target points planned by the physician in the MRI images to be accurately transformed into target coordinates in the robotic arm's base coordinate system. A precise mathematical correspondence is formed between image planning and robotic arm execution, eliminating the accumulation of positioning errors caused by inconsistencies in coordinate systems. The generation of the head collision detection mesh model transforms the patient's individualized head morphology into geometric constraints that can be directly used for robotic arm motion planning. This allows collision safety verification to be based on the actual patient anatomy rather than an approximate geometric model, ensuring both safety margins and full utilization of available motion space. Solving for the medical safety subset expands the optimal value of a single redundant parameter output by the traditional method into a continuous feasible interval. This transformation lays the mathematical foundation for the global trajectory planning based on interval intersection in subsequent step S20: when the medical safety subset exists in the form of intervals, the probability of intersection between the medical safety subsets of adjacent target points is greatly increased. The robotic arm can select the transition path of redundant parameters within the intersection range, thereby achieving continuous and smooth changes of redundant parameters throughout the target point sequence. This avoids the joint movement jumps and micro-tremors at the coil ends caused by abrupt changes in redundant parameters between adjacent target points in the traditional method. The three-layer screening mechanism in step S10 forms a progressive constraint verification system of collision safety, joint reachability, and smooth motion. Each layer of screening further tightens the feasible interval. The final output medical safety subset is the range of redundant parameter values that simultaneously satisfy all medical constraints. Any redundant parameter value falling within the medical safety subset has undergone complete safety verification, and subsequent steps do not need to repeat the constraint check. Without step S10, subsequent global trajectory planning would lose information on the feasible intervals of redundant parameters, relying solely on traditional single-point optimal inverse kinematics solutions. This would prevent continuous transitions of redundant parameters between adjacent target points, leading to joint abrupt changes and end-effector tremors in the robotic arm's motion. Furthermore, collision safety would be compromised, potentially causing the robotic arm to intrude into the patient's head safety zone during movement, posing a serious medical risk. Step S10 transforms abstract medical constraints into quantifiable and computable geometric intervals, upgrading the motion planning of the transcranial magnetic stimulation (TMS) robotic arm from "experience-based single-point optimization" to "patient-specific constraint-based global continuous planning." This improves motion smoothness and treatment comfort while ensuring medical safety.
[0067] Step S20: Calculate the redundant transition intersection between the medical safety subsets of adjacent single targets in the sequence of targets to be treated, construct a redundant configuration transition graph based on the redundant transition intersection and calculate the global optimal redundant parameter sequence, and generate the joint space trajectory based on the global optimal redundant parameter sequence.
[0068] Step S20 establishes a smooth transition channel for redundant parameters between adjacent target points by calculating the mathematical intersection between the medical safety subsets of adjacent single target points. It then calculates the configuration sequence with the minimum cumulative value of redundant parameter changes across the sequence of all target points, ultimately generating a continuous joint space trajectory that satisfies the jerk constraint. Step S20 links the medical safety subsets of adjacent target points through the redundant transition intersection, ensuring that the redundant parameters of the robotic arm remain within a common area that simultaneously satisfies the safety constraints of two target points during its movement from the current target point to the next, fundamentally eliminating the possibility of abrupt changes in redundant parameters. The redundant configuration transfer graph organizes discrete target points and their medical safety subsets into graph data with a topological structure. The edge weights in the graph reflect the smoothness of the redundant parameter transition between adjacent target points. By calculating the cumulative weights along the unique path in the graph, the globally optimal redundant parameter sequence from the first target point to the last target point is obtained. This sequence minimizes the cumulative value of redundant parameter changes throughout the treatment process, thus achieving smoothness of redundant parameter changes at the global level.
[0069] Further, step S20 includes:
[0070] Step S21: Obtain the medical safety subset of the current single target in the sequence of targets to be treated and the medical safety subset of the next adjacent single target. Calculate the mathematical intersection of the two medical safety subsets as the redundant transition intersection. If the redundant transition intersection is empty, insert an auxiliary transition point between the two adjacent single targets as a new single target and add it to the sequence of targets to be treated. Then return to step S14 to calculate the medical safety subset of the auxiliary transition point until the redundant transition intersection of all adjacent single target pairs is not empty.
[0071] Specifically, it iterates through each pair of adjacent single targets in the sequence of targets to be treated, obtains the medical safety subset of the current single target and the medical safety subset of the next adjacent single target for each pair, and calculates the mathematical intersection of the two medical safety subsets. See also Figure 5 , Figure 5 This diagram illustrates the calculation principle of the intersection of adjacent target medical safety subsets. The horizontal axis represents the range of redundancy parameters, with a scale covering -180 degrees to 180 degrees. The three vertically arranged rectangular areas visually represent the current target medical safety subset, the next target medical safety subset, and the calculated redundancy transition intersection. The mathematical intersection calculation process is as follows: for each continuous interval in the current single-target medical safety subset, an interval intersection operation is performed with each continuous interval in the next adjacent single-target medical safety subset. The intersection result of the two intervals is a new interval formed by the larger of the lower bounds of the two intervals and the smaller of the upper bounds of the two intervals, such as... Figure 5As shown by the vertical dashed line, the new interval is strictly defined within the common overlap of the two medical safety subsets projected onto the horizontal axis. If the lower bound of the new interval is less than or equal to its upper bound, then the new interval is a valid intersection interval and a redundant transition intersection is added, i.e. Figure 5 In the bottom rectangular region, if the lower bound of the new interval is greater than its upper bound, the two intervals do not intersect, and the intersection result is empty. After traversing the intersection results of all interval pairs between the current single-target medical safety subset and the next adjacent single-target medical safety subset, the union of all valid intersecting intervals is taken as the redundant transition intersection of the pair of adjacent single targets. Any redundant parameter value within the redundant transition intersection satisfies the collision safety constraints, joint physical constraints, and jerk constraints of the current single target, and also satisfies all of the above constraints of the next adjacent single target. The robotic arm can select the transition target value of the redundant parameter within the range of the redundant transition intersection, so that the value interval of the redundant parameter does not need to be changed during the movement from the current single target to the next adjacent single target. Traditional methods solve for the optimal value of the redundant parameter independently at each target point, without considering the continuity constraint of the redundant parameter between adjacent targets. This results in the optimal value of the redundant parameter of adjacent targets possibly falling into two non-overlapping feasible intervals. When the robotic arm moves between targets, the redundant parameter is forced to jump to another interval, causing compensatory violent movement of the joints. Step S21 involves finding the redundant transition intersection and associating the medical safety subsets of adjacent target points along the dimension of redundant parameters. This forces the transition target value to fall within the common area of the two medical safety subsets, thus ensuring the continuity of the redundant parameter transition at the mathematical level.
[0072] When the redundant transition intersection is empty, it indicates that the medical safety subsets of the current single target and the next adjacent single target do not overlap at all in the dimension of redundant parameters. If one moves directly from the current single target to the next adjacent single target, the redundant parameters will inevitably jump. To address the case where the redundant transition intersection is empty, an auxiliary transition point insertion mechanism is triggered: an auxiliary transition point is selected at equal intervals along the straight-line path between the current single target and the next adjacent single target. The position coordinates of the auxiliary transition point are the arithmetic mean of the position coordinates of the current single target and the next adjacent single target. The skull surface normal vector at the auxiliary transition point is obtained by spherical linear interpolation of the skull surface normal vectors of the current single target and the next adjacent single target. After the auxiliary transition point is inserted, it is used as a new single target point and inserted into the position between the current single target point and the next adjacent single target point in the sequence of targets to be treated. The index of the sequence of targets to be treated is updated, and the process returns to step S14 to calculate the medical safety subset of the auxiliary transition point. The calculation process is completely consistent with the processing of the original single target point in step S14, including redundant parameter discretization sampling, collision screening, joint physical constraint screening, and jerk constraint screening. After the medical safety subset of the auxiliary transition point is calculated, the redundant transition intersection between the current single target point and the auxiliary transition point, as well as the redundant transition intersection between the auxiliary transition point and the next adjacent single target point, are recalculated. If both of the above redundant transition intersections are not empty, the auxiliary transition point is successfully inserted, and the original pair of adjacent single targets is split into two pairs of adjacent single targets, each pair having a non-empty redundant transition intersection. If any redundant transition intersection is still empty, the auxiliary transition point continues to be recursively inserted between the corresponding empty intersection target point pairs until the redundant transition intersections of all adjacent single target point pairs are not empty. The insertion of auxiliary transition points creates intermediate transition stations between two target points with originally discontinuous redundant parameters. The robotic arm passes through the auxiliary transition points in sequence during its movement. The changes in redundant parameters at each step are all within the non-empty intersection of redundant transitions, and there are no redundant parameter jumps on the overall path.
[0073] For example, suppose the medical safety subset of the current single target is in the range of -60 degrees to -20 degrees, and the medical safety subset of the next adjacent single target is in the range of +10 degrees to +50 degrees. The two ranges do not intersect, and the redundant transition intersection is empty. After inserting an auxiliary transition point at the midpoint of the spatial straight path between the two single targets, if the medical safety subset of the auxiliary transition point is in the range of -30 degrees to +20 degrees, then the redundant transition intersection of the current single target and the auxiliary transition point is in the range of -30 degrees to -20 degrees, and the redundant transition intersection of the auxiliary transition point and the next adjacent single target is in the range of +10 degrees to +20 degrees. Since both redundant transition intersections are not empty, the auxiliary transition point is successfully inserted.
[0074] Step S22: Construct a redundancy configuration transition graph based on the redundancy transition intersection of each adjacent single target pair in the target sequence to be treated, and calculate the global optimal redundancy parameter sequence in the redundancy configuration transition graph; each element in the global optimal redundancy parameter sequence is the target redundancy value at the corresponding single target.
[0075] Specifically, the redundant configuration transition graph is a directed acyclic graph (DAG) data structure. Nodes in the DAG correspond one-to-one with individual target points in the sequence of target points to be treated. Edges in the DAG connect adjacent target points and carry edge weight information. The directionality of the DAG is reflected in the fact that the direction of the edges is consistent with the order of the target point sequence, i.e., from a target point with a smaller index to a target point with a larger index. The acyclicity stems from the linear order of the target point sequence itself; there are no edges returning from a subsequent target point to a previous target point. The construction process of the redundant configuration transition graph is as follows: traverse each target point in the sequence of target points to be treated, creating a graph node for each target point. The node stores the target point's position coordinates, skull surface normal vector, and medical safety subset. Traverse the redundant transition intersections of each pair of adjacent target points, creating a directed edge for each pair of adjacent target points from the current target point node to the next adjacent target point node. This edge stores the redundant transition intersection of the adjacent target point pair.
[0076] The edge weights are calculated based on the geometric center value of the redundant transition intersection. The geometric center value of the redundant transition intersection is calculated using the same method as the geometric center value of the medical safety subset in step S14: when the redundant transition intersection contains only one continuous interval, the geometric center value is equal to the arithmetic mean of the lower and upper bounds of that interval; when the redundant transition intersection contains multiple discontinuous intervals, the geometric center value is equal to the weighted average of the centers of each interval, with the weight being the proportion of the length of each interval to the total length of the redundant transition intersection. The selection principle for the geometric center value is as follows: within the redundant transition intersection, the position farthest from the interval boundary is selected as the transition target value. The interval boundary refers to the lower and upper bounds of the continuous interval. The lower bound of the interval is the minimum allowable value of the redundant parameter within that interval, and the upper bound is the maximum allowable value of the redundant parameter within that interval. The position farthest from the interval boundary is the geometric center position of the interval, to retain the maximum adjustment margin. When a slight movement of the patient's head causes a real-time compensation requirement, the redundant parameter still has sufficient room for change without immediately exceeding the boundary of the redundant transition intersection. Let i be the index of a single target in the sequence of targets to be treated. For the i-th single target, its bidirectional transition center is defined as follows: the geometric center value of the redundant transition intersection between the i-th single target and the (i-1)-th single target is called the backward transition center of the i-th single target, and the geometric center value of the redundant transition intersection between the i-th single target and the (i+1)-th single target is called the forward transition center of the i-th single target. The target redundancy value of each single target is determined based on its bidirectional transition center: For an intermediate single target in the sequence of targets to be treated, i.e., a single target that has both a preceding and a following adjacent single target, i.e., a single target that is neither the first nor the last single target, its target redundancy value is taken as the arithmetic mean of the backward transition center and the forward transition center. This averaging strategy ensures that the target redundancy value is close to the center position of the intersection of the two redundant transitions, thus maintaining the maximum safety margin in both the forward and backward transition directions; For the first single target, since there is no preceding adjacent single target, there is no backward transition center, and its target redundancy value is directly taken as the geometric center value of the intersection of the redundant transitions between the first and second single targets, which is its forward transition center; For the last single target, since there is no following adjacent single target, there is no forward transition center, and its target redundancy value is directly taken as the geometric center value of the intersection of the redundant transitions between the last single target and its preceding adjacent single target, which is its backward transition center. The edge weight connecting the i-th single target point and the (i+1)-th single target point is defined as the absolute value of the difference between the target redundancy value of the i-th single target point and the target redundancy value of the (i+1)-th single target point. The physical meaning of the edge weight is the magnitude of the change in redundancy parameters required when the robotic arm moves from the current single target point to the next adjacent single target point. A smaller weight value indicates a smaller change in redundancy parameters and a smoother transition. Since the target redundancy value of each single target point is calculated based on its bidirectional transition center, the magnitude of the change in target redundancy values between adjacent target points is evenly distributed, minimizing the cumulative edge weight of the entire sequence.Since the redundancy configuration transfer graph is a linear directed acyclic graph, there is a unique path from the first single target point to the last single target point. A sequential traversal method is used to calculate the cumulative edge weight of this path: starting from the first single target point, each single target point is traversed sequentially, and the edge weights are calculated and accumulated to obtain the total cumulative edge weight. After the traversal, the cumulative edge weight reflects the total change in redundancy parameters throughout the sequence. The target redundancy values of each single target point sequentially form the globally optimal redundancy parameter sequence from the first single target point to the last single target point. The globally optimal redundancy parameter sequence contains the same number of elements as the number of single targets in the sequence of targets to be treated, with each element being the target redundancy value at the corresponding single target point. The time complexity of the sequential traversal algorithm is linear to the number of targets, resulting in high computational efficiency. It can quickly complete the calculation of cumulative edge weights and the generation of the globally optimal redundancy parameter sequence during the treatment planning stage. The globally optimal redundancy parameter sequence minimizes the change in cumulative redundancy parameters from the first single target point to the last single target point. This means that the cumulative motion of each joint is minimized throughout the treatment process, joint wear is reduced, energy consumption is decreased, and motion smoothness is improved.
[0077] Step S22 organizes the discrete target points and their medical safety subsets into a graph-theoretic data structure, transforming the global optimization of redundant parameters into a path computation problem on the graph. This transformation provides redundant parameter planning with a clear mathematical framework and an efficient solution algorithm. The definition of edge weights directly maps the physical quantity of the magnitude of redundant parameter changes to path costs in graph theory, ensuring that the path with the minimum cumulative edge weight naturally corresponds to the configuration sequence with the smoothest changes in redundant parameters. Traditional methods solve for the optimal value of redundant parameters independently at each target point, limiting the optimization objective to the local optimum of a single target point and failing to consider the global characteristics of the target point sequence. Step S22 elevates the optimization objective from single-point optimum to global optimum of the sequence, minimizing the cumulative change of redundant parameters throughout the treatment process and ensuring a balanced distribution of the magnitude of redundant parameter changes between adjacent target points. This avoids the imbalance where redundant parameters change drastically in one segment of the movement while remaining almost unchanged in other segments.
[0078] Step S23: Perform polynomial interpolation fitting between the treatment target sequence and the global optimal redundant parameter sequence with time as the independent variable. Set continuous acceleration boundary conditions and jerk constraint conditions during the interpolation process to generate continuous joint space trajectory.
[0079] Specifically, polynomial interpolation fitting is a method that transforms discrete target position data and redundant parameter data into a time-continuous function. Each single target point in the sequence of target points to be treated has a definite position coordinate and skull surface normal vector in the robot arm's base coordinate system. Each element in the global optimal redundant parameter sequence is the target redundancy value at the corresponding single target point. Polynomial interpolation fitting uses time as the independent variable to fit the position coordinates, skull surface normal vector, and target redundancy value of each single target point in the sequence of target points to be treated into a time polynomial function, such that at the time corresponding to each single target point, the function value exactly passes through the position coordinates and target redundancy value of that single target point. The order of the interpolation polynomial determines the smoothness of the function; the higher the order, the more continuous derivatives the function has. Step S23 uses a fifth-order polynomial, which has six undetermined coefficients and can satisfy three boundary conditions (position, velocity, and acceleration) at the start and end points of the motion segment, thereby ensuring that the position, velocity, and acceleration of the trajectory at each single target point are continuous without jumps. The time corresponding to each individual target point is determined using a motion time allocation algorithm. This algorithm calculates the time required for each motion segment based on the spatial distance between adjacent target points, the upper velocity limit of each joint, and the upper acceleration limit. After motion time allocation, the first target point in the treatment sequence corresponds to time 0, the second target point corresponds to the time of the first motion segment, the third target point corresponds to the sum of the first and second motion segments, and so on, with the last target point corresponding to the sum of all motion segment times, i.e., the total treatment time.
[0080] The specific implementation of polynomial interpolation fitting adopts a piecewise polynomial splicing method. For each segment of motion between adjacent single target points, a set of local polynomial functions is constructed. The local polynomial functions take the start time of the motion segment as the origin of the independent variable and the duration of the motion segment as the range of the independent variable. The coefficients of the local polynomial functions are solved through boundary conditions: at the start time of the motion segment, the polynomial function value is equal to the position coordinates, velocity, and acceleration boundary values of the current single target point; at the end time of the motion segment, the polynomial function value is equal to the position coordinates, velocity, and acceleration boundary values of the next adjacent single target point. The acceleration continuity boundary condition requires that the acceleration at the start time of the motion segment is equal to the acceleration at the end time of the previous motion segment, and the acceleration at the end time of the motion segment is equal to the acceleration at the start time of the next motion segment. This condition ensures that the acceleration of the global trajectory is continuous at each single target point, and there are no abrupt acceleration changes. The jerk constraint requires that the jerk value of the polynomial function throughout the entire motion segment does not exceed a preset jerk threshold. This jerk threshold is the same as the jerk threshold used for jerk constraint screening in step S14, and both are determined according to medical safety regulations. Satisfying the jerk constraint is achieved by adjusting the motion time allocation: if the initially allocated motion time causes the jerk of a certain motion segment to exceed the limit, the time of that motion segment is extended until the jerk drops below the jerk threshold.
[0081] After polynomial interpolation fitting in Cartesian space, the Cartesian space trajectory needs to be transformed into a joint space trajectory. The Cartesian space trajectory describes the position coordinates and orientation of the robotic arm's end effector coil center over time, while the joint space trajectory describes the changes in the six joint angles of the robotic arm over time. The transformation process uses inverse kinematics: for each discrete-time sampling point on the Cartesian space trajectory, the end effector position coordinates, the skull surface normal vector, and the corresponding target redundancy value at that moment are substituted into the inverse kinematics solver. The solver outputs the six joint angle values at that moment. The target redundancy value acts as a constraint on redundant degrees of freedom in the inverse kinematics solution process, ensuring that the implicit redundancy parameters in the six joint angle values output by the solver are consistent with the target redundancy value. After traversing all discrete-time sampling points on the Cartesian space trajectory, a discrete data sequence of the six joint angles changing over time is obtained. This discrete data sequence is then subjected to polynomial interpolation fitting again to obtain a continuous function of the six joint angles changing over time, i.e., the joint space trajectory. The joint space trajectory is expressed as a set of six time functions, each function describing the change of a joint angle over time. The joint space trajectory also needs to satisfy the acceleration continuity boundary condition and jerk constraint condition to ensure smooth and shock-free movement of each joint. The joint space trajectory output in step S23 will be discretized into a periodic command data packet in step S24 and sent to the robotic arm for execution. Step S23 transforms the discrete target point data and redundant parameter data into a time-continuous joint space trajectory, enabling the robotic arm to perform smooth and continuous motion on each joint rather than discrete point-to-point jumps. The use of a fifth-order polynomial ensures the continuity of the trajectory in position, velocity, and acceleration, eliminating shocks and vibrations during the movement. The introduction of jerk constraints ensures that the trajectory operates within the medical safety threshold, and the patient will not feel discomfort from the robotic arm's movement. The transformation from Cartesian space trajectory to joint space trajectory is achieved through inverse kinematics solution combined with target redundancy value constraints, so that the global optimization results of redundant parameters can be implemented at the joint level. The motion amplitude of each joint is evenly distributed rather than concentrated in a certain joint, reducing the load pressure and wear risk of a single joint.
[0082] Step S24: Combine and store the target redundancy value of each single target point in the global optimal redundancy parameter sequence with the corresponding medical safety subset as a redundant axis guide rail. Discretize the joint space trajectory into periodic position-velocity-acceleration command data packets. After verifying that the redundancy parameter value corresponding to each command data packet falls within the corresponding medical safety subset in the redundant axis guide rail, send it to the robotic arm for execution.
[0083] Specifically, the redundant axis guide is a data structure used to store the results of global trajectory planning and for subsequent real-time control queries. The redundant axis guide includes: the position coordinates and skull surface normal vector of each individual target point in the treatment target point sequence, the target redundancy value corresponding to each individual target point, the medical safety subset corresponding to each individual target point, and the redundancy transition intersection between adjacent pairs of individual target points. The redundant axis guide is stored in an indexed array structure, using the sequence index of the individual target point as the retrieval key, supporting rapid lookup of the nearest individual target point and its corresponding target redundancy value and medical safety subset based on the current position of the robotic arm. The redundant axis guide is frequently accessed during the real-time control phase in step S30 to quickly estimate the medical safety subset corresponding to the new target pose after slight head movement, avoiding re-execution of time-consuming medical safety subset calculations within the real-time control cycle. The discretization of the joint space trajectory is achieved by sampling the trajectory function at a fixed time period. The fixed time period is determined according to the control cycle of the robotic arm servo driver, and can be exemplarily set to one sampling point per millisecond. At each sampling moment, the joint angle, angular velocity, and angular acceleration values are extracted from the six time functions of the joint space trajectory. These six sets of values are combined into a position-velocity-acceleration command data packet. The position value is the function value of the joint space trajectory function at that moment, the velocity value is the first derivative of the joint space trajectory function at that moment, and the acceleration value is the second derivative of the joint space trajectory function at that moment. The position-velocity-acceleration three-parameter command format is matched with the input interface of the robotic arm servo driver. The position-velocity-torque three-loop servo controller inside the driver can directly parse this command format and drive the motor to execute it.
[0084] Before the command data packet is sent, a security check is required. The security check involves the following steps: For each command data packet, the end effector pose is calculated using a forward kinematics model based on the six joint angle values it contains. The current redundant parameter value, corresponding to the command data packet, is then deduced from the end effector pose. This redundant parameter value is compared with the medical safety subset of the nearest single target point in the redundant axis guide rail at the corresponding time. If the redundant parameter value falls within the range of the medical safety subset, the check passes; otherwise, the check fails. The deduction process for the redundant parameter value is as follows: Based on the six joint angle values, the homogeneous transformation matrix of the end effector coordinate system relative to the base coordinate system is calculated using a forward kinematics model. The end effector position and pose are extracted from the homogeneous transformation matrix. The coil normal vector is calculated based on the rotation matrix in the end effector pose. The coil normal vector is compared with the normal vector of the skull surface at the target point to determine the coil's rotation angle around the normal axis, i.e., the redundant parameter value. The verified command data packet is synchronously sent to the six joint servo drives of the robotic arm via the EtherCAT bus. After receiving the command, the drives execute the pre-planned joint movements. Failed verification command data packets are intercepted and an alarm is triggered. The system records the time of verification failure and the deviation value of redundant parameters for subsequent analysis. The reason for setting up the safety verification mechanism is that although steps S22 and S23 have ensured that the globally optimal redundant parameter sequence falls within the medical safety subset of each single target point during the planning stage, numerical errors in the trajectory discretization process, approximation errors introduced by joint space interpolation, and the precision limitations of computer floating-point operations may cause the discretized redundant parameter values to deviate slightly from the planned values. As the last line of defense, safety verification can capture the above errors and prevent the issuance of over-limit commands, preventing the robotic arm from entering the posture area where collisions may occur during execution. For example, assuming that the planned redundant parameter value at a certain moment is -20 degrees, and the medical safety subset is the range of -30 degrees to -10 degrees, if the numerical error causes the discretized redundant parameter value to be -31 degrees, which exceeds the lower bound of the medical safety subset range of -30 degrees, safety verification will detect this deviation and intercept the corresponding command data packet.
[0085] Step S20 achieves a smooth and continuous transition of redundant degrees of freedom of the six-axis robotic arm in a multi-target treatment sequence by calculating the redundant transition intersection between adjacent single-target medical safety subsets, constructing a redundant configuration transition graph and calculating the globally optimal redundant parameter sequence, and generating a continuous joint spatial trajectory that satisfies jerk constraints based on this sequence. This eliminates the joint movement jumps and micro-tremors at the coil ends caused by abrupt changes in redundant parameters between adjacent targets in traditional methods. The calculation of the redundant transition intersection correlates the medical safety subsets of adjacent targets in the dimension of redundant parameters, ensuring that the transition target value of the redundant parameters is constrained within a common area that simultaneously satisfies the safety requirements of two targets, thus mathematically guaranteeing the continuity of the redundant parameter transition. The auxiliary transition point insertion mechanism transforms the abnormal situation of an empty redundant transition intersection into a manageable normal scenario, making step S20 applicable to any sequence of targets to be treated, thus expanding the applicability of the method. The definition of edge weights directly maps the magnitude of redundant parameter changes to path costs, so that the path with the minimum cumulative weight naturally corresponds to the configuration sequence with the smoothest change in redundant parameters, unifying the optimization objective with the physical meaning. The calculation of the globally optimal redundant parameter sequence expands the optimization field from a single target point to the entire treatment sequence, minimizing the cumulative change of redundant parameters at the global level. The variation amplitude of redundant parameters between adjacent target points is evenly distributed, avoiding the imbalance between local drastic changes and other segments that remain almost unchanged. Polynomial interpolation fitting transforms discrete target point data and redundant parameter data into time-continuous joint spatial trajectories, eliminating motion discontinuities caused by point-to-point jumps. Continuous acceleration boundary conditions ensure smooth acceleration transitions at each single target point, while jerk constraints ensure that the impact intensity of joint movement does not exceed medically prescribed thresholds, jointly guaranteeing the smoothness of movement and patient comfort. A safety verification mechanism performs a final confirmation of the redundant parameter values of each data packet before command issuance, intercepting out-of-limit commands caused by numerical errors, forming the last line of defense in the execution phase. Step S20 upgrades the traditional "independent optimization of a single target point + sequential execution" mode to a "sequence global optimization + continuous trajectory execution" mode, making the redundant degrees of freedom of the six-axis robotic arm no longer a byproduct of inverse kinematics solving, but an active optimization object for global trajectory planning. Obtaining the globally optimal redundant parameter sequence minimizes the cumulative joint motion throughout the treatment process, reducing joint wear, lowering energy consumption, and improving motion smoothness—effects that traditional single-point optimization methods cannot achieve. The introduction of redundant transitional intersection maximizes the transition margin of redundant parameters while ensuring safety constraints. When real-time compensation is triggered in step S30 due to slight head movements, the redundant parameters still have sufficient adjustment space to avoid immediately exceeding the safety boundary, thus improving the robustness of real-time control.The setting of accelerometer constraints quantifies medical safety standards into executable mathematical constraints, ensuring that the generated trajectory meets the strict requirements of transcranial magnetic stimulation therapy for the smoothness of robotic arm movement. Patients will not feel the impact or vibration caused by the movement of the robotic arm, and the treatment comfort is guaranteed.
[0086] Step S30: Calculate the new target pose that the robotic arm end needs to compensate for during the execution of the joint space trajectory, estimate the new medical safety subset corresponding to the new target pose; obtain the current actual redundancy parameters, and generate fine-tuning joint commands based on the positional relationship between the actual redundancy parameters and the new medical safety subset.
[0087] Specifically, steps S10 and S20 complete the offline planning before treatment, generating joint space trajectories and redundant axis guides covering all treatment targets. However, during treatments lasting tens of minutes, it is difficult for patients to keep their heads completely still. Chest rise and fall caused by breathing, involuntary muscle adjustments, and slight swaying caused by psychological tension can all cause slight displacement of the patient's head relative to the initial planned position. If the robotic arm continues to move according to the pre-planned trajectory without considering the real-time positional changes of the patient's head, a relative offset will occur between the treatment coil and the skull target. When the offset exceeds the treatment accuracy requirements, the position of the magnetic field stimulation will deviate from the predetermined brain region, affecting the treatment effect and even causing side effects. Step S30 establishes a real-time head micro-motion sensing mechanism, a rapid new medical safety subset estimation mechanism, and an adaptive redundant parameter fine-tuning mechanism, enabling the robotic arm to quickly respond to the micro-movements of the patient's head and generate corresponding compensating movements. This achieves dynamic following between the treatment coil and the patient's head, ensuring that the coil center is always aligned with the treatment target. The core challenge of step S30 lies in the fact that the real-time control cycle is extremely short, while the complete calculation of the medical safety subset in step S14 involves time-consuming operations such as redundant parameter discretization sampling and collision detection. Re-executing the complete process of step S14 in each control cycle would result in control delays, failing to meet the requirements of real-time tracking. Step S30 employs a fast lookup table and linear interpolation strategy based on redundant axis guides. Utilizing the pre-stored medical safety subset data for each single target point in step S24, it quickly estimates the new medical safety subset corresponding to the new target pose through linear interpolation, compressing the acquisition time of the medical safety subset and making real-time control possible.
[0088] Further, step S30 includes:
[0089] Step S31: During the execution of the joint space trajectory by the robotic arm, the real-time position of the four infrared reflective markers is continuously monitored. The real-time head position of the patient is calculated based on the real-time position of the four infrared reflective markers. The real-time head position is compared with the initial head position during planning to obtain the head micro-motion deviation matrix.
[0090] Specifically, real-time position monitoring of the four infrared reflective markers is achieved through high-frequency continuous data acquisition using a binocular vision camera or infrared locator configured in the treatment room. During each sampling, the binocular vision camera simultaneously captures images of the four infrared reflective markers on the positioning cap using two cameras with known spatial positions. Utilizing stereoscopic vision principles, it calculates the three-dimensional coordinates of each infrared reflective marker in the robotic arm's base coordinate system, outputting the real-time physical spatial coordinates of the four infrared reflective markers relative to the robotic arm's base coordinate system. The infrared locator operates similarly to the binocular vision camera, determining the marker's position by emitting an infrared beam and receiving reflected light from the marker's surface. The infrared locator exhibits superior anti-interference capabilities in strong light environments compared to the binocular vision camera. The two devices can be selected for use or used as backups depending on the actual lighting conditions of the treatment room. The patient's real-time head posture is calculated based on the real-time physical spatial coordinates of the four infrared reflective markers. The calculation process for real-time head pose is similar to the establishment of the head coordinate system in step S12: Using the real-time coordinates of the infrared reflective markers corresponding to the nasal root, external occipital protuberance, right tragus, and left tragus as inputs, and the midpoint of the line connecting the nasal root and external occipital protuberance as the origin of the head coordinate system, the direction of the line connecting the two traguses is used as the horizontal axis, the direction pointing towards the top of the head is used as the vertical axis, and the direction perpendicular to the aforementioned two axes and pointing towards the face is used as the front-back axis. The homogeneous transformation matrix of the real-time head coordinate system relative to the robotic arm's base coordinate system is calculated. This homogeneous transformation matrix represents the patient's real-time head pose. The homogeneous transformation matrix is a standard mathematical expression describing the position and orientation of a rigid body in three-dimensional space. It consists of a 3x3 rotation matrix and a 3x1 translation vector. The rotation matrix describes the directional relationship of each axis of the head coordinate system relative to the base coordinate system, and the translation vector describes the positional offset of the origin of the head coordinate system relative to the origin of the base coordinate system.
[0091] The head micro-motion deviation matrix is obtained by comparing the real-time head pose with the initial head pose during planning. The initial head pose during planning is the patient's head pose recorded when establishing the multi-coordinate system-transformation chain in step S12, and is collected and stored when the patient's head is in a stable state during the planning phase. The calculation of the head micro-motion deviation matrix uses the relative transformation operation of the homogeneous transformation matrix: multiplying the homogeneous transformation matrix of the real-time head pose with the inverse of the homogeneous transformation matrix of the initial head pose yields the relative transformation matrix describing the transformation of the patient's head from the initial pose to the real-time pose; this relative transformation matrix is the head micro-motion deviation matrix. The physical meaning of the head micro-motion deviation matrix is: the translational and rotational offsets of the patient's head relative to the planned position. The translational offset is extracted from the translation vector part of the head micro-motion deviation matrix, and the rotational offset is extracted from the rotation matrix part of the head micro-motion deviation matrix using the Rodrigues formula or Euler angle decomposition. Step S11 collects the physical spatial coordinates of four infrared reflective markers during the treatment planning phase to establish a multi-coordinate system-to-transformation chain. Step S31 continuously collects the real-time positions of the same set of infrared reflective markers during the treatment execution phase to monitor the patient's head micro-movements. Both steps use the same positioning equipment and the same markers, ensuring consistency of the coordinate reference between the planning and execution phases. The head micro-movement deviation matrix output in step S31 is the direct input for step S32 to determine whether to trigger the dynamic following compensation mode. The translational offset information contained in the head micro-movement deviation matrix determines whether end-effector position compensation is needed, and the rotational offset information determines whether coil attitude adjustment is needed. Without step S31, the robotic arm will not be able to sense the real-time position changes of the patient's head when executing the pre-planned trajectory. When the patient's head micro-moves, the robotic arm will continue to move according to the initial plan, and the relative position between the treatment coil and the skull target will shift, causing the coil center to deviate from the predetermined brain region, thus compromising treatment accuracy.
[0092] Step S32: Determine whether the dynamic following compensation mode is triggered based on the head micro-motion deviation matrix. If the dynamic following compensation mode is triggered, calculate the new target pose that the end of the robotic arm needs to compensate based on the head micro-motion deviation matrix, and estimate the new medical safety subset corresponding to the new target pose.
[0093] Specifically, the determination of whether to trigger the dynamic following compensation mode is based on the comparison between the Euclidean distance corresponding to the head micro-motion deviation matrix and the preset deviation threshold. The calculation process of the Euclidean distance corresponding to the head micro-motion deviation matrix is as follows: extract the translation vector part from the head micro-motion deviation matrix, calculate the magnitude of the translation vector, which is the arithmetic square root of the sum of the squares of the three translation components. This magnitude is the Euclidean distance corresponding to the head micro-motion deviation matrix, and its physical meaning is the spatial displacement of the patient's head relative to the planned position. The determination of the preset deviation threshold needs to comprehensively consider the treatment accuracy requirements, the sensor measurement noise level, and the repeatability accuracy of the robotic arm: if the preset deviation threshold is too small, it will lead to frequent false compensation triggered by sensor noise, increasing the system burden and possibly introducing unnecessary joint movements; if the preset deviation threshold is too large, it will lead to the failure of the actual head micro-motion to trigger compensation in time, resulting in a decrease in treatment accuracy. For example, the preset deviation threshold can be set to 0.2 mm. If the Euclidean distance corresponding to the head micro-motion deviation matrix is less than the preset deviation threshold, it is determined that the change in the patient's head position is within the system noise range, the current movement is maintained without adjustment, and the robotic arm continues to execute the pre-planned joint space trajectory issued in step S24. If the Euclidean distance corresponding to the head micro-motion deviation matrix is greater than or equal to the preset deviation threshold, it is determined that the patient's head has undergone real micro-motion that needs to be compensated, triggering the dynamic follow-up compensation mode and entering the subsequent new target pose calculation and new medical safety subset estimation process.
[0094] The calculation process for the new target pose is as follows: the head micro-motion deviation matrix is applied to the end-effector target pose in the pre-planned trajectory at the current moment to obtain the compensated end-effector target pose, which is the new target pose. Specifically, the calculation uses chain multiplication of homogeneous transformation matrices: the head micro-motion deviation matrix is multiplied on the left by the homogeneous transformation matrix of the end-effector target pose in the pre-planned trajectory at the current moment to obtain the homogeneous transformation matrix of the new target pose. The physical meaning of the new target pose is: after the patient's head undergoes micro-motion, in order to keep the center of the treatment coil aligned with the original target point, the robotic arm's end effector needs to reach a new spatial position and a new spatial orientation. Since the target point is defined relative to the patient's head, when the patient's head translates and rotates, the position of the target point in the robotic arm's base coordinate system also changes. The new target pose reflects this changed target position and orientation. The new target pose contains three position components and three orientation components. The three position components determine the new spatial coordinates that the center of the treatment coil needs to reach. Two of the three orientation components determine the direction of the new cranial surface normal vector that the coil normal vector needs to align with. The remaining orientation component corresponds to the redundant parameter, namely the rotation angle of the coil around the normal axis.
[0095] The specific process for estimating the new medical safety subset is as follows: Based on the positional components in the new target pose, find the two nearest adjacent single target points in the redundant axis guide rails. These two adjacent single target points are located in front of and behind the new target pose, respectively. The rear single target point refers to the single target point with a smaller index in the sequence of target points to be treated, and the front single target point refers to the single target point with a larger index in the sequence of target points to be treated. Calculate the positional ratio of the new target pose between the two adjacent single target points. The positional ratio is defined as the distance from the new target pose to the front single target point divided by the distance from the front single target point to the rear single target point. Perform linear interpolation on the medical safety subset of the two adjacent single target points based on the positional ratio to obtain the new medical safety subset corresponding to the new target pose. The linear interpolation of the medical safety subset uses a linear combination method of interval boundaries. The interval boundaries of the new medical safety subset are calculated through linear interpolation, as shown in the following formula:
[0096]
[0097]
[0098] Where α is the position ratio, i.e., the ratio of the distance from the new target pose to the front target point to the distance between the front and rear target points, L is the lower bound of the interval, U is the upper bound of the interval, and the subscript "front / back" refers to the adjacent single target point in front or behind, respectively. When the new medical safety subset consists of multiple discontinuous intervals, the above linear interpolation operation is performed on each interval separately. The reason for adopting the linear interpolation strategy is that the complete calculation of the medical safety subset in step S14 involves multiple computationally intensive steps such as redundant parameter discretization sampling, collision detection, joint physical constraint screening, and jerk constraint screening. The complete calculation of a single target point usually takes tens of milliseconds, which cannot meet the millisecond-level response requirements of the real-time control cycle. The linear interpolation strategy makes full use of the continuity of motion state between adjacent single target points: since the spatial poses of adjacent single target points are extremely close, the corresponding robotic arm configurations are highly similar, and the boundary evolution of their collision constraints, physical limits, and kinematic constraints shows a smooth linear trend. Therefore, by linearly combining the medical safety subset boundaries of known adjacent single target points, a precise approximation of the safety range under the new target pose can be achieved at a computational cost in microseconds. Step S32 transforms the real-time micro-motion of the patient's head into the target adjustment requirements of the robotic arm's end effector and quickly estimates the range of safety redundancy parameters under the new target pose. This allows subsequent step S33 to generate fine-tuning joint commands under the correct safety boundary constraints, ensuring both the accuracy of end-effector following and the safety of redundancy parameter adjustment.
[0099] Step S33, see Figure 6The system reads the current feedback joint angle of the robotic arm, reverse-engineers the current actual redundancy parameters, and determines whether the actual redundancy parameters fall within the new medical safety subset. If the actual redundancy parameters fall within the new medical safety subset, the actual redundancy parameters remain unchanged, and the joint angle is finely adjusted to generate a fine-tuning joint command. If the actual redundancy parameters do not fall within the new medical safety subset, the system calculates the redundancy increment pointing to the center of the new medical safety subset and superimposes the zero-space motion corresponding to the redundancy increment into the compensation motion at the end of the robotic arm to generate a fine-tuning joint command. The fine-tuning joint command is then sent to the robotic arm for execution.
[0100] Specifically, the current feedback joint angles of the robotic arm are obtained by reading real-time data from the encoders built into its six joints. Each joint's high-precision photoelectric encoder can capture the rotational angular displacement of that joint relative to its initial zero point in real time and convert it into a digital signal output. The system synchronously collects these six independent sets of rotational angle information and encapsulates them into a six-dimensional vector according to the joint topology, thus constituting the current feedback joint angles of the robotic arm. The current actual redundancy parameters are obtained by performing forward kinematics calculations on the feedback joint angles and then inversely extrapolating them. The forward kinematics model is the fundamental model in robotic arm kinematics modeling, describing the mapping relationship from joint space to Cartesian space. By substituting the angle values of each joint into the chain multiplication formula of the homogeneous transformation matrix established based on the robotic arm's DH parameter table, the homogeneous transformation matrix of the end-effector coordinate system relative to the base coordinate system is calculated. The end-effector position coordinates and end-effector posture rotation matrix are extracted from the homogeneous transformation matrix of the end-effector coordinate system, and the normal vector direction of the treatment coil is calculated based on the end-effector posture rotation matrix. The current coil normal vector is compared with the skull surface normal vector corresponding to the new target pose in step S32. Both vectors are unit vectors and should be antiparallel so that the coil faces the head. The rotation angle required for the coil normal vector to rotate around the skull surface normal vector until it is completely antiparallel is the current actual redundancy parameter. The physical meaning of the actual redundancy parameter is: the rotation angle of the treatment coil around its normal axis relative to the reference pose under the robotic arm configuration corresponding to the current feedback joint angle. The calculated result of the actual redundancy parameter falls within a closed interval of -180 degrees to 180 degrees, which is consistent with the theoretical value range of the redundancy parameter in step S14.
[0101] The process of determining whether the actual redundant parameter falls within the new medical safety subset is as follows: traverse each continuous interval in the new medical safety subset estimated in step S32, and check whether the actual redundant parameter falls between the lower and upper bounds of any interval. If the actual redundant parameter is greater than or equal to the lower bound of an interval and less than or equal to the upper bound of that interval, then the actual redundant parameter is determined to fall within the new medical safety subset; if the actual redundant parameter does not meet the above conditions for any interval in the new medical safety subset, then the actual redundant parameter is determined not to fall within the new medical safety subset. When the actual redundant parameter falls within the new medical safety subset, the actual redundant parameter remains unchanged, and the joint angle is fine-tuned to generate fine-tuning joint commands. The generation of fine-tuning joint commands is implemented using the Jacobi pseudo-inverse matrix method. The Jacobi matrix describes the linear mapping relationship between joint angular velocity and end effector velocity, and is a core mathematical tool in robot kinematics. The Jacobi pseudo-inverse matrix is the generalized inverse matrix of the Jacobi matrix. The minimum norm joint velocity that satisfies the given end effector velocity requirement can be calculated using the Jacobi pseudo-inverse matrix. The specific calculation process for the fine-tuning joint command is as follows: The deviation vector of the end-effector position and attitude is calculated based on the difference between the new target pose and the current end-effector pose of the robotic arm. This deviation vector is multiplied by the Jacobian pseudo-inverse matrix to obtain the joint angle increment required to eliminate the deviation. This joint angle increment is then superimposed on the current feedback joint angle to obtain the fine-tuning joint command. Since the actual redundant parameters fall within the new medical safety subset, it indicates that the current robotic arm configuration is safe in terms of redundant parameters. No adjustment of redundant parameters is needed; only the joint angles need to be adjusted to compensate for the end-effector position deviation. This strategy minimizes the joint motion amplitude, allowing the robotic arm to complete end-effector following in the smoothest possible way.
[0102] When the actual redundancy parameters do not fall within the new medical safety subset, it is necessary to calculate the redundancy increment pointing to the center of the new medical safety subset and superimpose the null-space motion corresponding to the redundancy increment onto the joint angle increment corresponding to the end-effector compensation motion to generate fine-tuning joint commands. Null-space motion refers to motion along the null-space direction of the Jacobian matrix in joint space; this motion only changes the internal configuration of the robotic arm without altering the end-effector position or attitude. The calculation of the center of the new medical safety subset is the same as the calculation of the geometric center value in step S22: when the new medical safety subset contains only one continuous interval, the center value is equal to the arithmetic mean of the lower and upper bounds of the interval; when the new medical safety subset contains multiple discontinuous intervals, the center value is equal to the weighted average of the centers of each interval, with the weight being the proportion of each interval's length to the total length. The calculation of the redundancy increment pointing to the center of the new medical safety subset adopts a proportional control strategy: the redundancy increment is equal to the difference between the center value of the new medical safety subset and the actual redundancy parameter multiplied by the gain coefficient. The gain coefficient setting needs to balance the speed at which redundant parameters return to the center of the safe region with the smoothness of motion: an excessively large gain coefficient will cause the redundant parameters to change rapidly, triggering compensatory and violent movements of the joints; an excessively small gain coefficient will cause the redundant parameters to return too slowly, remaining at the edge of the safe region for a long time, with insufficient adjustment margin. For example, the gain coefficient can be set to 0.1, so that the redundant parameters gradually converge to the center of the safe region in an exponential decay manner.
[0103] The calculation of the null-space motion corresponding to the redundancy increment is based on the null-space vector of the Jacobian matrix. When a six-axis robotic arm performs a five-DOF end-effector task, the null space of the Jacobian matrix is a one-dimensional space. The joint motion corresponding to the null-space vector does not produce changes in the end-effector position and orientation, but only changes the internal configuration of the robotic arm, i.e., the redundancy parameters. The null-space vector is obtained by performing singular value decomposition on the Jacobian matrix, and the null-space vector is the right singular vector corresponding to zero singular values. The null-space motion corresponding to the redundancy increment is equal to the redundancy increment multiplied by the null-space vector, resulting in a six-dimensional joint angle increment vector. This vector, when superimposed on the current joint angle, only changes the redundancy parameters without changing the end-effector pose. The generation of fine-tuning joint commands involves superimposing the joint angle increment corresponding to the end-effector compensation motion with the joint angle increment corresponding to the null-space motion: the end-effector compensation joint angle increment calculated by the Jacobian pseudo-inverse matrix method is added to the joint angle increment of the null-space motion to obtain the total joint angle increment. The total joint angle increment is then superimposed on the current feedback joint angle to obtain the fine-tuning joint command. The superimposed fine-tuning joint commands can simultaneously achieve two goals: the end effector coil follows the patient's head movements to reach the new target pose, and the redundant parameters gradually move from the current unsafe value towards the center of the new safe medical subset. The superposition of zero-space motions does not affect the compensation accuracy of the end effector pose because the contribution of zero-space motion to the end effector space is zero; the two motion components add in the joint space but are orthogonal in the end effector space. Step S33 adopts a differentiated fine-tuning strategy by distinguishing the positional relationship between the actual redundant parameters and the new safe medical subset, ensuring that the robotic arm maintains the redundant parameters within the safe range while keeping the end effector following. When the actual redundant parameters fall within the safe range, a minimum motion strategy that only compensates for the end effector position is adopted, avoiding unnecessary adjustments to the redundant parameters, minimizing the joint movement amplitude, and resulting in smoother movement. When the actual redundant parameters exceed the safe range, zero-space motion slowly pulls the redundant parameters back to the center of the safe range, ensuring the safety of the redundant parameters while avoiding joint shock caused by rapid adjustments.
[0104] Step S34: When the robotic arm executes the fine-tuning joint command, read the joint torque sensor data to estimate the end contact force. If the end contact force exceeds the preset force threshold or the Euclidean distance corresponding to the head micro-motion deviation matrix exceeds the preset safety tracking threshold, trigger a soft emergency stop and control the robotic arm to retract a preset distance away from the patient.
[0105] Specifically, each joint of the collaborative six-axis robotic arm is equipped with a torque sensor. The torque sensor indirectly obtains the joint torque value by measuring the deformation of the joint's output shaft. The torque data is transmitted synchronously to the control system via an EtherCAT bus along with the joint angle data. The estimation of the end-effector contact force is based on the robotic arm's dynamic model. The robotic arm's dynamic model describes the mathematical relationship between joint torque and joint motion state, typically established using Lagrange mechanics or the Newton-Euler iterative method. According to the robotic arm's dynamic model, the joint torque can be decomposed into four components: inertial torque, Coriolis force and centrifugal torque, gravitational torque, and external torque. When the robotic arm's end-effector comes into contact with an external object, the torque generated by the contact force at each joint is the external torque component. The estimation process of the end-effector contact force is as follows: Based on the current feedback joint angle and its first and second derivatives, the sum of the three components—inertial torque, Coriolis force, centrifugal torque, and gravitational torque—is calculated using the robotic arm dynamics model. This calculated value is subtracted from the joint torque sensor measurement to obtain the external torque vector. The external torque vector is then transformed to the end-effector space using the transpose of the Jacobian matrix to obtain the end-effector contact force vector. The magnitude of the end-effector contact force vector is the scalar value of the end-effector contact force. Inertial parameters, friction parameters, etc., in the robotic arm dynamics model can be obtained through offline identification methods. This identification process is a standard procedure in robot calibration, and those skilled in the art can complete the parameter identification based on the structural characteristics of the robotic arm.
[0106] During transcranial magnetic stimulation (TMS) therapy, the treatment coil needs to be lightly pressed against the patient's skull surface to ensure effective magnetic field penetration. However, the contact force should not be too great to avoid compressing the patient's scalp and causing discomfort or injury. The preset force threshold is determined based on clinical medical experience and the pressure tolerance characteristics of human tissues; an exemplary setting is 2 Newtons. This force threshold ensures effective contact between the coil and the skull without causing significant discomfort to the patient. When the estimated end-effector contact force exceeds the preset force threshold, it indicates that the robotic arm end may be compressing the patient's scalp, posing a safety risk, and immediate protective measures are required. When the patient's head undergoes severe displacement, although the dynamic tracking compensation system can continuously calculate and compensate for the motion, the robotic arm's movement speed and acceleration have physical limits. When the patient's head displacement speed exceeds the robotic arm's maximum tracking speed, the end-effector coil will be unable to maintain synchronization with the head, and the relative position between the coil and the skull will continue to increase. The preset safe tracking threshold is set as the maximum head displacement range that the dynamic tracking compensation system can reliably follow. Beyond this range, the robotic arm's tracking ability is insufficient to guarantee treatment accuracy, requiring treatment to be paused and repositioned. The preset safety tracking threshold is determined based on the kinematic parameters of the robotic arm and the response speed of the control system, and can be set to between 5 mm and 10 mm for example.
[0107] The triggering conditions for a soft emergency stop are: the end-effector contact force exceeds a preset force threshold, or the Euclidean distance corresponding to the head micro-motion deviation matrix exceeds a preset safety tracking threshold. Either condition is met to trigger a soft emergency stop. The execution process of a soft emergency stop is as follows: the control system immediately stops sending fine-tuning joint commands to the robotic arm and instead sends a deceleration command to zero. This command requires each joint to smoothly reduce its speed to zero. After deceleration to zero, the control system sends a retraction command, requiring the end-effector of the robotic arm to move away from the patient's head. This retraction direction is defined as the opposite direction of the treatment coil normal vector, i.e., pointing towards the robotic arm base. After retraction, all joints of the robotic arm are locked to prevent any further movement commands from being executed. Simultaneously, an audible and visual alarm signal is issued to notify medical personnel to intervene. The difference between a soft emergency stop and a hard emergency stop is that a soft emergency stop is implemented through the software logic of the control system, and the joint motors remain under control, capable of performing orderly deceleration and retraction actions. A hard emergency stop is triggered by an external emergency stop button, directly cutting off the power supply to the joint motors. The joints are locked by mechanical brakes and cannot perform retraction actions. Soft emergency stop is suitable for situations where a safety risk is detected but no actual collision has occurred. It can protect the patient while keeping the robotic arm under control, facilitating subsequent recovery operations.
[0108] Step S30 establishes a real-time head micro-motion sensing mechanism, a rapid new medical safety subset estimation mechanism, an adaptive redundant parameter fine-tuning mechanism, and a force-controlled safety blocking logic based on multi-dimensional sensor feedback. This enables the robotic arm to dynamically follow the patient's head micro-motions and impose real-time safety constraints on redundant parameters during the treatment execution phase. This ensures that the treatment coil center remains aligned with the predetermined target point throughout the treatment process, guaranteeing both treatment accuracy and patient safety. Real-time calculation of the head micro-motion deviation matrix transforms the patient's head pose changes into a mathematical expression directly usable for motion compensation calculations, allowing the robotic arm to sense and respond to the patient's actual micro-motions within millisecond-level control cycles. The differentiated processing strategy for the positional relationship between actual redundant parameters and the new medical safety subset allows the robotic arm to adopt the optimal fine-tuning strategy under different conditions: when the actual redundant parameters fall within the safety zone, a minimum motion strategy that only compensates for the end-effector position is adopted, minimizing joint movement amplitude and maximizing motion smoothness; when the actual redundant parameters exceed the safety zone, zero-space motion is used to slowly pull the redundant parameters back to the center of the safety zone, ensuring collision safety and avoiding joint impact, achieving a dual guarantee of safety and smoothness. The end-effector contact force estimation and safe tracking range monitoring constitute the physical safety defense line in the real-time control phase. When the preceding mathematical and geometric constraints fail to prevent potential risks, force feedback can detect abnormalities in a timely manner and trigger protective actions, ensuring the absolute priority of patient safety. Step S30 upgrades the traditional open-loop trajectory execution to closed-loop dynamic control based on real-time perception, so that the robotic arm no longer rigidly executes the predetermined trajectory, but can adaptively adjust according to the real-time state of the patient's head and follow the patient's micro-movements. This feature is particularly important for long-term transcranial magnetic stimulation therapy, which can improve the patient's treatment experience and treatment effect. The multi-level safety protection system of step S30 forms a progressive safety guarantee chain from mathematical constraints, geometric constraints to physical contact detection: the new medical safety subset constrains the value range of redundant parameters to avoid collisions between the robotic arm links and the patient's head; the differentiated fine-tuning strategy ensures the smoothness of redundant parameter adjustment to avoid joint movement impact; end-effector contact force monitoring can detect abnormalities that compress the patient's scalp in a timely manner; safe tracking range monitoring can identify tracking failures caused by severe patient displacement; and soft emergency stop and retraction actions can immediately protect the patient when any safety risk is detected. This multi-layered safety protection system ensures that the transcranial magnetic stimulation therapy robotic arm meets the stringent safety standards for medical equipment, thus satisfying the need for patient safety in medical settings.
[0109] Example 2
[0110] This embodiment, based on Embodiment 1, provides a medical robotic arm coordination control system based on global redundancy optimization, such as... Figure 7 As shown, it includes:
[0111] Coordinate unification module: Collects MRI image data of the patient's head, establishes a multi-coordinate system-to-transformation chain from the image coordinate system to the robot arm base coordinate system; obtains the sequence of target points to be treated, generates a head collision detection mesh model based on the multi-coordinate system-to-transformation chain, determines the end-task constraints and defines redundant parameters for each single target point in the sequence of target points to be treated, discretizes and samples the redundant parameters to generate a set of candidate redundant parameters, and performs a three-level progressive screening of the candidate redundant parameter set based on the head collision detection mesh model to obtain the medical safety subset corresponding to each single target point;
[0112] Redundancy optimization module: used to calculate the redundancy transition intersection between the medical safety subsets of adjacent single targets in the sequence of targets to be treated, construct a redundancy configuration transition graph based on the redundancy transition intersection and calculate the global optimal redundancy parameter sequence, and generate joint space trajectory based on the global optimal redundancy parameter sequence;
[0113] Dynamic compensation module: used to calculate the new target pose that the robotic arm end needs to compensate for during the execution of joint space trajectory by the robotic arm, estimate the new medical safety subset corresponding to the new target pose; obtain the current actual redundancy parameters, and generate fine-tuning joint commands based on the positional relationship between the actual redundancy parameters and the new medical safety subset.
[0114] Furthermore, in the coordinate unification module, the method for establishing the multi-coordinate system-to-transformation chain includes:
[0115] Four anatomical landmarks were identified from the patient's head MRI images, and the physical space coordinates of four infrared reflective markers on the positioning cap were acquired. Rigid body transformation was performed to register the physical space coordinates of the four anatomical landmarks and the four infrared reflective markers, and the first transformation matrix from the image coordinate system to the head coordinate system was solved. The robotic arm was controlled to move to multiple non-coplanar poses, and a second transformation matrix between the robotic arm base coordinate system and the head coordinate system was established. The first transformation matrix and the second transformation matrix were combined to form a multi-coordinate system unified transformation chain from the image coordinate system to the robotic arm base coordinate system.
[0116] The method for generating the head collision detection mesh model includes:
[0117] The patient's head MRI image data is registered to the robot arm's base coordinate system using a multi-coordinate system transformation chain. The three-dimensional skin surface contour of the patient's head is extracted from the registered MRI image data. A head safety fence surface is formed by extending a preset safety distance outward along the outer normal direction of the three-dimensional skin surface contour. The head safety fence surface is then spatially meshed to generate a head collision detection mesh model.
[0118] Furthermore, in the redundancy optimization module, the calculation method for the redundant transition intersection includes:
[0119] Obtain the medical safety subset of the current single target in the sequence of targets to be treated and the medical safety subset of the next adjacent single target. Calculate the mathematical intersection of the two medical safety subsets as the redundant transition intersection. If the redundant transition intersection is empty, insert an auxiliary transition point between the two adjacent single targets as a new single target and add it to the sequence of targets to be treated. Calculate the medical safety subset of the auxiliary transition point. Continue until the redundant transition intersection of all adjacent single target pairs is not empty.
[0120] Each element in the global optimal redundancy parameter sequence is the target redundancy value at the corresponding single target point;
[0121] The method for calculating the globally optimal redundancy parameter sequence includes:
[0122] Define the backward transition center and the forward transition center for each single target in the sequence of targets to be treated. When the single target is neither the first nor the last single target, the target redundancy value of the single target is the arithmetic mean of the backward and forward transition centers. When the single target is the first single target, the target redundancy value is the geometric center value of the intersection of the redundant transitions between the first and second single targets. When the single target is the last single target, the target redundancy value is the geometric center value of the intersection of the redundant transitions between the last single target and its preceding adjacent single target. The target redundancy values of each single target are sequentially used to form the global optimal redundancy parameter sequence.
[0123] The methods and systems of this application may be implemented in many ways. For example, they may be implemented by software, hardware, firmware, or any combination of software, hardware, and firmware. The above-described order of steps for the method is for illustrative purposes only, and the steps of the method of this application are not limited to the order specifically described above, unless otherwise specifically stated.
[0124] In addition, the parts of the technical solutions provided in the embodiments of this application that are consistent with the implementation principles of the corresponding technical solutions in the prior art have not been described in detail, so as to avoid excessive elaboration.
[0125] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific embodiments of the present invention and are not intended to limit the invention. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A coordinated control method for a medical robotic arm based on global redundancy optimization, characterized in that, The method includes: The system collects MRI images of the patient's head and establishes a multi-coordinate system-to-transformation chain from the image coordinate system to the robot arm's base coordinate system. It obtains the sequence of target points to be treated and generates a head collision detection mesh model based on the multi-coordinate system-to-transformation chain. For each single target point in the sequence of target points to be treated, it determines the end-task constraints and defines redundant parameters. It discretizes and samples the redundant parameters to generate a set of candidate redundant parameters. Based on the head collision detection mesh model, it performs a three-level progressive screening of the candidate redundant parameter set to obtain the medical safety subset corresponding to each single target point. Calculate the redundant transition intersection between the medical safety subsets of adjacent single targets in the sequence of targets to be treated, construct a redundant configuration transition graph based on the redundant transition intersection and calculate the globally optimal redundant parameter sequence, and generate a joint space trajectory based on the globally optimal redundant parameter sequence. During the execution of the joint space trajectory by the robotic arm, the new target pose that the robotic arm end needs to compensate for is calculated, and the new medical safety subset corresponding to the new target pose is estimated; the current actual redundancy parameters are obtained, and fine-tuning joint commands are generated based on the positional relationship between the actual redundancy parameters and the new medical safety subset.
2. The medical robotic arm coordination control method based on global redundancy optimization according to claim 1, characterized in that, The method for establishing the transformation chain of the multi-coordinate system includes: Four anatomical landmarks were identified from the patient's head MRI images, and the physical spatial coordinates of four infrared reflective markers on the positioning cap were collected. The physical space coordinates of four image anatomical landmarks and four infrared reflective markers are registered by rigid body transformation, and the first transformation matrix from the image coordinate system to the head coordinate system is solved. Control the robotic arm to move to multiple non-coplanar poses, establish a second transformation matrix between the robotic arm base coordinate system and the head coordinate system, and combine the first transformation matrix and the second transformation matrix to form a multi-coordinate system unified transformation chain from the image coordinate system to the robotic arm base coordinate system.
3. The medical robotic arm coordination control method based on global redundancy optimization according to claim 2, characterized in that, The method for generating the head collision detection mesh model includes: The patient's head MRI image data is registered to the robot arm's base coordinate system using a multi-coordinate system transformation chain. The three-dimensional skin surface contour of the patient's head is extracted from the registered MRI image data. A head safety fence surface is formed by extending a preset safety distance outward along the outer normal direction of the three-dimensional skin surface contour. The head safety fence surface is then spatially meshed to generate a head collision detection mesh model.
4. The medical robotic arm coordination control method based on global redundancy optimization according to claim 3, characterized in that, The method for performing a three-level progressive screening of the candidate redundant parameter set includes: The candidate redundant parameter set is selected by collision screening using a head collision detection mesh model to obtain a feasible redundant parameter set. The feasible redundant parameter set is then selected by joint physical constraint screening and jerk constraint screening to obtain the medical safety subset corresponding to each single target point.
5. The medical robotic arm coordination control method based on global redundancy optimization according to claim 4, characterized in that, The method for calculating the redundant transition intersection includes: Obtain the medical safety subset of the current single target in the sequence of targets to be treated and the medical safety subset of the next adjacent single target. Calculate the mathematical intersection of the two medical safety subsets as the redundant transition intersection. If the redundant transition intersection is empty, insert an auxiliary transition point between the two adjacent single targets as a new single target to be treated and add it to the sequence of targets to be treated. Calculate the medical safety subset of the auxiliary transition point. Continue until the redundant transition intersection of all adjacent single target pairs is not empty.
6. The medical robotic arm coordination control method based on global redundancy optimization according to claim 5, characterized in that, Each element in the global optimal redundancy parameter sequence is the target redundancy value at the corresponding single target point; The method for calculating the globally optimal redundancy parameter sequence includes: The geometric center value of the redundant transition intersection is calculated. A backward transition center and a forward transition center are defined for each single target in the sequence of targets to be treated. When the single target is neither the first nor the last single target, the target redundancy value of the single target is the arithmetic mean of the backward and forward transition centers. When the single target is the first single target, the target redundancy value is the geometric center value of the redundant transition intersection between the first and second single targets. When the single target is the last single target, the target redundancy value is the geometric center value of the redundant transition intersection between the last single target and its preceding adjacent single target. The target redundancy values of each single target sequentially form a globally optimal redundancy parameter sequence from the first single target to the last single target.
7. The medical robotic arm coordination control method based on global redundancy optimization according to claim 6, characterized in that, The method for generating the joint space trajectory includes: Using time as the independent variable, a polynomial interpolation fitting is performed between the sequence of treatment target points and the globally optimal redundant parameter sequence. During the interpolation process, continuous acceleration boundary conditions and jerk constraints are set to generate continuous joint space trajectories.
8. The medical robotic arm coordination control method based on global redundancy optimization according to claim 7, characterized in that, The method for calculating the new target pose includes: Calculate the real-time head position and pose of the patient's head, and compare the real-time head position and pose with the initial head position and pose during planning to obtain the head micro-motion deviation matrix; The dynamic follow-up compensation mode is determined based on the head micro-motion deviation matrix. If the dynamic follow-up compensation mode is triggered, the new target pose is calculated based on the head micro-motion deviation matrix.
9. The medical robotic arm coordination control method based on global redundancy optimization according to claim 8, characterized in that, The method for generating fine-tuning joint commands based on the positional relationship between actual redundancy parameters and the new medical safety subset includes: Determine whether the actual redundant parameters fall within the new medical safety subset. If the actual redundant parameters fall within the new medical safety subset, keep the actual redundant parameters unchanged and fine-tune the joint angle to generate a fine-tuning joint command. If the actual redundant parameters do not fall within the new medical safety subset, calculate the redundancy increment pointing to the center of the new medical safety subset and generate a fine-tuning joint command based on the redundancy increment.
10. A medical robotic arm coordination control system based on global redundancy optimization, used to implement the medical robotic arm coordination control method based on global redundancy optimization as described in any one of claims 1-9, characterized in that, The system includes: Coordinate unification module: Collects MRI image data of the patient's head, establishes a multi-coordinate system-to-transformation chain from the image coordinate system to the robot arm base coordinate system; obtains the sequence of target points to be treated, generates a head collision detection mesh model based on the multi-coordinate system-to-transformation chain, determines the end-task constraints and defines redundant parameters for each single target point in the sequence of target points to be treated, discretizes and samples the redundant parameters to generate a set of candidate redundant parameters, and performs a three-level progressive screening of the candidate redundant parameter set based on the head collision detection mesh model to obtain the medical safety subset corresponding to each single target point; Redundancy optimization module: used to calculate the redundancy transition intersection between the medical safety subsets of adjacent single targets in the sequence of targets to be treated, construct a redundancy configuration transition graph based on the redundancy transition intersection and calculate the global optimal redundancy parameter sequence, and generate joint space trajectory based on the global optimal redundancy parameter sequence; Dynamic compensation module: used to calculate the new target pose that the robotic arm end needs to compensate for during the execution of joint space trajectory by the robotic arm, estimate the new medical safety subset corresponding to the new target pose; obtain the current actual redundancy parameters, and generate fine-tuning joint commands based on the positional relationship between the actual redundancy parameters and the new medical safety subset.