Robot operating system communication method, electronic equipment and storage medium

By establishing a priority mapping policy table and dynamic resource allocation in the hard real-time operating system, the problem of insufficient real-time performance of ROS2 FastDDS in hard real-time applications is solved, and efficient hard real-time communication is achieved.

CN121077982AActive Publication Date: 2025-12-05ANHUI GUOXUN CORE MICROTECHNOLOGY CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202511595727.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-04
Publication Date
2025-12-05
Estimated Expiration
2045-11-04

AI Technical Summary

Technical Problem

Existing communication systems based on ROS2 FastDDS cannot effectively utilize the deterministic task scheduling and low-latency interrupt handling capabilities of hard real-time operating systems in hard real-time application scenarios, resulting in insufficient real-time performance and inability to meet microsecond-level communication requirements. Furthermore, under high load, high QoS control messages and low QoS log messages compete for resources.

Method used

A priority mapping policy table is established in the hard real-time operating system. The real-time priority index is calculated through QoS configuration parameters, the message processing thread is bound, and the resource allocation is dynamically adjusted based on the system load. The FastDDS microkernel is embedded into the hard real-time operating system kernel to optimize resource allocation and scheduling.

Benefits of technology

It enables QoS configuration to directly determine the initial priority of tasks in the hard real-time operating system, dynamically adjust resource allocation, ensure efficient communication and real-time performance of hard real-time applications, avoid resource contention, and meet the communication needs of hard real-time scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121077982A_ABST
    Figure CN121077982A_ABST
Patent Text Reader

Abstract

The invention discloses a robot operating system communication method. The method comprises the following steps: installing a robot operating system and deploying a FastDDS; when the robot operating system publishes or subscribes a message, the hard real-time operating system obtains a QoS configuration parameter of the message and calculates a real-time priority index; establishing a priority mapping strategy of the robot operating system QoS and the hard real-time operating system in the hard real-time operating system; binding a corresponding priority for the message processing thread based on the real-time priority index; executing tasks based on priority scheduling and a dynamic priority adjustment mechanism; a load monitoring thread is deployed, the load monitoring thread counts system load data, task load data and network load data every preset time, and thread priority and resource allocation are adjusted in real time. According to the robot operating system communication method, the initial priority of the hard real-time operating system task is directly determined by QoS configuration, and QoS resource allocation can be dynamically counteracted according to the system load.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of robot control technology, specifically to a robot operating system communication method, electronic device, and storage medium. Background Technology

[0002] ROS2 is a mainstream open-source framework for robot development, employing DDS as its underlying communication mechanism to provide reliable support for data interaction in distributed systems. FastDDS is a commonly used DDS implementation of ROS2, achieving relatively efficient data transmission in general scenarios. However, in applications with extremely high real-time requirements, such as robot control and industrial automation, existing communication systems based on ROS2FastDDS have significant shortcomings. Their internal QoS is completely isolated from the underlying OS scheduling priority, meaning that high QoS settings cannot effectively translate into a preemptive advantage for execution resources.

[0003] Furthermore, under high loads, high QoS control messages may compete for resources with low QoS log messages, compromising real-time performance and failing to meet the microsecond-level communication requirements of hard real-time scenarios. In hard real-time applications, data transmission latency jitter can lead to serious consequences such as robot control malfunctions and industrial equipment failures. Moreover, existing technologies have not fully optimized ROS2FastDDS to leverage the characteristics of hard real-time operating systems, failing to effectively utilize the deterministic task scheduling and low-latency interrupt handling capabilities of hard real-time operating systems. Summary of the Invention

[0004] To overcome the shortcomings of the prior art, the present invention provides a robot operating system communication method, electronic device and storage medium. The robot operating system communication method allows QoS configuration to directly determine the initial priority of hard real-time operating system tasks, and can also dynamically affect the resource allocation of QoS according to the system load.

[0005] To achieve the above objectives, the technical solution adopted by the present invention is: a robot operating system communication method, comprising the following steps: The hard real-time operating system establishes a priority mapping strategy table; The hard real-time operating system obtains QoS configuration parameters, which are derived from the robot operating system. Calculate the real-time priority index based on the acquired QoS configuration parameters; Based on the real-time priority index, the priority corresponding to the priority index is determined according to the priority mapping strategy table; Priorities are bound to the corresponding message processing threads, and the hard real-time operating system runs message processing threads based on priorities; The hard real-time operating system collects system load data, task load data, and network load data at preset intervals. Resource allocation is adjusted in real time based on system load data, task load data, and network load data.

[0006] Through the above technical solutions, the robot operating system communication method disclosed in this application not only allows QoS configuration to directly determine the initial priority of hard real-time operating system tasks, but also dynamically affects the resource allocation of QoS according to the system load.

[0007] Furthermore, the calculation of the real-time priority index based on the acquired QoS configuration parameters includes: QoS configuration parameters are converted into a real-time priority index using a QoS feature-weighted algorithm. These QoS configuration parameters include deadline, reliability, message size, and user identifier. The feature-weighted algorithm includes the following calculation rules: QoS configuration parameters are converted into a real-time priority index using a QoS feature-weighted algorithm. These QoS configuration parameters include deadline, reliability, message size, and user identifier. The feature-weighted algorithm includes the following calculation rules: Calculate the deadline weight based on the deadline numerical value; Reliability weights are calculated based on reliability. Message weight is calculated based on message size; Calculate user identifier weights based on user identifiers; Real-time priority index = (deadline weight + reliability weight + message weight + user identifier weight) * 100.

[0008] Furthermore, the hard real-time operating system establishes a priority mapping strategy table including: A mapping table between real-time priority index and hard real-time operating system priority is established and compiled into the kernel. The mapping table includes dividing the numerical range of real-time priority index into at least three numerical intervals according to gradient, dividing the hard real-time operating system priority into priority intervals that correspond one-to-one with the numerical intervals, and binding the numerical intervals and priority intervals in pairs.

[0009] Furthermore, the step of determining the priority corresponding to the priority index based on the real-time priority index and according to the priority mapping strategy table includes: Determine the numerical range corresponding to the real-time priority index, and the corresponding priority range; Calculate the priority increment corresponding to the real-time priority index, where the priority increment = priority interval length / numerical interval length; Calculate the priority offset, where the priority offset = (real-time priority index - starting point of the numerical range) * priority increment; Priority = Priority interval start point + Priority offset.

[0010] Furthermore, the calculation method for the real-time priority index is as follows: The initial value of the deadline weight is set to 0: if the deadline ≤ 10ms, the deadline weight increases by 40%; if 10ms > deadline ≤ 100ms, the deadline weight increases by 40% - (t-10) / 90*40%; if the deadline > 100ms, the deadline weight decreases by 20%. The initial value of the reliability weight is set to 0. If the reliability is RELIABLE, the reliability weight is increased by 30%; if the reliability is BEST_EFFORT, the reliability weight is decreased by 10%. The initial value of the message weight is set to 0. If the message size is less than 1KB, the message weight is increased by 10%. If the message size is between 1KB and 1MB, the message weight is increased by 0. If the message size is greater than 1MB, the message weight is decreased by 30%. The initial value of the user identifier weight is set to 0. If the user identifier is CRITICAL, the user identifier weight is increased by 20%. If the user identifier is other, the user identifier weight is increased by 0. Real-time priority index = (deadline weight + reliability weight + message weight + user identifier weight) * 100.

[0011] Furthermore, the binding of priorities to corresponding message processing threads, and the hard real-time operating system running message processing threads based on priorities, includes: The hard real-time operating system binds a corresponding priority to the message processing thread and registers a dynamic adjustment flag for that thread. Hard real-time operating systems pre-create worker threads for different priorities, and the mapping engine distributes messages to the corresponding thread queues. Hard real-time operating systems execute tasks based on priority scheduling and dynamic priority adjustment mechanisms.

[0012] Furthermore, the real-time adjustment of resource allocation based on system load data, task load data, and network load data includes: When the load exceeds the preset value, the scheduler lowers the priority of the message processing thread corresponding to non-critical messages, locks the priority of the message processing thread corresponding to critical messages, compresses or delays the sending of non-critical messages, prioritizes CPU allocation for critical messages, and reduces the bandwidth of non-critical messages. Among them, the key messages must meet the following conditions: deadline is less than or equal to the fifth preset value, reliability is RELIABLE, real-time priority index is greater than or equal to the sixth preset value, and the business tag belongs to the control flow and is in the pre-configured key file; The non-critical messages must meet the following requirements: no deadline, reliability of BEST_EFFORT, and real-time priority index less than the sixth preset value; or the business tag belongs to the data stream and is in a pre-configured non-critical file.

[0013] Furthermore, it also includes: Embed the FastDDS microkernel into the kernel of a hard real-time operating system; Bind the receive interrupt of the Ethernet controller to a high-priority real-time thread of the FastDDS microkernel; A shared memory managed in kernel mode is allocated as a data exchange medium.

[0014] An electronic device includes: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; and at least one memory connected to the at least one bus, wherein the memory stores a computer program, and the processor executes the computer program to implement the above-described robot operating system communication method.

[0015] A storage medium, which is a computer-readable storage medium, stores a computer program that, when executed by a multi-core processor, implements the above-described robot operating system communication method.

[0016] By employing the above technical solutions, the beneficial effects of the present invention are as follows: In this application, a priority mapping strategy table is established in the hard real-time operating system to convert the QoS of the robot operating system into the priority of the hard real-time operating system. This allows the QoS configuration to directly determine the initial priority of the hard real-time operating system tasks, thereby effectively converting the high priority set by QoS into a preemptive advantage for execution resources. This application deploys a load monitoring thread to collect system load data, task load data, and network load data at preset intervals, and adjusts thread priority and resource allocation in real time based on the system load data, task load data, and network load data.

[0017] To make the above and other objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0018] 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.

[0019] Figure 1 This is a flowchart of the robot operating system communication method in an embodiment of the present invention. Detailed Implementation

[0020] 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.

[0021] It should be noted that in the description of this invention, the terms "first," "second," etc., are used only for descriptive purposes and to distinguish similar objects; there is no order between them, nor should they be construed as indicating or implying relative importance. Furthermore, in the description of this invention, unless otherwise stated, "a plurality of" means two or more.

[0022] Example: Figure 1 As shown, this embodiment discloses a robot operating system communication method, including the following steps: Install the robot operating system in the hard real-time operating system, and deploy FastDDS as the underlying communication middleware in the robot operating system; The hard real-time operating system establishes a priority mapping strategy table; The hard real-time operating system obtains QoS configuration parameters, which are derived from the robot operating system. Calculate the real-time priority index based on the acquired QoS configuration parameters; Based on the real-time priority index, the priority corresponding to the priority index is determined according to the priority mapping strategy table; Priorities are bound to the corresponding message processing threads, and the hard real-time operating system runs message processing threads based on priorities; The hard real-time operating system collects system load data, task load data, and network load data at preset intervals. Resource allocation is adjusted in real time based on system load data, task load data, and network load data.

[0023] Through the above technical solutions, the robot operating system communication method disclosed in this application not only allows QoS configuration to directly determine the initial priority of hard real-time operating system tasks, but also dynamically affects the resource allocation of QoS according to the system load.

[0024] In some feasible embodiments, the ROS2 system is installed in the NECRO industrial real-time operating system, and FastDDS is deployed in the ROS2 system as the underlying communication middleware, and the FastDDS microkernel is embedded in the kernel of the hard real-time operating system.

[0025] Among them, ROS2 (Robot Operating System 2) is a new generation of open source robot operating system. It adopts a distributed communication architecture, realizes automatic node discovery and communication through DDS middleware, and supports cross-device communication and multi-robot collaboration, real-time data transmission and QoS control, and automatic network anomaly recovery capabilities.

[0026] FastDDS is an open-source data distribution service implementation that supports zero-copy transmission, shared memory, and UDP multicast optimization.

[0027] The NECRO industrial real-time operating system employs preemptive priority scheduling, allowing high-priority tasks to immediately interrupt low-priority tasks. It supports the earliest deadline-first algorithm to dynamically allocate task execution order. A built-in deadline monitoring module triggers error callbacks or system recovery upon timeout, thus strictly ensuring that tasks are completed within a defined time window. Compared to soft real-time operating systems that allow for some delay, this system imposes strict time constraints. If a task is not completed before its deadline, the system will determine it as a critical failure, triggering an interrupt to forcibly terminate the failed task and initiating a preset recovery process, such as restarting the task or calling an emergency handling procedure.

[0028] In some feasible embodiments, a new dds_kern_module module is added based on the hard real-time kernel extension of the hard real-time operating system. This module includes three main functions: message queue management, priority resolution, and shared memory interface. It is a kernel-level extension module whose core objective is to solve the latency uncertainty problem of traditional user-space DDS (such as FastDDS) in hard real-time scenarios. By sinking the core DDS communication logic to the kernel space, it achieves low latency, high determinism, and zero-copy characteristics for message transmission. In this embodiment, the dds_kern_module module is used to implement the following functions: Shared memory interface: The dds_kern_module module pre-allocates 1MB of contiguous physical memory as a shared memory pool managed by the kernel during initialization. The dds_kern_module module exposes system calls to user space, allowing ROS2 nodes to directly write messages to pre-allocated contiguous physical memory via the user-space write interface (rt_shm_write()). User-space applications obtain contiguous physical memory addresses through the API provided by the dds_kern_module module and write message data directly without kernel-space copying.

[0029] The kernel-mode FastDDS microkernel directly accesses data in the physical memory pool through the kernel-mode read interface (rt_shm_read()) (without copying from user mode to kernel mode), parses the message header (containing metadata such as target node and priority), and then delivers it to the corresponding message queue.

[0030] Message queue management: The kernel maintains multiple message queues divided according to the target node, and each queue is sorted according to message priority. After rt_shm_read() reads a message, it inserts it into the queue according to the message priority; When a target node (such as a control node) requests a message through the kernel interface, the dds_kern_module module extracts the highest priority message from the head of the queue and directly returns the contiguous physical memory address.

[0031] In some feasible implementations, the dds_kern_module module has a built-in timeout mechanism. If a message stays in the queue for more than a threshold, a warning is triggered or the message is discarded to avoid expired messages affecting real-time performance.

[0032] Priority analysis: Parse the QoS parameters of the ROS2 message and map them to the task priority of the hard real-time kernel; When a low-priority node holds resources required by a high-priority message (such as a shared memory lock), the dds_kern_module module triggers a priority inheritance mechanism (to prevent priority inversion) and temporarily raises the priority of the low-priority node to the requester level.

[0033] Priority resolution includes the following steps: When a hard real-time operating system establishes a priority mapping policy table, it establishes a mapping relationship table between the real-time priority index and the priority of the hard real-time operating system, and compiles the mapping relationship table into the kernel.

[0034] In the mapping table between the real-time priority index and the hard real-time operating system priority, the numerical range of the real-time priority index is divided into at least three numerical intervals according to the gradient, the hard real-time operating system priority is divided into priority intervals that correspond one-to-one with the numerical intervals, and the numerical intervals and priority intervals are paired and bound together.

[0035] The real-time priority index ranges from [0, 100), and the hard real-time operating system priority ranges from [1, 255). The mapping relationship between the real-time priority index and the hard real-time operating system priority is as follows: The real-time priority index [80, 100) corresponds to the priority [200; 255); The real-time priority index [50, 79) corresponds to the priority [100; 200); The real-time priority index [0; 50) corresponds to the priority [1; 100), and the range of the real-time priority index corresponds to the non-real-time level.

[0036] The hard real-time operating system obtains QoS configuration parameters by: when ROS2 system nodes publish or subscribe to messages through the FastDDS middleware, the DDS entity management engine intercepts QoS configuration in real time through DataWriterListener. These QoS configuration parameters include: time constraints: deadline (message timeout) and lifespan (message validity period); reliability: RELIABLE (reliable transmission) and BEST_EFFORT (best-effort transmission); resource requirements: message size and publication frequency; and user identifier. FastDDS passes the intercepted QoS configuration to the hard real-time operating system through the microkernel real-time scheduling layer. The hard real-time operating system then calculates the real-time priority index based on the aforementioned QoS configuration parameters.

[0037] In some feasible embodiments, QoS configuration parameters are converted into real-time priority indices using a QoS feature weighting algorithm, which includes the following calculation rules: Deadline weight: If deadline ≤ 10ms, the weight increases by 40%; if 10ms > deadline ≤ 100ms, the weight increases by 40% - (t-10) / 90*40%; if deadline > 100ms, the weight decreases by 20%. Reliability weight: if the reliability is RELIABLE, the weight is increased by 30%; if the reliability is BEST_EFFORT, the weight is decreased by 10%. Message weighting: if the message size is less than 1KB, the weight increases by 10%; if the message size is between 1KB and 1MB, the weight increases by 0%; if the message size is greater than 1MB, the weight decreases by 30%. User identifier weight: if the user identifier is CRITICAL, the weight is increased by 20%; if the user identifier is other, the weight is increased by 0.

[0038] The initial values ​​for the deadline weight, reliability weight, message weight, and user identifier weight are all 0.

[0039] Real-time priority index = (deadline weight + reliability weight + message weight + user identifier weight) * 100.

[0040] Based on the real-time priority index, the priority corresponding to the priority index is determined according to the priority mapping strategy table, and the priority is bound to the corresponding message processing thread.

[0041] In some feasible embodiments, the priority calculation steps are as follows: Determine the numerical range corresponding to the real-time priority index, and the corresponding priority range; Calculate the priority increment corresponding to the real-time priority index, where the priority increment = priority interval length / numerical interval length; Calculate the priority offset, where the priority offset = (real-time priority index - starting point of the numerical range) * priority increment; Priority = Priority interval start point + Priority offset, where if the calculation result is a decimal, it is rounded to the nearest integer.

[0042] Taking a real-time priority index of 88 as an example, 88 corresponds to the numerical range [80, 100), and the priority range is [200; 255). The length of this numerical range is 20, and the length of the priority range is 55. Priority increment = Priority interval length / Numerical interval length = 55 / 20 = 2.75; Priority offset = (real-time priority index - starting point of numerical range) * priority increment = (88-80) * 2.75 = 22; Priority = Priority interval start point + Priority offset = 200 + 22 = 222.

[0043] In some feasible implementations, the Ethernet controller's receive interrupt is bound to a high-priority real-time thread of the FastDDS microkernel. Specifically, the Ethernet PHY's receive interrupt is bound to the FastDDS microkernel's `niic_dds_irq_handler()` function. With this technical solution, upon interrupt arrival, the hardware driver layer performs only minimal frame filtering, and the data frame is immediately taken over and processed by the FastDDS microkernel thread, thus reducing the delay time from interrupt to protocol processing.

[0044] In some feasible implementations, the hard real-time operating system calls the pthread_setschedparam system call to bind the corresponding priority to the message processing thread and registers a dynamic adjustment flag for the thread, allowing the adaptive scheduler to directly modify its priority later.

[0045] Specifically, if the real-time priority index is between [80, 100), the priority adjustment range set by the pthread_setschedparam system call for the message processing thread is [200; 255). If the real-time priority index is between [50, 79), the priority adjustment range set by the pthread_setschedparam system call for the message processing thread is [100; 200). If the real-time priority index is between [0; 50), the priority adjustment range set by the pthread_setschedparam system call for the message processing thread is [1; 100).

[0046] In some feasible embodiments, the hard real-time operating system performs tasks based on priority scheduling and dynamic priority adjustment mechanisms, including: Design a static rule and dynamic parameter strategy library for a hard real-time operating system. Prioritize the hard real-time operating system according to real-time requirements and specify the elasticity coefficient for each level. For example, set priority [200; 255) to level P0, with a preemptive priority scheduling strategy (SCHED_FIFO) and an elasticity coefficient of 0 (dynamic adjustment is prohibited); set priority [100; 200) to level P1, with a time-slice round-robin scheduling strategy (SCHED_RR), a fixed time slice of 5ms, and an elasticity coefficient that can be reduced by 40% under overload and increased by 30% under low load; set priority [1; 100) to level P2, with a dynamic elastic scheduling strategy, an elasticity coefficient that can be reduced by 70% under overload and increased by 60% under low load, and level P2 must not occupy the reserved resources of P0 or P1 tasks.

[0047] Hard real-time operating systems pre-create worker threads for different priorities. The mapping engine distributes messages to the corresponding thread queues, and the hard real-time operating system executes tasks based on priority scheduling and dynamic priority adjustment mechanisms. Specifically, when the hard real-time operating system detects an anomaly, the scheduler adjusts thread priorities in real time.

[0048] In some feasible embodiments, a dynamic performance monitoring module is deployed in the hard real-time operating system. This module collects system load data, task load data, and network load data every 10ms. The system load data includes the CPU utilization of threads in each priority range, the latency of high-priority threads, and the number of priority inversion events. The task load data includes the deadline fulfillment rate of critical messages and message processing latency; The network load data includes the actual transmission bandwidth of messages, the message queue backlog length, and the message drop rate.

[0049] Hard real-time operating systems adjust thread priorities and resource allocation in real time based on system load data, task load data, and network load data. This includes: when the load exceeds a preset value, such as when the deadline fulfillment rate of critical messages is less than 90%, the scheduler lowers the priority of message processing threads corresponding to non-critical messages, locks the priority of message processing threads corresponding to critical messages, compresses or delays the sending of non-critical messages, prioritizes CPU allocation for critical messages, and reduces the bandwidth of non-critical messages.

[0050] For example, when the critical message deadline satisfaction rate is detected to be less than 90%, the scheduler triggers the following operation: For critical messages, their priority is temporarily raised to the highest value in the range (e.g., directly raised to 254 in the range [200; 255), real-time network resources are locked, 30% of the minimum bandwidth is reserved for them, and their priority is set to the top in the middleware message queue, skipping the queuing of non-critical messages. For non-critical messages, their priority is temporarily reduced to the lowest value in the range (e.g., in the range [100; 200), it is directly reduced to 100), bandwidth compression is implemented, and high-bandwidth messages are dynamically reduced in acquisition (e.g., 1080P is changed to 720P) or the frame rate is reduced (e.g., 30fps is changed to 10fps). A delayed sending strategy is adopted (e.g., it is sent in packets every 100ms to reduce the transmission frequency, and the delay time does not exceed its lifespan).

[0051] When the dynamic performance monitoring module detects a load drop, such as when the critical message deadline satisfaction rate is ≥98%, the scheduler will restore the priority and resource configuration to their initial values.

[0052] Among them, the critical messages must meet the following requirements: deadline≤50ms, reliability is RELIABLE, real-time priority index≥80, and the business tag belongs to the control flow and is in the pre-configured critical_topics.yaml; The non-critical messages must meet the following conditions: no deadline, reliability of BEST_EFFORT, real-time priority index < 50, or the business tag belongs to the data stream and is in non_critical_topics.yaml.

[0053] This application also discloses an electronic device, comprising: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; and at least one memory connected to the at least one bus, wherein the memory stores a computer program, and the processor executes the computer program to implement the above-described robot operating system communication method.

[0054] This application also discloses a storage medium, which is a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a multi-core processor, it implements the above-described robot operating system communication method.

[0055] 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.

Claims

1. A method of robot operation system communication, characterized by, The method comprises the following steps: The hard real-time operating system establishes a priority mapping strategy table; The hard real-time operating system acquires QoS configuration parameters, which are from a robot operating system; Based on the acquired QoS configuration parameters, a real-time priority index is calculated; Based on the real-time priority index, the priority corresponding to the priority index is determined according to the priority mapping strategy table; The priority is bound to the corresponding message processing thread, and the hard real-time operating system runs the message processing thread based on the priority; The hard real-time operating system statistically calculates system load data, task load data and network load data every preset time; Based on the system load data, the task load data and the network load data, resource allocation is adjusted in real time.

2. The robotic operation system communication method of claim 1, wherein, The calculation of the real-time priority index based on the acquired QoS configuration parameters comprises: The QoS configuration parameters are converted into the real-time priority index through a QoS feature weighting algorithm, wherein the QoS configuration parameters include deadline, reliability, message size and user identification, and the feature weighting algorithm comprises the following operation rules: The deadline weight is calculated based on the deadline value; The reliability weight is calculated based on the reliability; The message weight is calculated based on the message size; The user identification weight is calculated based on the user identification; The real-time priority index = (deadline weight + reliability weight + message weight + user identification weight) * 100.

3. The method of claim 1, wherein, The hard real-time operating system establishes a priority mapping strategy table, which comprises: A mapping relationship table of the real-time priority index and the hard real-time operating system priority is established, and the mapping relationship table is compiled into the kernel, wherein the mapping relationship table of the real-time priority index and the hard real-time operating system priority comprises that the numerical value range of the real-time priority index is divided into at least three numerical value intervals by gradient, the hard real-time operating system priority is divided into priority intervals corresponding to the numerical value intervals one by one, and the numerical value intervals and the priority intervals are bound in pairs.

4. The method of claim 3, wherein, Based on the real-time priority index, the priority corresponding to the priority index is determined according to the priority mapping strategy table, which comprises: The numerical value interval corresponding to the real-time priority index is determined, and the corresponding priority interval is determined; The priority increment corresponding to the real-time priority index is calculated, wherein the priority increment = priority interval length / numerical value interval length; The priority offset is calculated, wherein the priority offset = (real-time priority index - numerical value interval start point) * priority increment; The priority = priority interval start point + priority offset.

5. The method of claim 2, wherein, The calculation method of the real-time priority index is as follows: The initial value of the deadline weight is 0: if the deadline ≤ 10 ms, the deadline weight is added by 40%, if 10 ms > deadline ≤ 100 ms, the deadline weight is added by 40% - (t-10) / 90*40%, and if the deadline > 100 ms, the deadline weight is reduced by 20%; The initial value of the reliability weight is 0: if the reliability is RELIABLE, the reliability weight is added by 30%, and if the reliability is BEST_EFFORT, the reliability weight is reduced by 10%. The initial value of the message weight is 0, if the message size is less than 1KB, the message weight is added by 10%, if the message size is between 1KB and 1MB, the message weight is added by 0, and if the message size is greater than 1MB, the message weight is reduced by 30%; The initial value of the user identification weight is 0, if the user identification is CRITICAL, the user identification weight is additionally added by 20%, and if the user identification is other, the user identification weight is added by 0; The real-time priority index = (deadline weight + reliability weight + message weight + user identification weight) * 100.

6. The method of claim 5, wherein, The priority is bound to the corresponding message processing thread, and the hard real-time operation is based on the priority to run the message processing thread, which comprises: The hard real-time operating system binds the corresponding priority for the message processing thread, and registers the dynamic adjustment mark for the thread; The hard real-time operating system creates working threads for different priorities, the mapping engine distributes messages to the corresponding thread queue, and the hard real-time operating system executes tasks based on the priority scheduling and dynamic priority adjustment mechanism.

7. The robotic operation system communication method of claim 4, wherein, The real-time adjustment of resource allocation based on system load data, task load data and network load data comprises: When it is detected that the load exceeds the preset value, the scheduler reduces the priority of the message processing thread corresponding to the non-critical message, locks the priority of the message processing thread corresponding to the critical message, compresses or delays the sending of the non-critical message, and preferentially allocates CPU for the critical message and reduces the bandwidth of the non-critical message; The critical message needs to meet the deadline less than or equal to the fifth preset value, the reliability is RELIABLE, the real-time priority index is greater than or equal to the sixth preset value, and the service tag belongs to the control flow and is in the preconfigured critical file. The non-critical message needs to meet no deadline, the reliability is BEST_EFFORT, and the real-time priority index is less than the sixth preset value, or the service tag belongs to the data flow and is in the preconfigured non-critical file.

8. The method of claim 1, wherein, Further comprising: Embedding the FastDDS microkernel into the hard real-time operating system kernel; Binding the receive interrupt of the Ethernet controller to the high-priority real-time thread of the FastDDS microkernel; Opening the shared memory managed by the kernel as a data interaction carrier.

9. An electronic device, comprising: Comprise: At least one communication interface; At least one bus connected to the at least one communication interface; At least one processor connected to the at least one bus; At least one memory connected to the at least one bus, wherein the memory stores a computer program, and the processor executes the computer program to realize the robot operating system communication method in any one of claims 1-8.

10. A storage medium, characterized by The storage medium is a computer readable storage medium, and the storage medium stores a computer program, and the computer program is executed by a multi-core processor to realize the robot operating system communication method in any one of claims 1-8.

Citation Information

Patent Citations

  • Method of evaluating wireless sensor network reliability and system thereof

    CN107295537A

  • ROS2 multi-thread actuator scheduling method based on deadline driving

    CN118964031A

  • Real-time task scheduling optimization method, device and system for FreeRTOS

    CN120256063A

  • Industrial control data processing system and method based on embedded real-time operating system

    CN120762376A

  • Multi-unmanned aerial vehicle airborne cooperative control method, electronic equipment and readable storage medium

    CN120871914A