Environment and task multi-constraint oriented mechanical arm motion control method

By employing a sub-thread-based ROS2 event loop and MoveIt planning interface in the motion control of the robotic arm, unified constraints and closed-loop control were achieved, solving the problems of unstable execution of the robotic arm in complex environments and difficulty in reusing trajectory data, thus improving the stability of the system and the reusability of the data.

CN123169103APending Publication Date: 2026-11-27SICHUAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611521188.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-29
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

The existing robotic arm planning and execution chain lacks unified constraints and a unified closed loop, resulting in unstable execution in complex environments, untimely anomaly handling, difficulty in reusing trajectory data, and high costs for engineering debugging and repeated teaching.

Method used

The system adopts a sub-thread-based ROS2 event loop to manage the lifecycle of system nodes, and combines the MoveIt planning interface and TCP/IP channel to achieve unified multi-constraint planning. It monitors the status of the robotic arm in real time and generates structured trajectory data, forming a closed-loop link of target input, constraint modeling, planning solution, execution issuance, status feedback and data archiving.

Benefits of technology

It improves the operability and stability of the robotic arm in complex environments, realizes real-time linkage protection against anomalies and reusability of trajectory data, and reduces engineering debugging and repeated teaching costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123169103A_ABST
    Figure CN123169103A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of robot intelligent control, and discloses a mechanical arm motion control method for environment and task multi-constraints, which comprises the following steps: starting an event loop based on a sub-thread to host a system node life cycle, and obtaining an initialization ready state; receiving a mechanical arm task instruction according to the initialization ready state, and calling a unified multi-constraint planning interface to generate motion trajectory data meeting environment constraints; converting the motion trajectory data into control instructions through a communication channel, and issuing the control instructions to a mechanical arm controller, and reading physical state data fed back by the mechanical arm controller in real time; and performing closed-loop control and abnormal linkage protection according to the physical state data and a planning state. The application can complete target input, constraint modeling, planning solving, execution issuing, state feedback, abnormal processing and data archiving closed loop in the same system framework, can improve the executability in a complex scene, and can improve the stability and maintainability after engineering online.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of robot intelligent control technology, specifically relating to a motion control method for a robotic arm oriented towards multiple constraints of environment and task. Background Technology

[0002] While industrial robots have been rapidly adopted in manufacturing environments in recent years, a significant gap remains in the industry regarding executable planning in complex environments. Most teams can create visual paths using ROS2 (Robot Operating System 2) and MoveIt (a robot motion planning framework) during the R&D phase, but problems emerge once they are put into actual operation: some solutions only handle path finding, not execution safety; some can issue control commands but lack collision constraint modeling; and others can collect real-time data but lack a unified anomaly linkage mechanism. The result is that while individual modules may work, the overall system is unstable.

[0003] The aforementioned engineering path already reflects typical field requirements: On the one hand, the planning side needs to support both joint space and Cartesian space inputs and be able to dynamically load obstacle models; on the other hand, the physical side needs to be stably connected through the controller channel and continuously determine alarm and motion states during operation; furthermore, the upper layer also needs to precipitate process data into reusable trajectory files for subsequent playback and process solidification. In other words, individual capabilities are not scarce; what is truly scarce is the method to connect these capabilities into a reliable link.

[0004] Currently, the following implementation path is typically used in the planning and execution chain of robotic arms:

[0005] (1) Pure control interface path: The system establishes a connection through the vendor's protocol port, accepts user input, and directly issues joint or Cartesian motion commands, and then uses a polling method to determine whether it is in place. This method has a low deployment threshold and short-path tasks can be quickly launched, but due to the lack of unified collision scenario modeling, when working near derricks, narrow workstations, or irregularly shaped workpieces, manual trial and error is often required.

[0006] (2) Pure simulation path planning: The system completes target setting, path solving and RViz (ROS visualization tool) display in MoveIt. If necessary, algorithm modules such as OMPL (Open Motion Planning Library) are added to improve the solution effect. This route is friendly to R&D personnel and the path quality is usually high. However, the pain point in engineering is that the success of simulation cannot be applied to actual problems: factors such as controller status, network fluctuations, thread abnormalities, and equipment alarms during entity execution are not naturally incorporated into the simulation link.

[0007] (3) Patchwork hybrid path: This involves splitting the UI (human-machine interface), planning, control, and data storage into multiple independent programs, which communicate via files or temporary messages. This approach may seem flexible at first, but it is prone to problems in the long run due to asynchronous interface evolution. For example, the planning version and the execution version may be inconsistent, abnormal states may be difficult to broadcast across modules, and inconsistent trajectory data formats may lead to reproduction failures.

[0008] In summary, the aforementioned robotic arm planning and execution methods all lack a systematic design with unified constraints and a unified closed loop. The first key flaw is the fragmented constraint entry points: task objectives, obstacle constraints, and execution status are often handled separately by different modules, leading to seemingly feasible trajectories in the planning phase only revealing unreachable or risky actions in the execution phase. The root cause is the lack of interconnected verification of constraints within the same process, resulting in passively prolonged engineering debugging time and results relying on experience rather than mechanisms. The second flaw is the broken anomaly handling chain: many systems only provide error messages after execution failure, instead of continuously monitoring controller alarms, node exits, thread interruptions, etc., and immediately triggering shutdowns. The direct consequence of lacking such online closed loops is the spread of anomalies: at best, task interruptions; at worst, equipment risks or process losses. For the field, anomalies are not terrible; what is terrible is uncontrolled anomalies. The third flaw is weak data accumulation capabilities: many solutions only save final location data or temporary logs, lacking standard trajectory files organized by time sequence, causing process reproduction to rely on manual recall and repeated teaching, unable to support large-scale iteration. Looking further, this is also why many projects, after being successfully piloted, are difficult to replicate on more production lines: data is not reusable, and experience is difficult to transfer. Summary of the Invention

[0009] To address the aforementioned shortcomings in existing technologies, this invention provides a robotic arm motion control method oriented towards multiple environmental and task constraints. This method can complete the closed loop of target input, constraint modeling, planning and solving, execution and dispatch, status feedback, exception handling and data archiving within the same system framework. This not only improves the executability in complex scenarios but also enhances the stability and maintainability after the project goes live.

[0010] To achieve the above-mentioned objectives, the technical solution adopted by this invention is as follows:

[0011] A method for controlling the motion of a robotic arm under multiple environmental and task constraints includes the following steps:

[0012] Start a sub-thread-based event loop to manage the lifecycle of system nodes and obtain an initialized ready state;

[0013] Based on the initialization ready state, the robot arm receives the task instruction and calls the unified multi-constraint planning interface to generate motion trajectory data that meets environmental constraints.

[0014] The motion trajectory data is converted into control commands through the communication channel and sent to the robotic arm controller, and the physical state data fed back by the robotic arm controller is read back in real time;

[0015] Closed-loop control and abnormal linkage protection are executed based on the physical state data and the planned state.

[0016] Furthermore, a sub-thread-based event loop is started to manage the system node lifecycle, obtaining an initialized ready state, including:

[0017] Create and start a child thread that is independent of the main thread within the main thread;

[0018] An event loop runs in the sub-thread, which takes over the lifecycle of the robot operating system node's creation, communication, and destruction, and generates the initialization ready state.

[0019] Furthermore, before calling the unified multi-constraint planning interface to generate motion trajectory data that satisfies environmental constraints, the following steps are included:

[0020] The input robotic arm task instructions are parsed by calling the unified multi-constraint planning interface;

[0021] If the task instruction includes the target end pose, then the Euler angles in the target end pose are converted into quaternions to obtain the standard target pose.

[0022] Based on the standard target pose, combined with the environmental collision constraint model in the current scene and the preset joint limit and speed limit execution safety boundary, a standardized planning request is constructed.

[0023] Furthermore, generating motion trajectory data that satisfies environmental constraints by calling the unified multi-constraint planning interface includes:

[0024] Configure the kinematics solver and sampling path planning algorithm by calling the MoveGroup planning interface;

[0025] The target pose, current environmental collision constraints, and execution safety boundary in the robotic arm task command are passed as input parameters to the MoveGroup planning interface.

[0026] The MoveGroup planning interface is used to call the sampling path planning algorithm to search for a collision-free path, and the kinematic solver is called to perform inverse kinematics calculation, outputting a joint space interpolation sequence containing timestamps as the motion trajectory data.

[0027] Furthermore, generating motion trajectory data that satisfies environmental constraints by calling the unified multi-constraint planning interface also includes:

[0028] Upon receiving an environment update command, the system performs dynamic addition, deletion, or pose update operations on the collider models in the current scene; wherein, the pose update is achieved by resetting the collider pose and reapplying the collider model to the planned scene.

[0029] The updated collision model data is synchronized to the planning scene, and collision detection is performed based on the updated environmental collision constraint model in subsequent planning requests.

[0030] Furthermore, the motion trajectory data is converted into control commands via a communication channel and sent to the robotic arm controller, and the physical state data fed back by the robotic arm controller is read back in real time, including:

[0031] The joint position, joint angle, velocity, and acceleration parameters in the motion trajectory data are packaged according to the protocol format supported by the robotic arm controller to obtain the control command;

[0032] The control commands are sent to the robotic arm controller via a network channel;

[0033] According to the preset polling frequency, the data packets returned by the robotic arm controller are received through the network channel and unpacked and parsed to extract the physical state data containing the actual joint angles and alarm codes.

[0034] Furthermore, converting the motion trajectory data into control commands via a communication channel and sending them to the robotic arm controller also includes:

[0035] According to the preset sampling period, the real-time angle sequence of the physical joints fed back by the robotic arm controller is collected;

[0036] Based on the real-time angle sequence and the metadata of the current task, a structured trajectory file containing metadata fields and joint sequence fields is generated and exported to local storage; wherein the metadata of the current task includes sampling timestamp, angle unit, number of joints, and sampling interval.

[0037] Furthermore, generating a structured trajectory file containing metadata fields and joint sequence fields based on the real-time angle sequence and the metadata of the current task includes:

[0038] The structured trajectory file is constructed using JSON format;

[0039] Create metadata fields and joint sequence fields under the root node in the JSON format;

[0040] Write the sampling timestamp, angle unit, number of joints, and sampling interval into the metadata field, and / or write the task identifier, initial pose, or target pose into the metadata field; write the array of joint angles arranged in the sampling order into the joint sequence field.

[0041] Furthermore, the execution of closed-loop control and abnormal linkage protection based on the physical state data and planning state includes:

[0042] Start the planning status monitoring thread, motion status monitoring thread, and controller anomaly monitoring thread to run in parallel;

[0043] The planning status monitoring thread monitors the interruptible status and node running status of the planning process.

[0044] The motion state monitoring thread determines whether the robotic arm is in motion based on the real-time changes in joint angles and end-effector pose in previous and subsequent frames.

[0045] The alarm status of the robotic arm controller is monitored through the controller anomaly monitoring thread.

[0046] Furthermore, the execution of closed-loop control and abnormal linkage protection based on the physical state data and planning state also includes:

[0047] When the planning status monitoring thread, motion status monitoring thread, or controller anomaly monitoring thread detects a preset abnormal condition, the anomaly linkage protection mechanism is triggered.

[0048] The preset abnormal conditions include hardware alarms fed back by the robotic arm controller, abnormal or lost communication channels, abnormal exit of system nodes, or threads receiving stop requests.

[0049] The abnormal linkage protection mechanism includes sending a stop and enable command to the robotic arm controller, terminating the transmission of current motion trajectory data, and performing resource reclamation of system memory and communication ports.

[0050] The present invention has the following beneficial effects:

[0051] In terms of executability, this invention processes task objectives, obstacle constraints, and attitude transformations at the same planning entry point, significantly reducing the probability that simulation-feasible scenarios may not be feasible in practice, making it particularly suitable for complex environments such as derricks and narrow workstations. In terms of controllability, by superimposing parallel threads of planning monitoring and motion monitoring with controller anomaly monitoring, a closed-loop protection mechanism is formed during operation. When an anomaly occurs, manual intervention is no longer required, and loss-mitigation actions such as shutdown and de-enabling are automatically executed. In terms of reusability, a standardized trajectory export structure is provided, allowing a single execution process to be completely captured and used for subsequent playback, auditing, and process optimization, significantly reducing the cost of repeated teaching and debugging. Attached Figure Description

[0052] Figure 1 This is a schematic diagram of the underlying interface for motion planning of an integrated robotic arm with multiple environment-task constraints, which is compatible with the present invention.

[0053] Figure 2 This is a schematic diagram of a robotic arm motion control method oriented towards multiple environmental and task constraints according to the present invention.

[0054] Figure 3 This is a flowchart of the ROS event loop encapsulation based on sub-threads in this invention;

[0055] Figure 4 This is a diagram of the robotic arm motion planning interface based on the MoveIt encapsulation of this invention;

[0056] Figure 5 This is a flowchart of the program for the initialization phase of the physical robotic arm connection in this invention;

[0057] Figure 6 This is a flowchart of the motion control program for the physical robotic arm in this invention.

[0058] Figure 7 This is a flowchart of the simulation data export process in this invention. Detailed Implementation

[0059] The specific embodiments of the present invention are described below to enable those skilled in the art to understand the present invention. However, it should be understood that the present invention is not limited to the scope of the specific embodiments. For those skilled in the art, various changes are obvious as long as they are within the spirit and scope of the present invention as defined and determined by the appended claims. All inventions utilizing the concept of the present invention are protected.

[0060] This invention provides a method to solve the problems of "the planning results of a robotic arm are usable in complex environments, but unstable when executed by the actual entity; the inability to uniformly manage obstacle constraints and task constraints; the difficulty in timely closed-loop handling of operational anomalies; and the high cost of trajectory reuse and tracing." The principle of this method is to unify the orchestration of the simulation planning layer, collision constraint layer, real-time state layer, and entity control layer, forming a closed-loop link within the same operational framework: target input → constraint modeling → planning solution → execution deployment → state feedback → anomaly handling → data archiving. The key points of this invention are: using the ROS2 (Robot Operating System 2) event loop based on sub-threads as the system scheduling foundation; using the MoveGroup interface encapsulated by MoveIt (robotic arm motion planning framework) as the planning core; using TCP / IP (Transmission Control Protocol / Internet Protocol) channels to achieve linkage between the entity robotic arm controller; simultaneously using parallel monitoring threads to achieve dual monitoring of planning and entity states; and exporting trajectory data in a standardized JSON format.

[0061] Unlike the fragmented approach commonly used today, where simulation is done manually, control is handled manually, and data is stored in temporary files, this invention emphasizes an integrated, engineering-ready implementation path. Upon receiving the target joint angle or end-effector pose, this invention first processes environmental collisions, attitude conversion, path reachability, and execution safety boundaries within a unified process. Then, the validated planning results are passed to the physical actuator. During execution, joint angles and end-effector poses are continuously read back. If a controller alarm, node anomaly, or thread exit condition is detected, a shutdown and resource reclamation mechanism is immediately triggered. Thus, it retains MoveIt's planning capabilities while supplementing the stable execution, anomaly response, and trajectory traceability capabilities most valued in industrial settings.

[0062] like Figure 1 As shown, this invention first receives user target data, which can be a set of joint angles or a set of end-effector poses. Then, it enters the pre-processing stage for planning, where the target dimension, unit, and pose representation are uniformly verified and transformed, and the current environmental constraints are loaded synchronously. Next, the MoveGroup interface is called to initiate a solution, with collision detection jointly performed by FCL (Flexible Collision Library, a 3D collision detection library) and the planning scene. If the solution is successful, the trajectory results are sent to the robotic arm controller and simultaneously displayed in RViz. During execution, joint angles and end-effector poses are continuously read back, while the controller status and node status are monitored. If abnormal conditions occur, the thread execution stops, is deenabled, logs are output, and the thread exits. After the task is completed, the process data is written to a structured JSON file. This process forms a closed-loop chain: target input → constraint modeling → planning solution → execution → status feedback → exception handling → data archiving.

[0063] like Figure 2 As shown, an embodiment of the present invention provides a robotic arm motion control method oriented towards multiple environmental and task constraints, comprising the following steps S1 to S4:

[0064] S1. Start a sub-thread-based event loop to manage the lifecycle of system nodes and obtain the initialization ready state.

[0065] In an optional embodiment of the present invention, step S1 initiates a sub-thread-based event loop to manage the lifecycle of system nodes and obtains an initialization-ready state, including:

[0066] Create and start a child thread that is independent of the main thread within the main thread;

[0067] An event loop runs in the sub-thread, which takes over the lifecycle of the robot operating system node's creation, communication, and destruction, and generates the initialization ready state.

[0068] like Figure 3 As shown, this embodiment encapsulates the ROS event loop into a dedicated sub-thread to avoid the main thread being blocked by ROS event handling. After creating a node object, the necessary subscription and publish object initialization is completed during the construction phase before starting the event loop thread. Internally, the thread adopts a pattern of: processing one round of events → brief sleep → continuing processing, ensuring both real-time event handling and reducing CPU usage. During the stopping phase, a stop token is used to request the thread to exit, and resource reclamation and node shutdown are completed during the destruction phase. The core value of this encapsulation lies in its controllable lifecycle; that is, when a node starts, when it stops, and whether it is still running can all be managed uniformly by the upper layer. For applications that need to run UI interactions, task planning, and real-time data updates simultaneously, this mechanism can significantly improve system stability.

[0069] S2. Receive the robotic arm task instruction according to the initialization ready state, and call the unified multi-constraint planning interface to generate motion trajectory data that meets environmental constraints;

[0070] In an optional embodiment of the present invention, before step S2 calls the unified multi-constraint planning interface to generate motion trajectory data that satisfies environmental constraints, the following is included:

[0071] The input robotic arm task instructions are parsed by calling the unified multi-constraint planning interface;

[0072] If the task instruction includes the target end pose, then the Euler angles in the target end pose are converted into quaternions to obtain the standard target pose.

[0073] Based on the standard target pose, combined with the environmental collision constraint model in the current scene and the preset joint limit and speed limit execution safety boundary, a standardized planning request is constructed.

[0074] Step S2 calls the unified multi-constraint planning interface to generate motion trajectory data that satisfies environmental constraints, including:

[0075] Configure the kinematics solver and sampling path planning algorithm by calling the MoveGroup planning interface;

[0076] The target pose, current environmental collision constraints, and execution safety boundary in the robotic arm task command are passed as input parameters to the MoveGroup planning interface.

[0077] The MoveGroup planning interface is used to call the sampling path planning algorithm to search for a collision-free path, and the kinematic solver is called to perform inverse kinematics calculation, outputting a joint space interpolation sequence containing timestamps as the motion trajectory data.

[0078] Step S2, which calls the unified multi-constraint planning interface to generate motion trajectory data that satisfies environmental constraints, also includes:

[0079] Upon receiving an environment update command, the system performs dynamic addition, deletion, or pose update operations on the collider models in the current scene; wherein, the pose update is achieved by resetting the collider pose and reapplying the collider model to the planned scene.

[0080] The updated collision model data is synchronized to the planning scene, and collision detection is performed in subsequent planning requests based on the updated environmental collision constraint model.

[0081] like Figure 4 As shown, this embodiment employs a unified multi-constraint planning interface that supports both target joint angle and target end-effector pose calculations. During pose planning, the conversion between Euler angles and quaternions is first performed, and then the position units are unified to the scale required by the planner before solving. In this embodiment, an existing motion planning algorithm is called from the Open Motion Planning Library (OMPL) to obtain a collision-free configuration space path (i.e., collision-free path search). The MoveGroup planning interface then performs inverse kinematics calculations using an existing kinematics solver to obtain the joint angles. Upon successful solution, the trajectory is published to RViz for synchronous display and execution; if the solution fails, an error code is returned and the failure context is retained for retrying or parameter modification by the upper layer.

[0082] This embodiment employs collision management to dynamically add, delete, and update the pose of obstacles during runtime. Obstacle geometry can be loaded from an STL mesh model, and attributes such as pose, name, and color can be set before being written into the planning scene. When the position or orientation of an obstacle changes, its pose can be reset and reapplied to the planning scene. For frequently changing tooling, fixtures, or temporary obstacles on-site, this mechanism avoids restarting the system with each modification. Compared to static scene files, dynamic management better reflects the rhythm of a real production line.

[0083] S3. The motion trajectory data is converted into control commands through the communication channel and sent to the robotic arm controller, and the physical state data fed back by the robotic arm controller is read back in real time.

[0084] In an optional embodiment of the present invention, step S3 converts the motion trajectory data into control commands via a communication channel and sends them to the robotic arm controller, and reads back the physical state data fed back by the robotic arm controller in real time, including:

[0085] The joint position, joint angle, velocity, and acceleration parameters in the motion trajectory data are packaged according to the protocol format supported by the robotic arm controller to obtain the control command;

[0086] The control commands are sent to the robotic arm controller via a network channel;

[0087] According to the preset polling frequency, the data packets returned by the robotic arm controller are received through the network channel and unpacked and parsed to extract the physical state data containing the actual joint angles and alarm codes.

[0088] Step S3, which converts the motion trajectory data into control commands via the communication channel and sends them to the robotic arm controller, further includes:

[0089] According to the preset sampling period, the real-time angle sequence of the physical joints fed back by the robotic arm controller is collected;

[0090] Based on the real-time angle sequence and the metadata of the current task, a structured trajectory file containing metadata fields and joint sequence fields is generated and exported to local storage; wherein the metadata of the current task includes sampling timestamp, angle unit, number of joints, sampling interval, etc.

[0091] The generation of a structured trajectory file containing metadata fields and joint sequence fields based on the real-time angle sequence and the metadata of the current task includes:

[0092] The structured trajectory file is constructed using JSON format;

[0093] Create metadata fields and joint sequence fields under the root node in the JSON format;

[0094] The sampling timestamp, angle unit, number of joints, sampling interval, etc. are written into the metadata field. Optionally, the task identifier, initial pose, or target pose can also be written into the metadata field. The array of joint angles arranged in the sampling order is written into the joint sequence field.

[0095] S4. Execute closed-loop control and abnormal linkage protection based on the physical state data and planning state.

[0096] In an optional embodiment of the present invention, step S4, which executes closed-loop control and abnormal linkage protection based on the physical state data and the planning state, includes:

[0097] Start the planning status monitoring thread, motion status monitoring thread, and controller anomaly monitoring thread to run in parallel;

[0098] The planning status monitoring thread monitors the interruptible status and node running status of the planning process.

[0099] The motion state monitoring thread determines whether the robotic arm is in motion based on the real-time changes in joint angles and end-effector pose in previous and subsequent frames.

[0100] The alarm status of the robotic arm controller is monitored through the controller anomaly monitoring thread.

[0101] Step S4, which involves executing closed-loop control and anomaly linkage protection based on the physical state data and planning state, further includes:

[0102] When the planning status monitoring thread, motion status monitoring thread, or controller anomaly monitoring thread detects a preset abnormal condition, the anomaly linkage protection mechanism is triggered.

[0103] The preset abnormal conditions include hardware alarms fed back by the robotic arm controller, abnormal or lost communication channels, abnormal exit of system nodes, or threads receiving stop requests.

[0104] The abnormal linkage protection mechanism includes sending a stop and enable command to the robotic arm controller, terminating the transmission of current motion trajectory data, and performing resource reclamation of system memory and communication ports.

[0105] This embodiment sets up three types of monitoring logic: planning status monitoring, motion status monitoring, and controller anomaly monitoring. Planning status monitoring is used to proactively stop planning when an anomaly is detected and the planning process has not yet ended. Motion status monitoring determines whether the robotic arm is in motion by sampling changes in joint angles and end-effector pose between consecutive frames at fixed intervals; if any dimension exceeds a change threshold, it is determined that the arm is still in motion, and the results are provided to the trajectory recording thread and the interface. Controller anomaly monitoring detects controller alarm status during the operation of the physical robotic arm and, upon alarm occurrence, executes shutdown, disables enable, and outputs alarm information.

[0106] This embodiment employs a three-channel mechanism for communication on the physical side: the Dashboard channel for control and status commands, the Move channel for motion commands, and the Feedback channel for feedback information. Upon startup, the network initialization status is checked first, and then connections are established one by one for each channel. If any channel fails, a disconnection and retry are performed to prevent unfavorable connection states from entering the operational phase. After a successful connection, a pre-enablement check is performed: if the device is detected to be in an alarm state, error cleanup is performed before proceeding to the enable process. After enabling, the system waits until the device enters an executable state, and then the exception monitoring thread is started.

[0107] like Figure 5 As shown, the responsibility of the controller's anomaly monitoring thread is not to provide post-event alerts, but to intercept anomalies in real time: when the thread detects that the robotic arm is running and an alarm has occurred, it immediately triggers a stop action and executes the enable and alarm information output to prevent the risk from spreading further. Compared with the traditional approach of checking after execution, this mechanism can significantly shorten the anomaly response path.

[0108] like Figure 6As shown, this embodiment supports two types of control inputs when executing control commands: joint motion and Cartesian motion. First, upon receiving the planned target, it is converted into a data structure recognizable by the controller, and then the command is issued through the motion channel. During this process, it can also be determined whether blocking or waiting is necessary. For scenarios with high cycle time requirements and allowing concurrent orchestration, a non-blocking mode can be used, returning immediately after the command is issued, allowing the upper-level process to continue handling other tasks. For scenarios with high safety requirements or strong dependencies on process steps, blocking and waiting can be used to ensure step closure. This strategy balances throughput and determinism under different operating conditions.

[0109] For tasks that require blocking and waiting, enter the positioning determination loop, periodically read the real-time joint angles or real-time poses, and compare them with the target values ​​according to the error threshold; when all dimensions fall within the tolerance range, the positioning is determined and the waiting is exited.

[0110] like Figure 7 As shown, this embodiment also includes a trajectory recording thread. After the user triggers a recording event, it enters a standby listening state. When the robotic arm is detected to be in motion, sampling automatically begins. The sampled data, centered on the joint sequence, is written to the memory structure at fixed intervals and then written to disk all at once after the movement stops. Each file contains two parts: metadata and trajectory data. The metadata records timestamps, units, number of joints, sampling intervals, etc.; the trajectory data is stored in ordered record groups for each frame's joint angle. Filenames are named using timestamps and can be directly sorted lexicographically for batch playback. This mechanism solves the problem of only seeing the execution result but not the execution process. For process verification, problem review, and cross-device migration, process trajectories are more valuable than single-point results.

[0111] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0112] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0113] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0114] Specific embodiments have been used to illustrate the principles and implementation methods of this invention. The descriptions of the embodiments above are only for the purpose of helping to understand the method and core ideas of this invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this invention. Therefore, the content of this specification should not be construed as a limitation of this invention.

[0115] Those skilled in the art will recognize that the embodiments described herein are intended to help the reader understand the principles of the invention, and should be understood that the scope of protection of the invention is not limited to such specific statements and embodiments. Those skilled in the art can make various other specific modifications and combinations based on the technical teachings disclosed in this invention without departing from the spirit of the invention, and these modifications and combinations are still within the scope of protection of this invention.

Claims

1. A method for controlling the motion of a robotic arm under multiple environmental and task constraints, characterized in that, Includes the following steps: Start a sub-thread-based event loop to manage the lifecycle of system nodes and obtain an initialized ready state; Based on the initialization ready state, the robot arm receives the task instruction and calls the unified multi-constraint planning interface to generate motion trajectory data that meets environmental constraints. The motion trajectory data is converted into control commands through the communication channel and sent to the robotic arm controller, and the physical state data fed back by the robotic arm controller is read back in real time; Closed-loop control and abnormal linkage protection are executed based on the physical state data and the planned state.

2. The robotic arm motion control method oriented towards multiple environmental and task constraints according to claim 1, characterized in that, Start a sub-thread-based event loop to manage the system node lifecycle and obtain the initialization ready state, including: Create and start a child thread that is independent of the main thread within the main thread; An event loop runs in the sub-thread, which takes over the lifecycle of the robot operating system node's creation, communication, and destruction, and generates the initialization ready state.

3. The robotic arm motion control method oriented towards multiple environmental and task constraints according to claim 1, characterized in that, Before calling the unified multi-constraint planning interface to generate motion trajectory data that meets environmental constraints, the following steps are required: The input robotic arm task instructions are parsed by calling the unified multi-constraint planning interface; If the task instruction includes the target end pose, then the Euler angles in the target end pose are converted into quaternions to obtain the standard target pose. Based on the standard target pose, combined with the environmental collision constraint model in the current scene and the preset joint limit and speed limit execution safety boundary, a standardized planning request is constructed.

4. The robotic arm motion control method oriented towards multiple environmental and task constraints according to claim 3, characterized in that, Generating motion trajectory data that satisfies environmental constraints by calling the unified multi-constraint planning interface includes: Configure the kinematics solver and sampling path planning algorithm by calling the MoveGroup planning interface; The target pose, current environmental collision constraints, and execution safety boundary in the robotic arm task command are passed as input parameters to the MoveGroup planning interface. The MoveGroup planning interface is used to call the sampling path planning algorithm to search for a collision-free path, and the kinematic solver is called to perform inverse kinematics calculation, outputting a joint space interpolation sequence containing timestamps as the motion trajectory data.

5. The robotic arm motion control method oriented towards multiple environmental and task constraints according to claim 4, characterized in that, Generating motion trajectory data that satisfies environmental constraints by calling the unified multi-constraint planning interface also includes: Upon receiving an environment update command, the system performs dynamic addition, deletion, or pose update operations on the collider models in the current scene; wherein, the pose update is achieved by resetting the collider pose and reapplying the collider model to the planned scene. The updated collision model data is synchronized to the planning scene, and collision detection is performed based on the updated environmental collision constraint model in subsequent planning requests.

6. The robotic arm motion control method oriented towards multiple environmental and task constraints according to claim 1, characterized in that, The motion trajectory data is converted into control commands via a communication channel and sent to the robotic arm controller. The physical state data fed back by the robotic arm controller is also read back in real time, including: The joint position, joint angle, velocity, and acceleration parameters in the motion trajectory data are packaged according to the protocol format supported by the robotic arm controller to obtain the control command; The control commands are sent to the robotic arm controller via a network channel; According to the preset polling frequency, the data packets returned by the robotic arm controller are received through the network channel and unpacked and parsed to extract the physical state data containing the actual joint angles and alarm codes.

7. The robotic arm motion control method oriented towards multiple environmental and task constraints according to claim 1, characterized in that, The process of converting the motion trajectory data into control commands via a communication channel and sending them to the robotic arm controller also includes: According to the preset sampling period, the real-time angle sequence of the physical joints fed back by the robotic arm controller is collected; Based on the real-time angle sequence and the metadata of the current task, a structured trajectory file containing metadata fields and joint sequence fields is generated and exported to local storage; wherein the metadata of the current task includes sampling timestamp, angle unit, number of joints, and sampling interval.

8. The robotic arm motion control method oriented towards multiple environmental and task constraints according to claim 7, characterized in that, Based on the real-time angle sequence and the metadata of the current task, a structured trajectory file containing metadata fields and joint sequence fields is generated, including: The structured trajectory file is constructed using JSON format; Create metadata fields and joint sequence fields under the root node in the JSON format; Write the sampling timestamp, angle unit, number of joints, and sampling interval into the metadata field, and / or write the task identifier, initial pose, or target pose into the metadata field; write the array of joint angles arranged in the sampling order into the joint sequence field.

9. The robotic arm motion control method oriented towards multiple environmental and task constraints according to claim 1, characterized in that, Executing closed-loop control and abnormal linkage protection based on the physical state data and planning state includes: Start the planning status monitoring thread, motion status monitoring thread, and controller anomaly monitoring thread to run in parallel; The planning status monitoring thread monitors the interruptible status and node running status of the planning process. The motion state monitoring thread determines whether the robotic arm is in motion based on the real-time changes in joint angles and end-effector pose in previous and subsequent frames. The alarm status of the robotic arm controller is monitored through the controller anomaly monitoring thread.

10. The robotic arm motion control method oriented towards multiple environmental and task constraints according to claim 9, characterized in that, The implementation of closed-loop control and abnormal linkage protection based on the physical state data and planning state also includes: When the planning status monitoring thread, motion status monitoring thread, or controller anomaly monitoring thread detects a preset abnormal condition, the anomaly linkage protection mechanism is triggered. The preset abnormal conditions include hardware alarms fed back by the robotic arm controller, abnormal or lost communication channels, abnormal exit of system nodes, or threads receiving stop requests. The abnormal linkage protection mechanism includes sending a stop and enable command to the robotic arm controller, terminating the transmission of current motion trajectory data, and performing resource reclamation of system memory and communication ports.