Robot control method, system, device, medium, and program product

By generating state snapshots and using serial actuators to execute task sets sequentially, the problems of duplicate triggering and task conflicts in robot state message processing are solved, thereby improving the accuracy and reliability of robot control.

CN123129191APending Publication Date: 2026-11-20BEIJING ACCELERATED EVOLUTION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611610977.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-16
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

Existing technologies for robot state message processing lack effective identification and sequential constraint management, leading to repeated triggering, task conflicts, and execution chaos, which affects the accuracy and reliability of control.

Method used

The system generates a current state field set by receiving multi-source state messages, compares it with the historical state set, saves a state comparison snapshot, obtains the event domain identifier, and uses a serial executor to execute the task set in sequence, ensuring that tasks within the same event domain are executed in order.

Benefits of technology

It enables accurate identification of state changes, avoids repeated triggering, ensures tasks are executed in sequence, and improves the accuracy and reliability of robot control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123129191A_ABST
    Figure CN123129191A_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a robot control method, system, device, medium and program product, wherein the robot control method comprises: receiving a multi-source state message of a robot at a current time, generating a current state field set based on the multi-source state message; comparing the current state field set with a historical state field set, and saving a state comparison snapshot before and after the change in the case where the comparison result indicates that the field content has changed; obtaining an event domain identifier corresponding to the changed field, and finding a serial executor corresponding to the event domain identifier, wherein the event domain is a task set with a sequence constraint, and the serial executor is used to execute the task set according to the sequence constraint; determining at least two control tasks contained in the event domain according to the state comparison snapshot, and submitting the control tasks to the serial executor for execution. It is ensured that the tasks with sequence constraints in the same event domain are executed in a preset sequence, so as to avoid task conflict and execution confusion, and improve the reliability of robot control.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of robot control technology, and in particular to a robot control method, system, device, medium and program product. Background Technology

[0002] During operation, robots continuously generate status messages through various sensors and internal modules. These status messages come from diverse sources and contain numerous fields, requiring real-time processing to drive the robot to perform corresponding operations. As robot application scenarios become more complex, the types and quantities of status messages continue to increase. How to efficiently process multi-source status messages and accurately trigger corresponding control tasks has become an urgent problem to be solved.

[0003] In the process of state message processing, there are often sequential constraints between different control tasks, meaning that only one task is allowed to be executed at a time. However, existing solutions lack effective identification of state changes and unified management of tasks with sequential constraints, which can easily lead to repeated triggering, task conflicts, or execution chaos, affecting the accuracy and reliability of robot control. Summary of the Invention

[0004] In view of this, embodiments of the present invention provide a robot control method. One or more embodiments of the present invention also relate to a robot control system, a computing device, a computer-readable storage medium, and a computer program product, to address the technical deficiencies existing in the prior art.

[0005] According to a first aspect of the present invention, a robot control method is provided, applied to a robot control system, comprising: Receive multi-source status messages from the robot at the current moment, and generate a set of current status fields based on the multi-source status messages; Compare the current state field set with the historical state field set, and save a snapshot of the state before and after the change if the comparison result indicates that the field content has changed. Obtain the event domain identifier corresponding to the changed field, and find the serial executor corresponding to the event domain identifier. Here, the event domain is a set of tasks with sequential constraints, and the serial executor is used to execute the set of tasks according to the sequential constraints. Based on the state comparison snapshot, determine at least two control tasks contained in the event domain, and submit the control tasks to the serial executor for execution.

[0006] According to a second aspect of the present invention, a robot control system is provided, comprising: The state aggregator is configured to receive multi-source state messages from the robot at the current moment and generate a set of current state fields based on the multi-source state messages. The change detector is configured to compare the current set of state fields with the set of historical state fields, and save a snapshot of the state before and after the change if the comparison result indicates that the field content has changed. The serial execution pool manager is configured to obtain the event domain identifier corresponding to the changed field, and find the serial executor corresponding to the event domain identifier. Here, the event domain is a set of tasks with sequential constraints, and the serial executor is used to execute the set of tasks according to the sequential constraints. An asynchronous thread pool is configured to determine at least two control tasks within an event domain based on a state comparison snapshot, and then submit the control tasks to a serial executor for execution.

[0007] According to a third aspect of the present invention, a computing device is provided, comprising: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions, which, when executed by the processor, implement the steps of the robot control method described above.

[0008] According to a fourth aspect of the present invention, a computer-readable storage medium is provided that stores a computer program / instructions which, when executed by a processor, implement the steps of the robot control method described above.

[0009] According to a fifth aspect of the present invention, a computer program product is provided, including a computer program / instructions that, when executed by a processor, implement the steps of the robot control method described above.

[0010] One embodiment of the present invention implements receiving multi-source state messages of a robot at the current moment, generating a current state field set based on the multi-source state messages; comparing the current state field set with a historical state field set, and saving a state comparison snapshot before and after the change if the comparison result indicates that the field content has changed; obtaining the event domain identifier corresponding to the changed field, and finding the serial executor corresponding to the event domain identifier, wherein the event domain is a set of tasks with sequential constraints, and the serial executor is used to execute the set of tasks according to the sequential constraints; determining at least two control tasks contained in the event domain based on the state comparison snapshot, and submitting the control tasks to the serial executor for execution.

[0011] By aggregating the status fields in multi-source status messages into a current status field set and comparing it with the historical status field set, changes in fields can be accurately identified and state snapshots before and after the changes can be saved, avoiding repeated triggering. By obtaining the event domain identifier corresponding to the changed field and finding the corresponding serial actuator, at least two control tasks generated based on the status snapshot are submitted to the queue of the serial actuator for execution, ensuring that tasks with sequential constraints within the same event domain are executed one by one in a preset order, thereby avoiding task conflicts and execution chaos, and improving the accuracy and reliability of robot control. Attached Figure Description

[0012] Figure 1 This is a flowchart of a robot control method provided in one embodiment of the present invention; Figure 2 This is a flowchart illustrating the processing steps of a robot control method according to an embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of a robot control system provided in one embodiment of the present invention; Figure 4 This is a structural block diagram of a computing device provided in one embodiment of the present invention. Detailed Implementation

[0013] Numerous specific details are set forth in the following description to provide a full understanding of the invention. However, the invention can be practiced in many other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.

[0014] The terminology used in one or more embodiments of the present invention is for the purpose of describing particular embodiments only and is not intended to limit the scope of the invention. The singular forms “a,” “the,” and “the” used in one or more embodiments of the invention and in the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” used in one or more embodiments of the invention refers to and includes any or all possible combinations of one or more associated listed items.

[0015] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of the present invention, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of the present invention, and similarly, second may also be referred to as first. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."

[0016] Furthermore, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of the present invention are all information and data authorized by the user or fully authorized by all parties. Moreover, the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0017] First, the terminology used in one or more embodiments of the present invention will be explained.

[0018] Event domain: A set of tasks that have the same sequential constraints and share a serial executor.

[0019] State snapshot: A snapshot of the old and new aggregate objects that are saved when the state changes and cannot be modified by subsequent messages.

[0020] Change filtering: Do not create business callback tasks when the status-related fields have not changed.

[0021] Serial executor: A single working thread or equivalent unit of execution that executes tasks in an event domain one by one in the order they are submitted.

[0022] Ordinary asynchronous tasks: Tasks that do not require strict order with the robot's state and can be executed in parallel by a multi-threaded pool.

[0023] The robot frequently sends messages about its mode, body control, falls, trajectory playback, and behavioral status. Multiple agent functions may register status callbacks simultaneously for updating the interface, resuming the robot, switching actions, and recording operational status. A large number of unchanged messages can lead to duplicate calculations; if each ROS2 callback thread directly calls the business callback, the same robot state sequence may be processed concurrently by multiple threads, resulting in disordered page switching, old states overwriting new states, or reversed control action order.

[0024] While putting all business tasks into a single thread can guarantee the order, it will cause irrelevant tasks such as logging, storage, and network reporting to block robot state processing; pre-creating a thread for each type of message will increase idle threads and resource overhead.

[0025] This invention primarily addresses the following technical problems: how to filter robot state messages that do not produce effective changes, generate stable snapshots of old and new states for messages that have changed, and sensitively execute callbacks according to the serial execution order of the control event domain, while allowing unrelated tasks to continue in parallel; how to ensure that the solution maintains consistent processing results under conditions of rapid changes in robot state, concurrent requests, or abnormal input; how to reuse existing components, states, and control execution paths of the robot agent to reduce new processes and cross-module links; and how to provide explicit processing results for failed, ineffective, or conflicting requests to avoid uncertain control behavior.

[0026] This invention provides a method for filtering changes in robot state callbacks and serial execution of event domains. The system includes a ROS2 state subscriber, a state aggregator, a change detector, a serial execution pool manager for key indexes, a general asynchronous thread pool, and a business callback registry. Instead of adding a separate high-privilege daemon, it adds corresponding processing modules to the existing state subscription, component management, and control call chain of the robot agent, enabling the new mechanism to reuse existing message models, lifecycles, and exception return paths.

[0027] This invention provides a robot control method, and also relates to a robot control system, a computing device, a computer-readable storage medium, and a computer program product, which will be described in detail in the following embodiments.

[0028] See Figure 1 , Figure 1 This is a flowchart of a robot control method provided in one embodiment of the present invention, specifically including the following steps 102-108.

[0029] Step 102: Receive the robot's multi-source status messages at the current moment, and generate a set of current status fields based on the multi-source status messages.

[0030] Among them, the multi-source state message is used to represent the set of robot state data from different sensors and internal modules; the current state field set is used to represent the aggregation result of each state field of the robot at the current moment; and the message type is used to represent the sensor or internal module category corresponding to the state message.

[0031] In practical applications, the system can process multi-source status messages one by one according to the order of message arrival. Each message processed involves a copy and replacement operation, allowing the temporary set to be gradually accumulated and updated. In a specific embodiment of the present invention, the system first caches all multi-source status messages received at the current moment, then extracts the status fields uniformly and replaces them in batches to the temporary set, reducing the number of copies.

[0032] In a specific embodiment of the present invention, taking a robot equipped with a position sensor, an attitude sensor, and a battery monitoring module as an example, the system receives position messages reported by the position sensor, attitude messages reported by the attitude sensor, and battery messages reported by the battery monitoring module at the current moment. The system parses the position message as a position type and extracts two status fields: x-coordinate and y-coordinate. It also parses the attitude message as an attitude type and extracts two status fields: heading angle and pitch angle. Finally, it parses the battery message as a battery type and extracts the remaining battery percentage status field. The system copies an existing aggregated status field set to obtain a temporary set, which already contains the x-coordinate, y-coordinate, heading angle, pitch angle, and remaining battery percentage from the previous moment. The system then replaces the extracted x-coordinate, y-coordinate, heading angle, pitch angle, and remaining battery percentage in the corresponding positions of the temporary set according to their field names, obtaining an updated temporary set, which is then determined as the current status field set.

[0033] Furthermore, the robot receives multi-source status messages at the current moment and generates a current status field set based on the multi-source status messages, including: parsing the message type carried by each message in the multi-source status messages and extracting the status fields that match the message type; copying the existing aggregated status field set to obtain a temporary set, replacing the extracted status fields with the corresponding positions in the temporary set according to the field name; and determining the temporary set after the replacement as the current status field set.

[0034] Among them, the multi-source state message is used to represent the set of robot state data from different sensors and internal modules; the current state field set is used to represent the aggregation result of each state field of the robot at the current moment; and the message type is used to represent the sensor or internal module category corresponding to the state message.

[0035] During operation, the system continuously receives multi-source status messages from the robot at the current moment, each message carrying a corresponding message type. The system parses each message's message type, determines the range of status fields contained within that message based on the message type, and extracts the status fields matching the message type. For each extracted status field, the system copies the existing aggregated status field set to create a temporary set, and replaces the extracted status fields in the corresponding positions within the temporary set according to their field names. During the replacement process, if a field with the same name exists in the temporary set, the newly extracted field value overwrites the old value; if the corresponding field name does not exist in the temporary set, the field is added. The temporary set after the replacement is defined as the current status field set for subsequent change detection.

[0036] In practical applications, the system can process multi-source status messages one by one according to the order of message arrival. Each message processed involves one copy and replacement operation, allowing the temporary set to be gradually accumulated and updated. In a specific embodiment of the present invention, the system first caches all multi-source status messages received at the current moment, then extracts the status fields uniformly and replaces them in batches to the temporary set, reducing the number of copies.

[0037] In a specific embodiment of the present invention, taking a robot equipped with a position sensor, an attitude sensor, and a power monitoring module as an example, the system receives position messages reported by the position sensor, attitude messages reported by the attitude sensor, and power messages reported by the power monitoring module at the current moment. The system parses the position message as a position type and extracts two status fields: x-coordinate and y-coordinate. It also parses the attitude message as an attitude type and extracts two status fields: heading angle and pitch angle. Finally, it parses the power message as a power type and extracts the remaining power percentage status field. The system copies an existing aggregated status field set to obtain a temporary set, which already contains the x-coordinate, y-coordinate, heading angle, pitch angle, and remaining power percentage from the previous moment. The system then replaces the extracted x-coordinate, y-coordinate, heading angle, pitch angle, and remaining power percentage in the corresponding positions of the temporary set according to their field names, obtaining an updated temporary set, which is then determined as the current status field set.

[0038] Based on this, by copying the existing aggregated state field set to obtain a temporary set and replacing it by field name, it is possible to update each field while preserving the integrity of the original state, avoiding the loss of fields during the aggregation process, and ensuring the accuracy and integrity of the current state field set.

[0039] Furthermore, the extracted status fields are replaced with the corresponding positions in the temporary set according to the field name, including: for multiple status fields with the same field name, the value of the field to be retained is determined according to the preset priority of the message source to which each status field belongs; the value of the retained field is written into the corresponding field name to generate the current status field set.

[0040] Among them, the message source is used to represent the sensor or internal module corresponding to the status field; the preset priority is used to represent the retention order of different message sources when there is a conflict in the same field; the retained field value is the field value that is finally written to the temporary set after priority determination.

[0041] When replacing extracted status fields with their names in the corresponding positions of a temporary set, the system checks for multiple status fields with the same name. If a name conflict exists, the system retrieves the message source for each status field and queries the preset priority of each source. Based on the preset priority, the system determines the status field corresponding to the message source with the highest priority as the reserved field value. The system writes the reserved field value to the corresponding field name position in the temporary set, generating the current status field set. If no name conflict exists, the system directly writes the extracted status fields to the corresponding positions in the temporary set.

[0042] In practical applications, preset priorities can be set based on the data precision and update frequency of the message source. Message sources with higher data precision or faster update frequency correspond to higher priorities. In a specific embodiment of the present invention, the system assigns one priority value to each type of message source. The larger the value, the higher the priority. When the system encounters a conflict between fields with the same name, it selects the status field corresponding to the message source with the highest priority value as the reserved field value.

[0043] In a specific embodiment of the present invention, taking a robot equipped with position sensor A and position sensor B as an example, both of which report a horizontal coordinate field. The system extracts a horizontal coordinate field value of 100 from the message reported by position sensor A and a horizontal coordinate field value of 102 from the message reported by position sensor B. The system detects that there are two status fields in the horizontal coordinate field, and determines that their respective message sources are position sensor A and position sensor B. In the preset priority, position sensor A has a higher priority than position sensor B. Based on this, the system determines to retain the field value of 100, writes 100 into the corresponding position of the horizontal coordinate field in a temporary set, and generates the current status field set.

[0044] Based on this, by determining the reserved field values ​​according to the preset priority of the message source to which each status field belongs, it is possible to select a more reliable data source when there is a conflict between fields with the same name, avoid the field values ​​of low-priority sources from overwriting the field values ​​of high-priority sources, and ensure the accuracy and reliability of the field values ​​in the current status field set.

[0045] Step 104: Compare the current state field set with the historical state field set, and save a snapshot of the state before and after the change if the comparison result indicates that the field content has changed.

[0046] Among them, the historical state field set is used to represent the set of state fields saved after aggregation processing at the previous moment; the state comparison snapshot is used to represent the combination of field values ​​of the same field before and after the change; the comparison result is used to represent the field differences between the current state field set and the historical state field set.

[0047] In practical applications, the system can perform comparisons only on preset fields of interest, rather than comparing all target fields one by one, to reduce comparison overhead. In a specific embodiment of the present invention, the system compares all target fields one by one, and when the value of any target field changes, it saves both the historical value and the current value of that field to a state comparison snapshot, so that the state comparison snapshot contains complete field change information.

[0048] In a specific embodiment of the present invention, taking a robot equipped with a position sensor and a power monitoring module as an example, the current state field set generated by the system at the current moment includes a horizontal axis field value of 100, a vertical axis field value of 50, and a remaining power percentage field value of 80. The corresponding field values ​​stored in the historical state field set are 100 for the horizontal axis, 50 for the vertical axis, and 90 for the remaining power percentage. The system identifies these three fields as common target fields, compares them one by one, and finds that the horizontal and vertical axis field values ​​are consistent, and the remaining power percentage has changed from 90 to 80. The system determines that the field content has changed, and combines the historical field value of 90 for the remaining power percentage with the current field value of 80 to save a state comparison snapshot.

[0049] Furthermore, the current state field set is compared with the historical state field set, and a snapshot of the state before and after the change is saved when the comparison result indicates that the field content has changed. This includes: identifying the target field that exists in both the current state field set and the historical state field set; comparing the field values ​​corresponding to the target field in the two sets one by one; and determining that the comparison result indicates that the field content has changed when there is a difference in the field value.

[0050] Among them, the historical state field set is used to represent the set of state fields saved after aggregation processing at the previous moment; the target field is used to represent the field that exists in both the current state field set and the historical state field set; the state comparison snapshot is used to represent the combination of field values ​​of the same field before and after the change; and the comparison result is used to represent the field differences between the current state field set and the historical state field set.

[0051] The system obtains the current state field set and the historical state field set, iterates through the field names in both sets, and identifies fields present in both sets as target fields. The system compares the field value of each target field in the current state field set with its value in the historical state field set, obtaining the comparison result for each target field. If the comparison result indicates a difference in the value of a target field, the system determines that the field content has changed, extracts the field value in the current state field set and the value in the historical state field set, and combines them to save a state comparison snapshot. If the comparison result indicates that the values ​​of all target fields are identical, the system determines that the field content has not changed, and no state comparison snapshot is generated.

[0052] In practical applications, the system can perform comparisons only on preset fields of interest, rather than comparing all target fields one by one, to reduce comparison overhead. In a specific embodiment of the present invention, the system compares all target fields one by one, and when the value of any target field changes, it saves both the historical value and the current value of that field to a state comparison snapshot, so that the state comparison snapshot contains complete field change information.

[0053] In a specific embodiment of the present invention, taking a robot equipped with a position sensor and a power monitoring module as an example, the current state field set generated by the system at the current moment includes a horizontal axis field value of 100, a vertical axis field value of 50, and a remaining power percentage field value of 80. The corresponding field values ​​stored in the historical state field set are 100 for the horizontal axis, 50 for the vertical axis, and 90 for the remaining power percentage. The system identifies the horizontal axis, vertical axis, and remaining power percentage as three target fields, and after comparing them one by one, finds that the field values ​​of the horizontal axis and vertical axis are consistent, and the remaining power percentage has changed from 90 to 80. The system determines that the content of the remaining power percentage field has changed, and combines the historical field value of 90 and the current field value of 80 to save a state comparison snapshot.

[0054] Based on this, by identifying the target field that exists in both sets and comparing the field values ​​one by one, it is possible to accurately locate the specific field that has changed and save a snapshot of the state before and after the change for subsequent processing, avoiding repeated triggering of the unchanged state and reducing unnecessary processing overhead.

[0055] Furthermore, before comparing the current state field set with the historical state field set and saving a snapshot of the state before and after the change if the comparison result indicates that the field content has changed, the system also includes: receiving the robot's initial state message during the system initialization phase; generating an initial state field set based on the initial state message; and storing the initial state field set as a historical state field set.

[0056] The initial state message is used to characterize the robot state message received for the first time after the system starts; the initial state field set is used to characterize the first aggregated state field set generated based on the initial state message.

[0057] During the initialization phase, the system receives initial state messages from the robot. These initial state messages are the first state messages received from various sensors and internal modules after system startup. The system parses the message type carried in each initial state message, extracts state fields matching the message type, copies the existing aggregated state field set to obtain a temporary set, and replaces the extracted state fields in the corresponding positions in the temporary set according to their field names. The temporary set after replacement is determined as the initial state field set. If the system starts for the first time and the temporary set is empty, the system directly writes the extracted state fields into the empty temporary set according to their field names, generating the initial state field set. The system stores the initial state field set as a historical state field set for subsequent state change detection.

[0058] In practical applications, the system can wait for all sensors and internal modules to report initial status messages during the initialization phase before generating a unified set of initial status fields. In one specific embodiment of the present invention, the system sets a waiting period during the initialization phase. All status messages received within this waiting period are processed as initial status messages, and the system enters the normal operation phase after the waiting period has elapsed.

[0059] In a specific embodiment of the present invention, taking a robot equipped with a position sensor, an attitude sensor, and a power monitoring module as an example, the system receives initial position messages reported by the position sensor, initial attitude messages reported by the attitude sensor, and initial power messages reported by the power monitoring module during the initialization phase. The system parses the initial position message to extract that the x-coordinate is 0 and the y-coordinate is 0; parses the initial attitude message to extract that the heading angle is 0 and the pitch angle is 0; and parses the initial power message to extract that the remaining power percentage is 100%. The system writes these five state fields into an empty temporary set to generate an initial state field set, and stores it as a historical state field set. When the system performs change detection for the first time in subsequent operations, it compares the current state field set with this historical state field set.

[0060] Based on this, by receiving the initial state message during the system initialization phase and generating and storing the initial state field set as the historical state field set, an effective comparison benchmark can be established when the system starts up, ensuring the normal execution of subsequent state change detection and avoiding the failure of change detection due to the lack of historical benchmark.

[0061] Step 106: Obtain the event domain identifier corresponding to the changed field, and find the serial executor corresponding to the event domain identifier. Here, the event domain is a set of tasks with sequential constraints, and the serial executor is used to execute the set of tasks according to the sequential constraints.

[0062] Among them, the event domain is used to represent a set of tasks with sequential constraints; the event domain identifier is used to represent the affiliation relationship between the variable field and the event domain; the serial executor is used to represent a single-threaded execution unit that executes tasks in the same event domain one by one according to sequential constraints; and the event domain map is used to maintain the correspondence between the variable field, the event domain identifier, and the serial executor.

[0063] In practical applications, event domain mappings can be stored as key-value mappings. The system uses the changed field as the key for retrieval to obtain the corresponding event domain identifier and serial executor. In a specific embodiment of the present invention, the system maintains an event domain mapping table, in which each changed field corresponds to an event domain identifier, and each event domain identifier corresponds to a serial executor. The system completes routing by looking up the table.

[0064] In a specific embodiment of the present invention, taking a robot equipped with a position sensor, an attitude sensor, and a power monitoring module as an example, the event domain mapping is pre-configured with: position-related fields corresponding to navigation event domains, where the serial actuator is a navigation actuator; attitude-related fields corresponding to motion control event domains, where the serial actuator is a motion control actuator; and power-related fields corresponding to power management event domains, where the serial actuator is a power management actuator. When the system detects a change in the remaining power percentage field, it searches the event domain mapping using the remaining power percentage field to obtain the corresponding event domain identifier as the power management event domain, and then obtains the serial actuator bound to the power management event domain, i.e., the power management actuator.

[0065] Further, obtaining the event domain identifier corresponding to the changed field and finding the serial executor corresponding to the event domain identifier includes: searching in a preset event domain mapping according to the changed field to obtain the search results, wherein the event domain mapping is used to maintain the correspondence between the changed field, the event domain identifier, and the serial executor; if the search results indicate that a corresponding event domain identifier exists, obtaining the serial executor bound to the event domain identifier.

[0066] Among them, the event domain is used to represent a set of tasks with sequential constraints; the event domain identifier is used to represent the affiliation relationship between the variable field and the event domain; the serial executor is used to represent a single-threaded execution unit that executes tasks in the same event domain one by one according to sequential constraints; and the event domain map is used to maintain the correspondence between the variable field, the event domain identifier, and the serial executor.

[0067] The system acquires changed fields and searches for them in a pre-defined event domain mapping to obtain search results. The event domain mapping maintains a pre-maintained correspondence between changed fields, event domain identifiers, and serial executors. Each mapping record contains one changed field, the event domain identifier to which the changed field belongs, and the serial executor bound to that event domain identifier. If the search results indicate that an event domain identifier corresponding to a changed field exists in the event domain mapping, the system retrieves the serial executor bound to that event domain identifier from the event domain mapping. This serial executor is an execution unit specifically created for this event domain during system initialization, used to execute tasks within that event domain in a sequential manner. If the search results indicate that no event domain identifier corresponding to a changed field exists in the event domain mapping, the system determines that the changed field does not belong to any event domain and does not perform any subsequent task submission operations.

[0068] In practical applications, event domain mappings can be stored in the form of key-value mappings. The system uses the changed field as the key for retrieval to obtain the corresponding event domain identifier and serial executor. In a specific embodiment of the present invention, the system maintains an event domain mapping table, in which each changed field corresponds to one event domain identifier, and each event domain identifier corresponds to one serial executor. The system completes routing by looking up the table.

[0069] In a specific embodiment of the present invention, taking a robot equipped with a position sensor, an attitude sensor, and a power monitoring module as an example, the event domain mapping is pre-configured with: position-related fields corresponding to navigation event domains, where the serial actuator is a navigation actuator; attitude-related fields corresponding to motion control event domains, where the serial actuator is a motion control actuator; and power-related fields corresponding to power management event domains, where the serial actuator is a power management actuator. When the system detects a change in the remaining power percentage field, it searches the event domain mapping using the remaining power percentage field. The search result indicates the existence of a corresponding event domain identifier, i.e., the power management event domain. The system further obtains the serial actuator bound to the power management event domain, i.e., the power management actuator.

[0070] Based on this, by retrieving the event domain identifier corresponding to the changed field in the event domain mapping and obtaining the bound serial executor, the changed field can be accurately routed to the corresponding execution channel, ensuring that tasks with sequential constraints within the same event domain are executed one by one by the same serial executor, thus avoiding task conflicts and execution chaos.

[0071] Furthermore, before obtaining the event domain identifier corresponding to the changed field and finding the serial executor corresponding to the event domain identifier, the process also includes: receiving the callback function and the event domain identifier declared by the callback function submitted by the functional module; registering the callback function to the callback registry, wherein the callback registry is used to maintain the attribution relationship between the callback function and the event domain identifier; receiving event domain configuration information, wherein the event domain configuration information is used to define the tasks contained in the event domain and the order constraints between the tasks; creating a corresponding serial executor for each event domain and establishing the binding relationship between the event domain identifier and the serial executor.

[0072] Among them, the functional module is used to characterize the module that provides specific business processing logic in the robot control system; the callback registry is used to maintain the attribution relationship between callback functions and event domain identifiers; the event domain configuration information is used to define the tasks contained in the event domain and the sequence constraints between tasks; and the binding relationship is used to characterize the one-to-one correspondence between event domain identifiers and serial actuators.

[0073] The system receives callback functions and event domain identifiers declared by functional modules, and registers the callback functions to the callback registry. During registration, the system associates and stores callback functions with the event domain identifiers declared by functional modules, ensuring that at least one callback function is attached to each event domain identifier. The system receives event domain configuration information, which defines the tasks contained in each event domain and the order constraints between tasks. Based on the event domain configuration information, the system creates a corresponding serial executor for each event domain. This serial executor is a single-threaded execution unit used to execute the tasks within the event domain one by one according to the order constraints defined in the event domain configuration information. The system establishes a binding relationship between event domain identifiers and serial executors, and writes this binding relationship into the event domain mapping for subsequent use in retrieving changed fields.

[0074] In practical applications, functional modules can submit callback functions centrally during system startup or dynamically during runtime. In a specific embodiment of the present invention, the system uniformly receives callback functions and event domain configuration information submitted by all functional modules during the initialization phase, completes the construction of the callback registry and the creation and binding of all serial executors, and does not modify the mapping relationship during runtime.

[0075] In a specific embodiment of the present invention, taking a robot equipped with a position sensor, an attitude sensor, and a power monitoring module as an example, the system receives a path planning callback function submitted by the navigation function module during the initialization phase. This callback function declares its event domain identifier as the navigation event domain. It also receives an attitude adjustment callback function submitted by the motion control function module, which declares its event domain identifier as the motion control event domain. Furthermore, it receives a power alarm callback function and a low-power switching callback function submitted by the power management function module, both of which declare their event domain identifier as the power management event domain. The system registers these callback functions to their corresponding event domain identifiers in the callback registry. The system receives event domain configuration information, where the navigation event domain includes a path planning task, the motion control event domain includes an attitude adjustment task, and the power management event domain includes a power alarm task and a low-power switching task, with the power alarm task executing before the low-power switching task. The system creates a navigation actuator for the navigation event domain, a motion control actuator for the motion control event domain, and a power management actuator for the power management event domain, and writes the three sets of binding relationships into the event domain mapping.

[0076] Based on this, by receiving callback functions submitted by the functional module and registering them to the callback registry, and establishing a binding relationship for each event domain by creating a serial executor for each event domain according to the event domain configuration information, the complete mapping between callback functions and execution channels can be completed before the system runs. This ensures that the corresponding callback function set and serial executor can be accurately obtained when subsequent changes are retrieved, providing a foundation for the orderly execution of tasks.

[0077] Step 108: Determine at least two control tasks contained in the event domain based on the state comparison snapshot, and submit the control tasks to the serial executor for execution.

[0078] Among them, the control task is used to represent the processing unit generated based on the state comparison snapshot and that needs to be executed by the serial executor; the task triggering rule is used to represent the correspondence between the field change type and the control task; and the callback function set is used to represent all callback functions registered in the event domain.

[0079] The system extracts the changed target fields and their change types from the state comparison snapshot, where change types include field value increase, field value decrease, and field value from zero to one. The system matches the target fields and their change types with the task triggering rules corresponding to the event domain to obtain the matching results. Based on the matching results, the system determines that the event domain contains at least two control tasks and encapsulates these control tasks into task objects. Each task object carries a set of callback functions corresponding to the state comparison snapshot and the event domain, including all callback functions registered in the event domain. The system writes the task objects into the task queue of the serial executor according to the message processing order. The task queue buffers tasks to be executed and outputs them to the serial executor one by one in the order they are written. In the single worker thread of the serial executor, the system retrieves task objects one by one according to the writing order of the task queue and, under the protection of a callback list lock, traverses and executes the set of callback functions within the task object.

[0080] In practical applications, the system can sort at least two control tasks according to the order constraints of the event domain before submitting them, ensuring that the tasks are executed in the order constraints. In a specific embodiment of the present invention, the system sets the task triggering rule to a direct mapping between field change type and control task identifier. The system determines the control task to be executed based on the control task identifier matched in the matching result, and submits the control tasks to the task queue of the serial executor in sequence according to the preset task priority order in the event domain.

[0081] In a specific embodiment of the present invention, taking the power management event domain as an example, this event domain includes two control tasks: a power alarm task and a low-power mode switching task. The system extracts from the state comparison snapshot that the remaining power percentage field changes from 90 to 80, with the change type being a decrease in the field value. The system matches the remaining power percentage field and its decrease type with the task triggering rules corresponding to the power management event domain. The matching result indicates that the power alarm task and the low-power mode switching task have been matched. The system encapsulates the two control tasks into task objects, each task object carrying the state comparison snapshot and all callback functions registered in the power management event domain. The system writes the two task objects into the task queue of the power management executor according to the message processing order. The single worker thread of the power management executor retrieves the task objects one by one according to the writing order and, under the protection of the callback list lock, traverses and executes the set of callback functions in each task object.

[0082] Further, based on the state comparison snapshot, at least two control tasks contained in the event domain are determined, and the control tasks are submitted to the serial executor for execution, including: extracting the changed target fields and their change types from the state comparison snapshot; matching the target fields and their change types with the task triggering rules corresponding to the event domain; determining at least two control tasks contained in the event domain based on the matching results, and submitting the control tasks to the serial executor for execution.

[0083] Among them, the change type is used to characterize the direction of change of field value, including field value increase, field value decrease, and field value from zero to one; the task triggering rule is used to characterize the correspondence between field change type and control task; the control task is used to characterize the processing unit generated based on state comparison snapshot and that needs to be executed by serial executor.

[0084] The system extracts the changed target fields and their change types from the state comparison snapshot. The system matches the target fields and their change types with the task triggering rules corresponding to the event domain, obtaining the matching results. Based on the matching results, the system determines at least two control tasks contained in the event domain and submits these control tasks to the serial executor for execution. If the matching results indicate that the target field and its change type match at least two task triggering rules, the system determines the control tasks corresponding to each matched task triggering rule as the control tasks to be executed. The system encapsulates the at least two control tasks into task objects, determines the submission order of the at least two control tasks according to the order constraints of the event domain, and submits the task objects to the task queue of the serial executor, which then executes them one by one in the submission order.

[0085] In practical applications, the system can set the task triggering rule as a direct mapping from the combination of field identifier and change type to the control task identifier. The system determines the control task to be executed based on the matched control task identifier. In a specific embodiment of the present invention, the system sorts at least two control tasks according to the order constraints of the event domain and submits them to the serial executor to ensure that the control tasks are executed sequentially according to the order constraints.

[0086] In a specific embodiment of the present invention, taking the power management event domain as an example, the task triggering rules corresponding to this event domain are configured such that the combination of the remaining power percentage field and the decrease in field value triggers both the power alarm task and the low-power mode switching task. The system extracts from the state comparison snapshot that the remaining power percentage field changes from 90 to 80, with the change type being a decrease in field value. The system matches the remaining power percentage field and its decrease type with the task triggering rules, and the matching result indicates that two control tasks are triggered: the power alarm task and the low-power mode switching task. The system encapsulates the power alarm task and the low-power mode switching task into task objects, determines that the power alarm task is executed before the low-power mode switching task according to the order constraints of the power management event domain, and submits the two task objects sequentially to the task queue of the power management executor, which then executes them one by one in the submission order.

[0087] Based on this, by extracting the changed fields and their change types from the state comparison snapshot and matching them with the task triggering rules to determine at least two control tasks, and then submitting them to the serial executor for execution according to the order constraints of the event domain, it can be ensured that multiple control tasks in the same event domain are executed one by one according to the order constraints, avoiding out-of-order execution and duplicate submission of tasks.

[0088] Further, based on the matching results, at least two control tasks are determined to be contained in the event domain. These control tasks are then submitted to the serial executor for execution. This includes: determining the submission order of at least two control tasks based on the matching results and the order constraints of the event domain; encapsulating the control tasks into task objects, each task object carrying a set of callback functions corresponding to a state comparison snapshot and the event domain, wherein the callback function set includes all callback functions registered in the event domain; writing the task objects into the task queue of the serial executor according to the message processing order, wherein the task queue is used to cache tasks to be executed and output them to the serial executor one by one in the writing order; and in the single worker thread of the serial executor, retrieving task objects one by one in the writing order of the task queue and traversing and executing the set of callback functions in the task objects under the protection of a callback list lock.

[0089] Among them, the submission order is used to characterize the execution sequence of multiple control tasks; the task object is used to characterize the executable unit after encapsulating the state comparison snapshot and the callback function set; the callback function set is used to characterize all callback functions registered in the event domain; the task queue is used to cache the tasks to be executed and output them to the serial executor one by one in the order of writing; the single worker thread is used to characterize the thread that executes the task object in the serial executor; and the callback list lock is used to characterize the synchronization mechanism that protects the callback list from concurrency when traversing the callback function set.

[0090] The system determines the submission order of at least two control tasks based on the matching results and the order constraints of the event domain. Each control task is encapsulated as a task object, carrying a state comparison snapshot and a set of callback functions corresponding to the event domain. The callback function set includes all callback functions registered in the event domain. The system writes the task objects into the task queue of the serial executor according to the message processing order. The task queue buffers tasks to be executed and outputs them to the serial executor one by one in the order they are written. In the single worker thread of the serial executor, the system retrieves task objects one by one according to the writing order of the task queue and iterates through the callback function set within the task object under the protection of a callback list lock. During the iteration and execution, the single worker thread sequentially calls each callback function in the callback function set, passing the state comparison snapshot carried by the task object to each callback function for execution.

[0091] In practical applications, the system can sort control tasks according to the order constraints of event domains, ensuring that control tasks with prior order constraints are written into the task queue first. In a specific embodiment of the present invention, when encapsulating a task object, the system writes the state comparison snapshot and the event domain identifier into the task object together, enabling the serial executor to retrieve the corresponding set of callback functions from the callback registry based on the event domain identifier during execution.

[0092] In a specific embodiment of the present invention, taking the power management event domain as an example, the system determines two control tasks based on the matching results: a power alarm task and a low-power mode switching task. The system determines that the submission order of the power alarm task precedes that of the low-power mode switching task based on the order constraints of the power management event domain. The system encapsulates the power alarm task into a first task object, carrying a state comparison snapshot and two callback functions registered in the power management event domain: a power alarm callback function and a low-power mode switching callback function. The system also encapsulates the low-power mode switching task into a second task object, similarly carrying a state comparison snapshot and the aforementioned two callback functions. The system writes the two task objects into the task queue of the power management executor according to the message processing order. The single worker thread of the power management executor first retrieves the first task object according to the writing order, and then, under the protection of the callback list lock, sequentially traverses and executes the power alarm callback function and the low-power mode switching callback function. After execution, it retrieves the second task object for execution.

[0093] Based on this, by determining the submission order according to the sequence constraints and encapsulating the control tasks with a set of callback functions and writing them into the task queue in the order of message processing, a single worker thread retrieves and executes them one by one under the protection of the callback list lock. This ensures that multiple control tasks are executed sequentially according to the sequence constraints and that the callback function traversal process is not affected by concurrency, thus avoiding data inconsistency caused by task out-of-order and concurrent access to callback functions.

[0094] Furthermore, the method also includes: receiving the task execution result returned by the serial executor; and updating the current state field set to the historical state field set based on the task execution result.

[0095] Among them, the task execution result is used to characterize the completion status information of the serial executor after the control task has been completed.

[0096] The system receives the task execution results returned by the serial executor, which are generated after the single worker thread of the serial executor completes the traversal and execution of the callback function set in the task object. Based on the task execution results, the system updates the current state field set to the historical state field set. Specifically, it copies the field values ​​of each field in the current state field set and overwrites the corresponding field values ​​in the historical state field set, ensuring consistency between the two sets. Fields present in the current state field set but not in the historical state field set are added to the historical state field set. The updated historical state field set serves as the benchmark for the next round of state change detection.

[0097] In practical applications, the system can update the historical status field set uniformly after all batches of control tasks have been executed, or it can update it immediately after each control task has been executed. In a specific embodiment of the present invention, after all task objects in the task queue of the serial executor have been executed, the system receives the batch task execution results returned by the serial executor, and then performs an update operation on the historical status field set once, reducing the overhead caused by frequent updates.

[0098] In a specific embodiment of the present invention, taking the power management event domain as an example, the system generates a current state field set with a remaining power percentage value of 80 and a historical state field set with a remaining power percentage value of 90. After submitting the power alarm task and the low-power mode switching task to the power management executor for execution, the system receives the task execution results returned by the power management executor, indicating that both control tasks have been completed. The system overwrites the remaining power percentage field value of 90 in the historical state field set with the remaining power percentage field value of 80 in the current state field set, updating the historical state field set to have a remaining power percentage value of 80. When the system receives a new state message and generates a new current state field set at the next moment, it will use the updated historical state field set, i.e., the remaining power percentage of 80, as the comparison benchmark.

[0099] Based on this, by updating the current state field set to the historical state field set according to the task execution result after the control task is completed, it can be ensured that the comparison benchmark always reflects the state of the most recently completed processing, and avoid repeated identification of processed state changes, which would lead to repeated triggering of control tasks.

[0100] Furthermore, after submitting the control task to the serial executor for execution, the method further includes: monitoring the execution status of the serial executor, wherein the execution status is used to characterize whether the serial executor is currently executing a task; and when the execution status indicates that the serial executor is idle, notifying the serial executor to execute the next control task to be executed.

[0101] Among them, the execution status is used to characterize whether the serial executor is currently executing a task; the control task to be executed is used to characterize the task object that has been written into the task queue but has not yet been retrieved by the single worker thread.

[0102] After submitting a control task to the serial executor, the system continuously monitors the execution status of the serial executor. The system obtains the execution status by querying the single-threaded work flag of the serial executor. The work flag is occupied when the single-threaded worker is executing a task object, and is idle after the single-threaded worker has completed the task object execution. When the execution status indicates that the serial executor is idle, the system checks if there are any control tasks to be executed in the task queue. If there are, the system instructs the serial executor to retrieve the next control task to be executed from the task queue in the order it was written and execute it. If there are no control tasks to be executed, the system maintains the idle state of the serial executor, waiting for new control tasks to be written to the task queue.

[0103] In practical applications, the system can poll the work flag of a single worker thread at fixed intervals to obtain the execution status, or the single worker thread can actively send an idle notification to the system after completing the current task. In a specific embodiment of the present invention, after the single worker thread of the serial executor completes the execution of one task object, the single worker thread actively sets the work flag to the idle state. After the system detects this state change, it immediately checks the task queue and triggers the execution of the next task.

[0104] In a specific embodiment of the present invention, taking the power management event domain as an example, the system sequentially writes two task objects—a power alarm task and a low-power mode switching task—into the task queue of the power management executor. The single-threaded worker of the power management executor first retrieves the first task object, the power alarm task, and begins execution; at this time, the working flag is in an occupied state. The system detects that the execution state is occupied and continues to wait. After the single-threaded worker completes the execution of the power alarm task, it sets the working flag to an idle state. The system detects that the execution state is idle, checks the task queue, finds a second task object—the low-power mode switching task—and notifies the power management executor to retrieve and execute this task object. After the single-threaded worker completes the execution of the low-power mode switching task, it sets the working flag to an idle state again. The system checks that the task queue is empty and maintains the idle state of the power management executor.

[0105] Based on this, by monitoring the execution status of the serial executor and notifying it to execute the next task when it is idle, a single worker thread can promptly obtain and execute subsequent tasks in the queue after completing the current task, avoiding task objects from being stuck in the queue and improving the overall execution efficiency of the control task.

[0106] In one embodiment of the present invention, by aggregating the state fields in multi-source state messages into a current state field set and comparing it with a historical state field set, changes in the fields can be accurately identified and state snapshots before and after the changes can be saved, avoiding repeated triggering. By obtaining the event domain identifier corresponding to the changed field and finding the corresponding serial executor, at least two control tasks generated based on the state snapshot are submitted to the queue of the serial executor for execution, ensuring that tasks with sequential constraints within the same event domain are executed one by one in a preset order, thereby avoiding task conflicts and execution chaos, and improving the accuracy and reliability of robot control.

[0107] The following is in conjunction with the appendix Figure 2 Taking the application of the robot control method provided by this invention in real-time robot state processing as an example, the robot control method will be further explained. Figure 2 This is a flowchart of a robot control method according to an embodiment of the present invention. The flowchart illustrates the relationship between input reception, condition judgment, core processing, exception branch and result output, and specifically includes the following steps.

[0108] Step 202: Receive robot status messages.

[0109] Specifically, the Agent module submits callback functions to the callback registry and declares their respective event domains. Robot status pages, automatic recovery, and action states share the `robot_states_callbacks` domain; tasks that do not require a strict order of states use a regular asynchronous thread pool.

[0110] Step 204: Update the state aggregation object.

[0111] Specifically, upon arrival of each type of ROS2 message, the current aggregate object is copied and the corresponding fields are replaced. Aggregate fields include at least robot mode, body control, action set, fall status, recovery capability, trajectory identifier, and behavior status. The entire read and replace process is performed under state lock protection.

[0112] Step 206: Has the aggregation state changed?

[0113] Step 208: Filter messages.

[0114] Specifically, it compares the aggregate object before and after the update. If all relevant fields are equal, it returns directly without submitting a thread task; if any field changes, it saves snapshots of `old_state` and `new_state`. The comparison can be a full object comparison or can use a field mask associated with the event domain.

[0115] Step 210: Save a snapshot of the old and new states.

[0116] Specifically, the snapshots of the old and new states and the callback traversal logic are encapsulated as tasks and submitted to the event domain queue in the order of message processing. Each task only uses its own snapshot and does not read the shared state object again, so subsequent messages will not change the data seen by the current task.

[0117] Step 212: Obtain the thread pool by event domain.

[0118] Specifically, the corresponding thread pool is searched in the executor map using the event domain string or enumeration as the key. If it does not exist, a thread pool containing only one worker thread is created with a delay under the protection of a map lock, and a thread name that is easy to diagnose is assigned. This creation process ensures that multiple thread pools are not created concurrently for the same event domain.

[0119] Step 214: The event domain thread pool exists.

[0120] Step 216: Delay the creation of a single-threaded pool.

[0121] Step 218: Submit the serial task.

[0122] Step 220: Call the registered callbacks in sequence.

[0123] Specifically, a single worker thread executes tasks in FIFO order and calls registered callbacks sequentially under the protection of a callback list lock. Callback exceptions are caught and logged to prevent a single functional module from interrupting the entire state queue. When the Agent stops, new tasks are rejected, and the Agent waits for tasks in the queue to complete or be canceled according to a policy.

[0124] Step 222: Other non-sequential tasks.

[0125] Step 224: Execute in parallel using a multi-threaded pool.

[0126] Specifically, Sentry initialization, parameter management, telemetry deployment, and other tasks that do not depend on the robot's state order are submitted to a multi-threaded pool and executed in parallel with the state event domain, thereby shortening the overall startup and processing time while ensuring the order of critical states.

[0127] The core data and status management for steps 202-224 above are as follows: The multi-source state subscription module receives state messages from different topics on the robot.

[0128] The state aggregation and comparison module forms RobotStatesAggregation and detects valid changes.

[0129] The snapshot module saves the state object before and after the change.

[0130] The event domain mapping module maps tasks to sequence domains such as robot_states_callbacks.

[0131] The On-Demand Thread Pool module creates a single worker thread pool for the first occurrence of an event domain.

[0132] The parallel task module executes initialization, logging, and telemetry tasks regardless of the state order.

[0133] In one implementation, immutable snapshots, shared references, or versioned data objects are passed between modules; shared structures involving pages, caches, task queues, or fault queues are protected by mutexes, serial executors, or atomic generational replacement mechanisms. Processing results include at least a success status, error code, and error description so that the calling end can distinguish between incorrect parameters, invalid objects, disallowed states, and internal execution failures.

[0134] Steps 202-224 above involve exception handling and consistency control. Before entering the core execution path, the system performs necessary field, object existence, and current robot state verifications. For duplicate, expired, or invalid inputs, the current state is not overwritten by the last write; instead, a identifiable result is returned. For asynchronous tasks, a data snapshot or generational identifier is saved at the time of task creation; if a generational change is detected during execution, the old task is canceled. For shared data updates, a complete new state is constructed first, and then committed all at once within the protected area to prevent other threads from observing partial updates.

[0135] Based on the above basic scheme, steps 202-224 above can be combined with the following preferred schemes: The preferred methods are: 1) a "register status callback and event domain" mechanism, with explicit versions or status identifiers set for its input, output, and failure states; 2) an "aggregate multi-source status" mechanism, with explicit versions or status identifiers set for its input, output, and failure states; 3) an "execute change filtering" mechanism, with explicit versions or status identifiers set for its input, output, and failure states; 4) an "obtain serial executor by event domain" mechanism, with explicit versions or status identifiers set for its input, output, and failure states; 5) a "submit snapshot task" mechanism, with explicit versions or status identifiers set for its input, output, and failure states; 6) single-threaded event domains or atomic generational replacements are preferred for sequence-sensitive processing, while ordinary asynchronous thread pools are preferred for irrelevant time-consuming tasks; 7) recording key inputs, robot status, processing time, and execution results is preferred for fault localization and subsequent strategy adjustments.

[0136] In the first embodiment, the robot continuously publishes the same walking state at a high frequency. The state comparison module detects that the aggregated object has not changed and directly filters the message. When a fall state subsequently arrives, the system saves both the walking snapshot and the fall snapshot and submits the task to the single-threaded domain `robot_states_callbacks`. The state page agent switches pages first based on the new snapshot, and the automatic recovery function then calculates the component state; the next recovery state can only be executed after the previous task is completed, thus avoiding the out-of-order display of recovery pages before fall pages.

[0137] In the second embodiment, a task in a normal state receives a high-priority fallback state while it is still in the queue. The executor can cancel low-priority old tasks that have not yet started according to a safety policy, or add the safe task to the priority queue while maintaining the callback order within the same state version.

[0138] In the third embodiment, when two requests arrive concurrently or the calling end retryes due to lack of response, the system first compares the request identifier, object version, and current state. If the content is the same and the previous request has already been completed, the existing result can be returned; if the content conflicts or the object generation has changed, a conflicting or invalid result is returned. All control side effects only occur after the verification passes and unique execution qualification is obtained.

[0139] Through steps 202-224 above, CPU, lock contention, and callback scheduling overhead are reduced by filtering duplicate state messages. New and old snapshots ensure that asynchronous callbacks read stable and comparable states. FIFO execution within the same event domain reduces the risk of out-of-order robot control, page switching, and state updates. Event domains are created on demand to avoid unused functions occupying threads for extended periods. Separation of sequence-sensitive tasks and ordinary asynchronous tasks achieves a balance between consistency and throughput. Named threads and event domain keys facilitate the identification of blocking callbacks and performance bottlenecks.

[0140] Corresponding to the above method embodiments, the present invention also provides embodiments, Figure 3 This is a schematic diagram of the structure of a robot control system provided in one embodiment of the present invention. Figure 3 As shown, the system includes: The state aggregator 302 is configured to receive multi-source state messages of the robot at the current moment and generate a set of current state fields based on the multi-source state messages.

[0141] Change detector 304 is configured to compare the current set of state fields with the set of historical state fields, and save a snapshot of the state before and after the change if the comparison result indicates that the field content has changed.

[0142] The serial execution pool manager 306 is configured to obtain the event domain identifier corresponding to the changed field and find the serial executor corresponding to the event domain identifier. Here, the event domain is a set of tasks with sequential constraints, and the serial executor is used to execute the set of tasks according to the sequential constraints.

[0143] Asynchronous thread pool 308 is configured to determine at least two control tasks contained in the event domain based on a state comparison snapshot, and submit the control tasks to the serial executor for execution.

[0144] Optionally, the state aggregator 302 is further configured to parse the message type carried by each message in the multi-source state messages, extract the state field that matches the message type; copy the existing aggregated state field set to obtain a temporary set, replace the extracted state fields in the corresponding positions in the temporary set according to the field name; and determine the temporary set after the replacement as the current state field set.

[0145] Optionally, the state aggregator 302 is further configured to determine the value of a reserved field based on the preset priority of the message source to which each state field belongs for multiple state fields with the same field name; and to write the value of the reserved field to the corresponding field name to generate the current state field set.

[0146] Optionally, the change detector 304 is further configured to identify a target field that exists in both the current state field set and the historical state field set; compare the field values ​​corresponding to the target field in the two sets one by one; and, if there is a difference in the field values, determine that the comparison result indicates that the field content has changed.

[0147] Optionally, the serial execution pool manager 306 is further configured to perform a search in a preset event domain mapping based on the changed field to obtain the search results, wherein the event domain mapping is used to maintain the correspondence between the changed field, the event domain identifier, and the serial executor; if the search results indicate that a corresponding event domain identifier exists, the serial executor bound to the event domain identifier is obtained.

[0148] Optionally, the asynchronous thread pool 308 is further configured to extract the target field that has changed and its change type from the state comparison snapshot; match the target field and its change type with the task triggering rule corresponding to the event domain; determine at least two control tasks contained in the event domain based on the matching result, and submit the control tasks to the serial executor for execution.

[0149] Optionally, the asynchronous thread pool 308 is further configured to determine the submission order of at least two control tasks based on the matching result and the order constraint of the event domain; encapsulate the control tasks into task objects, each task object carrying a state comparison snapshot and a set of callback functions corresponding to the event domain, wherein the set of callback functions includes all callback functions registered in the event domain; write the task objects into the task queue of the serial executor according to the message processing order, wherein the task queue is used to cache tasks to be executed and output them to the serial executor for execution one by one in the order of writing; in the single worker thread of the serial executor, the task objects are retrieved one by one in the order of writing in the task queue, and the set of callback functions in the task objects is traversed and executed under the protection of the callback list lock.

[0150] Optionally, the asynchronous thread pool 308 is further configured to receive the task execution results returned by the serial executor; and update the current state field set to the historical state field set based on the task execution results.

[0151] Optionally, the robot control system also includes a state subscriber, configured to receive the robot's initial state message during the system initialization phase; generate an initial state field set based on the initial state message; and store the initial state field set as a historical state field set.

[0152] Optionally, the robot control system also includes a business callback registry, configured to receive callback functions and event domain identifiers declared by the callback functions submitted by the functional modules, register the callback functions to the callback registry, wherein the callback registry is used to maintain the attribution relationship between callback functions and event domain identifiers; receive event domain configuration information, wherein the event domain configuration information is used to define the tasks contained in the event domain and the order constraints between the tasks; create a corresponding serial executor for each event domain, and establish a binding relationship between the event domain identifier and the serial executor.

[0153] Optionally, the robot control system also includes an execution detector configured to monitor the execution status of the serial actuator, wherein the execution status is used to characterize whether the serial actuator is currently performing a task; and when the execution status indicates that the serial actuator is idle, the serial actuator is notified to perform the next control task to be performed.

[0154] Applied to this robot control system, by aggregating the state fields in multi-source state messages into a current state field set and comparing it with the historical state field set, the system can accurately identify field changes and save state snapshots before and after the changes, avoiding repeated triggering. By obtaining the event domain identifier corresponding to the changed field and finding the corresponding serial actuator, at least two control tasks generated based on the state snapshot are submitted to the queue of the serial actuator for execution. This ensures that tasks with sequential constraints within the same event domain are executed one by one in a preset order, thereby avoiding task conflicts and execution chaos, and improving the accuracy and reliability of robot control.

[0155] The above is a schematic scheme of a robot control system according to this embodiment. It should be noted that the technical solution of this robot control system and the technical solution of the robot control method described above belong to the same concept. For details not described in detail in the technical solution of the robot control system, please refer to the description of the technical solution of the robot control method described above.

[0156] Figure 4 This is a structural block diagram of a computing device according to an embodiment of the present invention. The components of the computing device 400 include, but are not limited to, a memory 410 and a processor 420. The processor 420 is connected to the memory 410 via a bus 430, and a database 450 is used to store data.

[0157] The computing device 400 also includes an access device 440, which enables the computing device 400 to communicate via one or more networks 460. Examples of these networks include Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or combinations of communication networks such as the Internet. The access device 440 may include one or more of any type of wired or wireless network interface (e.g., a network interface card (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) wireless interface, a Wi-MAX (Worldwide Interoperability for Microwave Access) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, or a Near Field Communication (NFC) interface.

[0158] In one embodiment of the present invention, the above-mentioned components of the computing device 400 and Figure 4 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 4 The illustrated block diagram of the computing device is for illustrative purposes only and is not intended to limit the scope of the invention. Those skilled in the art can add or replace other components as needed.

[0159] The computing device 400 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or personal computers (PCs). The computing device 400 can also be a mobile or stationary server.

[0160] The processor 420 is used to execute the following computer program / instructions, which, when executed by the processor, implement the steps of the robot control method described above.

[0161] The various embodiments in this invention are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on its differences from other embodiments. In particular, the computing device embodiments are relatively simple in description because they are fundamentally similar to the robot control method embodiments; relevant parts can be referred to in the description of the robot control method embodiments.

[0162] An embodiment of the present invention also provides a computer-readable storage medium storing a computer program / instructions that, when executed by a processor, implement the steps of the robot control method described above.

[0163] The various embodiments in this invention are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on its differences from other embodiments. In particular, the computer-readable storage medium embodiment is described simply because it is substantially similar to the robot control method embodiment; relevant parts can be referred to in the description of the robot control method embodiment.

[0164] An embodiment of the present invention also provides a computer program product, including a computer program / instructions, which, when executed by a processor, implement the steps of the above-described robot control method.

[0165] The above is an illustrative scheme of a computer program product according to this embodiment. It should be noted that the technical solution of this computer program product and the technical solution of the robot control method described above belong to the same concept. For details not described in detail in the technical solution of the computer program product, please refer to the description of the technical solution of the robot control method described above.

[0166] The foregoing has described specific embodiments of the invention. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired results. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0167] The computer instructions include computer program code, which may be in the form of source code, object code, executable file, or certain intermediate forms. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added or removed according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.

[0168] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments of the present invention.

[0169] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0170] The preferred embodiments of the present invention disclosed above are merely illustrative of the invention. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the embodiments of the present invention. These embodiments are selected and specifically described to better explain the principles and practical applications of the present invention, thereby enabling those skilled in the art to better understand and utilize the invention. The present invention is limited only by the claims and their full scope and equivalents.

Claims

1. A robot control method, applied to a robot control system, characterized in that, include: Receive multi-source status messages of the robot at the current moment, and generate a set of current status fields based on the multi-source status messages; Compare the current state field set with the historical state field set, and save a snapshot of the state before and after the change if the comparison result indicates that the field content has changed. Obtain the event domain identifier corresponding to the change field, and find the serial executor corresponding to the event domain identifier. The event domain is a set of tasks with sequential constraints, and the serial executor is used to execute the set of tasks according to the sequential constraints. Based on the state comparison snapshot, at least two control tasks are determined to be contained in the event domain, and the control tasks are submitted to the serial executor for execution.

2. The method according to claim 1, characterized in that, The receiving robot receives multi-source status messages at the current moment, and generates a current status field set based on the multi-source status messages, including: Analyze the message type carried by each message in the multi-source status messages, and extract the status field that matches the message type; Copy the existing set of aggregated state fields to obtain a temporary set, and replace the extracted state fields with the corresponding positions in the temporary set according to the field name; The temporary set after the replacement is completed is determined as the current state field set.

3. The method according to claim 2, characterized in that, The step of replacing the extracted status fields with the corresponding positions in the temporary set according to the field name includes: For multiple status fields with the same field name, the value of the field to be retained is determined according to the preset priority of the message source to which each status field belongs; Write the reserved field value into the corresponding field name to generate the current state field set.

4. The method according to claim 1, characterized in that, The step of comparing the current state field set with the historical state field set, and saving a snapshot of the state before and after the change when the comparison result indicates that the field content has changed, includes: Identify the target field that exists in both the current state field set and the historical state field set; Compare the target field values ​​in the two sets one by one; If there is a difference in the field values, the comparison result indicates that the field content has changed.

5. The method according to claim 1, characterized in that, The step of obtaining the event domain identifier corresponding to the change field and finding the serial executor corresponding to the event domain identifier includes: The search is performed in the preset event domain mapping according to the changed field to obtain the search results, wherein the event domain mapping is used to maintain the correspondence between the changed field, the event domain identifier, and the serial executor; If the search results indicate the existence of a corresponding event domain identifier, obtain the serial executor bound to the event domain identifier.

6. The method according to claim 1, characterized in that, The step of determining at least two control tasks contained in the event domain based on the state comparison snapshot, and submitting the control tasks to the serial executor for execution, includes: Extract the target fields that have changed and their change types from the state comparison snapshot; Match the target field and its change type with the task triggering rule corresponding to the event domain; Based on the matching results, at least two control tasks are determined to be contained in the event domain, and the control tasks are submitted to the serial executor for execution.

7. The method according to claim 6, characterized in that, The step of determining at least two control tasks contained in the event domain based on the matching results, and submitting the control tasks to the serial executor for execution, includes: Based on the matching results and the order constraints of the event domain, the submission order of the at least two control tasks is determined; The control task is encapsulated as a task object, and the task object carries a set of callback functions corresponding to the state comparison snapshot and the event domain, wherein the set of callback functions includes all callback functions registered in the event domain; The task objects are written into the task queue of the serial executor according to the message processing order, wherein the task queue is used to cache the tasks to be executed and output them to the serial executor for execution one by one in the order of writing. In the single working thread of the serial executor, the task objects are retrieved one by one according to the writing order of the task queue, and the set of callback functions in the task objects is traversed and executed under the protection of the callback list lock.

8. The method according to claim 7, characterized in that, Also includes: Receive the task execution result returned by the serial executor; The current status field set is updated to the historical status field set based on the task execution result.

9. The method according to claim 1, characterized in that, Before comparing the current state field set with the historical state field set, and saving a snapshot of the state before and after the change if the comparison result indicates that the field content has changed, the method further includes: The system receives the robot's initial state message during the system initialization phase; An initial state field set is generated based on the initial state message, and the initial state field set is stored as the historical state field set.

10. The method according to claim 1, characterized in that, Before obtaining the event domain identifier corresponding to the change field and finding the serial executor corresponding to the event domain identifier, the method further includes: The receiving module submits a callback function and an event domain identifier declared by the callback function, and registers the callback function to the callback registry, wherein the callback registry is used to maintain the attribution relationship between the callback function and the event domain identifier; Receive event domain configuration information, wherein the event domain configuration information is used to define the tasks contained in the event domain and the order constraints between the tasks; Create a corresponding serial executor for each event domain and establish a binding relationship between the event domain identifier and the serial executor.

11. The method according to claim 1, characterized in that, After submitting the control task to the serial executor for execution, the method further includes: Monitor the execution status of the serial executor, wherein the execution status is used to characterize whether the serial executor is currently executing a task; When the execution status indicates that the serial executor is idle, the serial executor is notified to execute the next control task to be executed.

12. A robot control system, characterized in that, include: A state aggregator is configured to receive multi-source state messages of the robot at the current moment and generate a set of current state fields based on the multi-source state messages. A change detector is configured to compare the current set of state fields with the historical set of state fields, and save a snapshot of the state before and after the change if the comparison result indicates that the field content has changed. The serial execution pool manager is configured to obtain the event domain identifier corresponding to the changed field, and find the serial executor corresponding to the event domain identifier, wherein the event domain is a set of tasks with sequential constraints, and the serial executor is used to execute the set of tasks according to the sequential constraints. An asynchronous thread pool is configured to determine, based on the state comparison snapshot, at least two control tasks contained in the event domain, and submit the control tasks to the serial executor for execution.

13. A computing device, characterized in that, include: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions, which, when executed by the processor, implement the steps of the robot control method according to any one of claims 1-11.

14. A computer-readable storage medium, characterized in that, It stores a computer program / instruction that, when executed by a processor, implements the steps of the robot control method according to any one of claims 1-11.

15. A computer program product, characterized in that, Includes a computer program / instruction that, when executed by a processor, implements the steps of the robot control method according to any one of claims 1-11.