ROS2-based multi-task real-time scheduling and interface adaptation system
By using a ROS2-based distributed node structure and multi-agent reinforcement learning algorithm, combined with DDS communication, the task scheduling of a multi-robot system was optimized, solving the problems of scheduling delay and scheduling imbalance, and achieving efficient task allocation and real-time response.
Patent Information
- Application Number
- CN202511449046.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-11
- Publication Date
- 2026-01-23
AI Technical Summary
In scenarios with multiple robots or multiple workstations, existing scheduling systems experience increased task scheduling latency, failing to meet the demands for real-time parallel execution. In particular, they are prone to response delays and scheduling imbalances when dynamic switching and path conflicts are frequent.
A distributed node structure based on ROS2 is adopted, which combines multi-agent reinforcement learning and distributed model predictive control algorithm to optimize task allocation and path planning. Data transmission is carried out through DDS communication mechanism, eliminating the centralized master control node and dynamically adjusting the scheduling strategy.
It enables adaptive task allocation and timing optimization in multi-robot, multi-workstation scenarios, reduces the computational pressure on the central control system, improves the real-time performance and scheduling efficiency of the system, and avoids task scheduling lag and limited parallel task execution.
Smart Images

Figure CN121396984A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of intelligent scheduling and communication technology, in particular to a multi-task real-time scheduling and interface adaptation system based on ROS2. BACKGROUND
[0002] With the rapid development of intelligent manufacturing and smart warehousing systems, the number of automated devices in the production field has increased dramatically. Robots, mechanical arms, conveying devices and sorting units from different manufacturers usually use their own independent communication protocols and control architectures. Most current scheduling systems use a centralized task control structure, in which all task allocation, path planning and state monitoring are completed by a single master node. When multiple robots or multi-station devices are connected to the system, the computational and communication load of the master node increases dramatically, leading to increased task scheduling delays and inability to meet real-time parallel execution requirements, especially in scenarios where multi-task dynamic switching or path conflicts are frequent, which can result in response lag and scheduling imbalance. Therefore, a multi-task real-time scheduling and interface adaptation system based on ROS2 is proposed. SUMMARY
[0003] Therefore, the present application provides a multi-task real-time scheduling and interface adaptation system based on ROS2 to solve or alleviate the technical problems in the prior art and provide at least one beneficial option.
[0004] The technical solution of the present application is as follows: a multi-task real-time scheduling and interface adaptation system based on ROS2, comprising: A task scheduling core module is constructed based on the ROS2 framework and uses a distributed node structure to perform parallel scheduling and running state management for multiple robots or multi-station operations. An interface adaptation module is in communication with the task scheduling core module and is used to complete protocol recognition, data format conversion and unified mapping between the upper-layer business system and the lower-layer execution device. A communication module is used to establish a DDS-based data transmission path between ROS2 nodes to realize task message publishing, state information subscription and event broadcast transmission. A scheduling control module is in signal connection with the task scheduling core module and is used to optimize task allocation, resource scheduling and path planning based on multi-agent reinforcement learning and distributed model predictive control DMPC algorithm. A task cache and recovery module is connected to the task scheduling core module and is used to record task context information in real time during task execution and to realize breakpoint continuation and task recovery after system interruption or device replacement. An open interface module is connected with the task scheduling core module, and is configured to realize real-time data interaction with a warehouse management system (WMS) and a manufacturing execution system (MES) through RESTful API and WebSocket interfaces.
[0005] Further preferably, the task scheduling core module comprises a node registration module, a state synchronization module and a resource coordination module. The node registration module is configured to automatically identify an accessed execution node, and complete node registration and network parameter configuration in a ROS2 network. The state synchronization module is configured to broadcast task progress, device state and load information of each node at a fixed period. The resource coordination module dynamically adjusts a task allocation strategy according to a node resource occupation rate, and automatically migrates part of tasks to maintain overall operation balance and system real-time performance when detecting that a load exceeds a set threshold.
[0006] Further preferably, the interface adaptation module comprises a protocol analysis layer and a data mapping layer. The protocol analysis layer is configured to identify and analyze communication protocols adopted by devices of different manufacturers, including Modbus, OPC-UA, EtherCAT and MQTT industrial communication standards. The data mapping layer converts task instructions and data fields issued by an upper system into a control instruction format recognizable by a bottom device according to a predefined adaptation rule library; when the system detects that a new device is accessed or a protocol version is changed, the interface adaptation module automatically calls a corresponding template through dynamic loading to realize fast matching and real-time communication of data between heterogeneous systems.
[0007] Further preferably, the scheduling control module comprises a state parameter identification module, a task decision module and a learning update module. The state parameter identification module is configured to collect operation characteristics such as task queue length, device availability, communication delay and energy consumption parameters. The task decision module dynamically decides allocation, migration, merging and interruption of tasks based on a joint strategy of Q-learning and DMPC. The learning update module calculates a comprehensive reward value according to task completion rate, energy consumption balance degree and response delay, and real-time corrects a scheduling strategy in a rolling time domain manner.
[0008] Further preferably, the communication module is constructed based on a DDS communication mechanism of ROS2, and comprises a main task channel, a state feedback channel and an alarm event channel. Each communication channel supports QoS parameter configuration for controlling message transmission frequency, reliability and cache strategy, when detecting network bandwidth shortage or node delay rise, the communication module automatically reduces the message frequency of non-critical channel, and preferentially guarantees the low delay and high stability communication of main task channel.
[0009] Further preferably, the task cache and recovery module comprises a task record module and a scheduling recovery module. The cache control module is used for periodically recording task number, execution progress and state parameters during task execution, and automatically triggering task cache operation and pausing scheduling when the system detects communication interruption, node anomaly or execution device replacement. The recovery scheduling module reads cache information after system recovery, recovers scheduling order according to task type and timestamp, and realizes breakpoint continuous scheduling and hot migration of tasks.
[0010] Further preferably, the open interface module provides RESTful API interface and WebSocket double-channel communication interface. The API interface is used for task creation, scheduling query, task result feedback and log calling, and the WebSocket interface is used for real-time transmission of task progress, system alarm and running state.
[0011] Further preferably, the system further comprises an interface rule engine module for dynamically loading protocol analysis rules and field mapping configuration at runtime. When a new device or external system accesses, the rule engine module automatically matches the rule template and generates a communication adaptation script according to the identification information, and realizes automatic access.
[0012] The embodiment of the application has the following advantages due to the use of the above technical scheme: The application constructs a task scheduling core based on the ROS2 distributed architecture, cancels the traditional centralized master node structure, and all execution nodes realize direct publishing and subscribing of task information through the DDS communication mechanism, so as to form a distributed scheduling system. Under this architecture, task allocation, path planning and state synchronization are completed by multiple nodes in parallel, the system can dynamically adjust the scheduling strategy according to real-time load, reduce the central control computing pressure, and through the joint application of reinforcement learning and model predictive control algorithm, realize task adaptive allocation and timing optimization in the multi-robot and multi-station scene, effectively solve the technical problems of task scheduling lag and parallel task execution limitation of the traditional system.
[0013] The above summary is intended to illustrate only and is not intended to be limiting in any way. Further aspects, embodiments and features of the present application will become apparent from the following detailed description, taken in conjunction with the accompanying drawings and the description of the drawings. BRIEF DESCRIPTION OF DRAWINGS
[0014] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort on the basis of these drawings.
[0015] Figure 1 The system flowchart of the present application. DETAILED DESCRIPTION
[0016] In the following, only some exemplary embodiments are simply described. As those skilled in the art can recognize, the described embodiments can be modified in various different ways without departing from the spirit or scope of the present application. Therefore, the drawings and the description are considered to be exemplary in nature rather than limiting.
[0017] The embodiments of the present application will be described in detail below with reference to the drawings.
[0018] As Figure 1 shown, the embodiments of the present application provide a ROS2-based multi-task real-time scheduling and interface adaptation system, comprising the following modules: Task scheduling core module: based on ROS2 node management framework, responsible for global task allocation, node registration and state management; Scheduling control module: running Multi-Agent RL and DMPC algorithms, realizing dynamic optimization of task scheduling; Communication module: based on DDS to build a multi-channel communication structure; Interface adaptation module: realizing analysis and data mapping of different communication protocols; Task cache and recovery module: for breakpoint continuation and task recovery; Open interface module: realizing real-time data interaction with WMS / MES system; Interface rule engine module: supporting automatic loading and dynamic extension of protocol templates.
[0019] When the system is in the initial running stage, first, the ROS2 node initialization and network topology construction are completed by the task scheduling core module, which includes a node registration module, a state synchronization module and a resource coordination module inside; the node registration module is responsible for scanning the available nodes in the ROS2 network, and automatically identifies the execution units such as mobile robots, mechanical arms, sorting units, etc. according to the preset configuration file; after identification, the system allocates a unique ID number according to the node namespace and type, and registers it to the system resource pool; after registration is completed, each node uploads its metadata information such as capability parameters, executable task types, maximum load, power state and network delay through the message reporting interface; The state synchronization module periodically broadcasts the node running state, including task progress, CPU occupancy, signal strength and power balance, etc., and feeds back to the scheduling core module through the Topic channel of ROS2, to master the running status of all nodes in real time, and the resource coordination module statistically analyzes the node resource occupancy rate according to the state synchronization information, calculates the global resource balance coefficient, and when it is detected that the load of a node exceeds the threshold, the resource coordination module will notify the scheduling control module to trigger the task migration strategy; After the node registration and resource table establishment are completed, the system enters the task generation and task allocation stage; the upper WMS or MES system issues a scheduling task through the RESTful API interface of the open interface module, and the task content is transmitted into the system in JSON structure; after the task is received by the interface adaptation module, the protocol analysis layer of the interface adaptation module analyzes the external data format, confirms the data type, field structure and encoding method; then the data mapping layer maps the task fields into the system internal standard structure, and the fields include task number, priority, start and end coordinates, task type and time limit requirement, etc.; after the mapping is completed, the task is written into the task queue, and is recorded in the task database for subsequent tracing; After the task scheduling core module receives a new task, it immediately extracts the real-time state vector of all online nodes from the resource table, including device utilization, communication delay, energy consumption load and spatial position; then these data are transmitted into the scheduling control module for decision calculation, and the scheduling control module includes a state parameter identification module, a task decision module and a learning update module inside; The state parameter identification module is responsible for collecting and preprocessing the node information from the state synchronization module, generating a state vector, including node occupancy, path cost to the task target, task queue length and network delay; The task decision module dynamically calculates the task allocation scheme based on a joint algorithm of reinforcement learning (Q-learning) and distributed model predictive control (DMPC). The reinforcement learning part continuously updates the table according to historical reward values to quickly obtain the current optimal execution node. The DMPC part predicts the load changes at multiple future time steps in a rolling time domain to optimize global allocation and path planning to prevent future task conflicts. The learning update module calculates the comprehensive reward value based on the task execution time, energy consumption and communication delay after each round of task completion, and dynamically corrects the strategy parameters, thereby realizing self-learning and long-term optimization of the scheduling model. The scheduling result is encapsulated as a task instruction message and published to the target node's ROS2 Topic through the main task channel of the communication module, forming a task issuance. During scheduling and communication, the communication module is responsible for establishing a DDS-based data transmission system and setting up three types of communication channels: main task channel, state feedback channel and alarm event channel. The main task channel, state feedback channel and alarm event channel are used for issuing scheduling instructions and execution control information, reporting node state and task progress, and transmitting abnormal signals and safety events, respectively. Each channel has independent QoS configuration to dynamically adjust message transmission frequency and reliability mode according to task priority and data importance. When network bandwidth decreases or communication delay increases, the communication module automatically limits non-critical data through a bandwidth monitoring mechanism to ensure that the main task channel maintains low-delay transmission in any situation, making the task response delay stable within 50ms and ensuring synchronized execution of multiple nodes. After receiving the scheduling command, the execution node automatically enters the working state and periodically returns execution feedback data. The feedback information includes task ID, execution progress percentage, positioning coordinates, energy consumption statistics and key sensor state. The task scheduling core module compares the task plan table in real time based on the feedback information. If it detects that the node load is too high, the task is lagging or the communication is unstable, it sends a resource reallocation request through the resource coordination module. The scheduling control module recalculates the task allocation matrix and starts the task migration logic to allocate part of the tasks to standby nodes, maintaining global load balancing and efficient operation of the system. The entire reallocation process is completed by the communication module to ensure the timing continuity of the instructions and feedback. In the task execution phase, different protocols and field specifications can be used between the upper system and the bottom device, the interface adaptation module converts the message through the pre-defined protocol template, and the original signal reported by the device side is converted into a data frame structure recognizable by ROS2 after protocol analysis; if a new device is detected to access or the communication protocol version is updated, the interface adaptation module will send a call request to the interface rule engine module; the rule engine automatically matches the rule template according to the device identification information, and generates the corresponding field mapping script; the new script is hot-loaded during system operation, and online compatibility of plug-and-play can be realized without restarting; The application records task number, execution progress, node ID and key parameters in a fixed cycle during task execution, and stores them in a double-layer cache area (RAM and SSD) in real time; when the communication module detects that a node abnormally separates or connection timeout, the system immediately suspends scheduling and triggers cache locking operation, writes the latest state data to a non-volatile storage medium, after the node is online again or the replacement device is registered, the recovery module automatically reads the cache content to rebuild the task context, and restores the execution progress according to the time stamp, and then the scheduling core module reassigns or resumes; if the original node is unavailable, the system calculates the optimal migration target node through the DMPC module to realize task hot switching and seamless recovery, and the whole process takes no more than 5 seconds; After the task execution is completed, the system feeds back the execution result and running data to the upper WMS / MES system in real time through the open interface module, and the RESTful API interface is used for periodic synchronization of batch task state and statistical data; In this embodiment, the main terms involved are explained: ROS2 refers to a distributed robot operating system framework based on data distribution service (DDS), which is used to realize asynchronous communication, task scheduling and resource sharing between different computing nodes; in the application, ROS2 is used as the basis of system bottom communication and task management, to realize parallel cooperation and real-time message distribution of multiple nodes; DDS refers to the communication middleware standard used by ROS2, which uses the publish / subscribe mechanism for data transmission, DDS allows multiple nodes in the network to share message topics (Topic), and can set quality of service (QoS) parameters such as message reliability, transmission frequency and cache strategy, to ensure the data consistency and communication reliability of the real-time scheduling system; QoS parameter refers to the control parameter used to define the quality of service of data transmission in DDS communication, including reliability, durability, history cache, delay tolerance, etc.; the application adjusts the QoS parameter dynamically to ensure that the main task channel still has low delay and high stability when the network load changes Reinforcement learning is a kind of machine learning method, which is used to maximize cumulative reward by interacting with the environment through an agent and constantly adjusting the strategy according to the reward signal; in the present application, reinforcement learning is used for task decision-making process in the scheduling control module, and the system gradually learns the optimal task allocation strategy through the feedback of task delay, energy consumption and load balancing and other indicators Q-learning is a model-free reinforcement learning algorithm, which updates the state-action value function Q(s, a) through the mapping relationship between state (S) and action (A) to find the optimal execution action in different environmental states; in the present application, the Q-learning algorithm is used for online updating of the multi-node scheduling strategy, so that the system can dynamically adjust the node allocation and task priority according to the real-time task state; Multi-agent reinforcement learning refers to a reinforcement learning framework in which multiple agents participate together, each node acts as an independent learning body, and collaborative optimization is achieved through local experience sharing and global reward feedback; in the present application, multiple robot nodes or workstations are regarded as multiple agents, and the system realizes task coordination and scheduling optimization across nodes through joint learning strategy; Distributed model predictive control, MPC is an extended form of MPC in distributed systems; each node has a local predictive model and independently solves the local optimal solution, while achieving global consistency through communication coordination; in the present application, the DMPC algorithm enables each node to perform prediction and optimization without relying on a central controller, thereby reducing system delay and improving parallel processing capability; State vector refers to the global state description set of the system at time t, including node running state, device utilization, communication delay, energy consumption level and task progress; the scheduling control module takes the state vector as input and generates task allocation decisions through learning and prediction models; The above is only a specific embodiment of the present application, but the protection scope of the present application is not limited thereto, any skilled person in the art can easily think of various changes or replacements within the technical range disclosed in the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A multi-task real-time scheduling and interface adaptation system based on ROS2, characterized in that, include: The core module for task scheduling is built on the ROS2 framework and adopts a distributed node structure. It is used for parallel scheduling and operation status management of multiple robots or multi-workstation operations. The interface adaptation module communicates with the task scheduling core module and is used to complete protocol identification, data format conversion and unified mapping between the upper-layer business system and the lower-layer execution device. The communication module is used to establish a DDS-based data transmission path between each ROS2 node, enabling the publication of task messages, subscription of status information, and broadcasting of events. The scheduling and control module is signal-connected to the task scheduling core module and is used to optimize task allocation, resource scheduling and path planning based on the multi-agent reinforcement learning and distributed model prediction control (DMPC) algorithm. The task caching and recovery module, connected to the task scheduling core module, is used to record task context information in real time during task execution and to resume interruption and task recovery after system interruption or equipment replacement. The open interface module, connected to the task scheduling core module, is used to achieve real-time data interaction with the warehouse management system (WMS) and manufacturing execution system (MES) through RESTful API and WebSocket interface.
2. The multi-task real-time scheduling and interface adaptation system based on ROS2 according to claim 1, characterized in that: The core module for task scheduling includes a node registration module, a status synchronization module, and a resource coordination module. The node registration module is used to automatically identify the access execution nodes and complete node registration and network parameter configuration in the ROS2 network; The status synchronization module is used to broadcast the task progress, device status and load information of each node at a fixed period. The resource coordination module dynamically adjusts the task allocation strategy based on the node resource occupancy rate. When the load exceeds the set threshold, it automatically migrates some tasks to maintain overall operational balance and system real-time performance.
3. The multi-task real-time scheduling and interface adaptation system based on ROS2 according to claim 1, characterized in that: The interface adaptation module includes a protocol parsing layer and a data mapping layer; The protocol parsing layer is used to identify and parse the communication protocols used by different manufacturers' devices, including Modbus, OPC-UA, EtherCAT, and MQTT industrial communication standards. The data mapping layer converts the task instructions and data fields issued by the upper-layer system into control instruction formats that can be recognized by the lower-layer devices based on a predefined adaptation rule library. When the system detects the access of a new device or a change in the protocol version, the interface adaptation module automatically calls the corresponding template by dynamically loading, so as to realize fast data matching and real-time communication between heterogeneous systems.
4. The multi-task real-time scheduling and interface adaptation system based on ROS2 according to claim 1, characterized in that: The scheduling control module includes a status parameter identification module, a task decision module, and a learning and update module. The status parameter identification module is used to collect operational characteristics such as task queue length, device availability, communication latency, and energy consumption parameters. The task decision module is based on a joint strategy of Q-learning and DMPC to make dynamic decisions on task allocation, migration, merging and interruption; The learning and updating module calculates a comprehensive reward value based on task completion rate, energy consumption balance, and response latency, and corrects the scheduling strategy in real time using a rolling time domain approach.
5. The multi-task real-time scheduling and interface adaptation system based on ROS2 according to claim 1, characterized in that: The communication module is built based on the DDS communication mechanism of ROS2, including a main task channel, a status feedback channel, and an alarm event channel; Each communication channel supports QoS parameter configuration to control message transmission frequency, reliability, and caching strategy. When insufficient network bandwidth or increased node latency is detected, the communication module automatically reduces the message frequency of non-critical channels to prioritize low-latency and high-stability communication of the main task channel.
6. The multi-task real-time scheduling and interface adaptation system based on ROS2 according to claim 1, characterized in that: The task caching and recovery module includes a task recording module and a scheduling recovery module; The cache control module is used to periodically record the task number, execution progress and status parameters during task execution. When the system detects communication interruption, node abnormality or replacement of execution device, it automatically triggers task caching operation and suspends scheduling. The recovery scheduling module reads cached information after the system recovers and restores the scheduling order according to the task type and timestamp, realizing the interrupted resumption and hot migration of tasks.
7. The multi-task real-time scheduling and interface adaptation system based on ROS2 according to claim 1, characterized in that: The open interface module provides both a RESTful API interface and a WebSocket dual-channel communication interface. The API interface is used for task creation, scheduling query, task result feedback and log call, and the WebSocket interface is used for real-time transmission of task progress, system alarms and running status.
8. A multi-task real-time scheduling and interface adaptation system based on ROS2 according to claim 1, characterized in that: The system also includes an interface rule engine module, which is used to dynamically load protocol parsing rules and field mapping configurations at runtime; When a new device or external system is connected, the rules engine module automatically matches the rule template based on the identification information and generates a communication adaptation script to achieve automatic connection.