Robot control methods and electronic devices
By managing the robot's task lifecycle through a three-layer state machine, combined with multi-dimensional verification and position correction, the instability problem of task pause and resumption in dynamic environments is solved, achieving precise task continuation and improving operational reliability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING HUMANOID ROBOTICS INNOVATION CENTER CO LTD
- Filing Date
- 2026-03-04
- Publication Date
- 2026-06-02
AI Technical Summary
In existing technologies, when robots pause and resume tasks in dynamic open environments, the state granularity is coarse, the context is not fully preserved, the execution accuracy is insufficient, and the validity judgment is not adapted to the dynamic changes in the environment and resources, resulting in unstable operation and poor reliability.
A three-layer state machine (task layer, subtask layer, action layer) is used to manage the task lifecycle. When paused, the state is frozen and the context information is recorded. When resumed, the execution position is determined and the position is corrected through multi-dimensional verification of environment, time, and resources. Degradation strategy is combined to deal with resource fluctuations.
It enables precise continuation of robot tasks, improves reliability and stability in complex and dynamic scenarios, optimizes human-computer interaction experience, and reduces task failure rate.
Smart Images

Figure CN122131633A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of robot control technology, and more specifically, to a robot control method and an electronic device. Background Technology
[0002] Robots are increasingly being deployed in dynamic, open environments such as factories, hospitals, and disaster areas, where they need to perform multi-step, highly coupled tasks over extended periods. These scenarios often involve unexpected human intervention, environmental changes, or system anomalies, requiring robots to be able to pause at any time and resume execution from the breakpoint when conditions permit, rather than starting from scratch or abandoning the task altogether. This is a key capability for improving practicality, safety, and the human-robot collaboration experience.
[0003] In existing technologies, a global pause flag or ROS Action Server lifecycle management is generally used to record the task identifier and pause timestamp of the robot. When the task is resumed, the task graph is restarted or the robot jumps to a preset node and continues to execute the task from the jumped node.
[0004] However, existing technologies suffer from problems such as coarse state granularity, incomplete context preservation, insufficient execution accuracy, and inability to adapt to dynamic changes in environment and resources. Furthermore, existing solutions will directly interrupt operation when resources are insufficient, which also affects the reliability and stability of robot operation. Summary of the Invention
[0005] The purpose of this application is to address the shortcomings of the prior art by providing a robot control method and electronic device, thereby solving the problems of coarse state granularity, incomplete context preservation, insufficient execution accuracy, and inability of validity judgment to adapt to dynamic changes in the environment and resources.
[0006] To achieve the above objectives, the technical solution adopted in this application is as follows: In a first aspect, this application provides a robot control method, the method comprising: Upon receiving a task pause signal for the robot, context information is generated and stored based on the current task's state machine and the time the task pause signal was received. The state machine includes: a task layer state machine, a sub-task layer state machine, and an action layer state machine. Upon receiving a task resumption signal for the robot, the system acquires current environment information, current time information, and current resource information, and determines whether to continue executing the current task based on the context information, the current environment information, the current time information, and the current resource information. If so, the current pose information is obtained, and the robot's position is corrected according to the context information and the current pose information to obtain the continued position; Based on the context information, the robot is controlled to continue executing the current task from the continuation position.
[0007] Optionally, generating and storing context information based on the current task's state machine and the pause time of the task pause signal includes: Freeze the state machine of the current task to obtain the task state information of the state machine. The task state information includes: action parameters of the currently executed action, subtask progress of the current subtask, and task information of the current task. Context information is generated and stored based on the task status information and the reception time of the task pause signal.
[0008] Optionally, freezing the state machine of the current task to obtain the task state information of the state machine includes: Set the state of the action layer state machine to a paused state and record the action parameters of the currently executed action; Set the state of the subtask layer state machine to a paused state and record the subtask progress of the current subtask. Set the state of the task layer state machine to a paused state and record the task information of the current task; The action parameters, the subtask progress, and the task information are used as the task status information of the current task.
[0009] Optionally, generating and storing context information based on the task status information and the reception time of the task pause signal includes: The context saving mechanism is activated based on the task pause signal; Obtain the robot's pause pose information and task queue status information at the receiving time; Context information is generated based on the task status information, the pause pose information, the task queue status information, and the receiving time, and the context information is stored in a preset storage area.
[0010] Optionally, determining whether to continue executing the current task based on the context information, the current environment information, the current time information, and the current resource information includes: The integrity of the context information is checked to obtain the integrity check result; If the integrity verification result indicates that the context information is complete, then the current task of the robot is validated based on the current environment information, the current time information, and the current resource information to obtain a validity verification result. If the validity check result indicates that the current task is valid, then the current task continues to be executed.
[0011] Optionally, the step of validating the robot's current task based on the current environment information, the current time information, and the current resource information to obtain a validity verification result includes: If the current environment information indicates that the current environment supports task execution, the current time information indicates that the current task is within the valid execution time window, and the current resource information indicates that the resources required for the execution of the current task are available, then the validity verification result is determined to be that the current task is valid.
[0012] Optionally, the step of correcting the robot's position based on the context information and the current pose information to obtain the continued position includes: Obtain the pause pose information from the context information; Determine the deviation between the paused pose information and the current pose information; If the deviation value is greater than or equal to the preset deviation threshold, then it is determined whether to perform position replanning based on the current environmental information. If so, then robot relocalization is performed to obtain the continued position. If the deviation value is less than the preset deviation threshold, then the position indicated by the current pose information is taken as the continuation position.
[0013] Optionally, controlling the robot to continue executing the current task from the continuation position based on the context information includes: Based on the context information, the robot is restored to the pose indicated by the pause pose information, the robot's task queue is restored to the state indicated by the task queue information, and the robot's task is restored to the state indicated by the task state information, so as to restore the state machine of the robot's current task; Under the guidance of the state machine, the robot is controlled to continue executing the current task from the continued execution position.
[0014] Optionally, the method further includes: Based on the current environmental and resource information, determine whether to trigger a degradation strategy; If so, the current task will be downgraded and the robot's real-time environmental and resource information will be continuously monitored until the real-time environmental and resource information meet preset conditions, at which point the normal execution of the current task will be gradually restored.
[0015] In a second aspect, this application provides an electronic device, including: a processor, a storage medium, and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to perform the steps of a robot control method as described in any one of the first aspects.
[0016] The beneficial effects of this application are as follows: It achieves refined task control through a three-layer state machine, generating and storing complete context information based on pause times, providing a more accurate data foundation for resuming execution from breakpoints. During task resumption, multi-dimensional verification of environment, time, and resources avoids invalid task execution and reduces the failure rate. Precise correction is performed to address position drift issues, determining the resumption position and improving the accuracy of task resumption, thus preventing error accumulation. Finally, task execution is resumed from the resumption position based on context information, ensuring the continuity of task execution. This application achieves flexible pausing and precise resumption of robot tasks, effectively handling various emergencies, improving the reliability and stability of robot task execution, and optimizing the human-computer interaction experience, making human intervention more convenient.
[0017] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0018] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 A flowchart of a robot control method provided in an embodiment of this application is shown; Figure 2 This document illustrates a flowchart of a method for generating context information according to an embodiment of this application. Figure 3 A flowchart of a frozen state machine provided in an embodiment of this application is shown; Figure 4 A schematic diagram of a state transition mechanism for a state machine provided in an embodiment of this application is shown; Figure 5 This document illustrates a flowchart of a method for generating and storing context information according to an embodiment of this application. Figure 6 This document illustrates a flowchart of a validity verification method provided in an embodiment of this application. Figure 7 This document illustrates a flowchart of a method for determining the execution continuation position according to an embodiment of this application. Figure 8 This application provides a flowchart illustrating a method for controlling a robot to resume performing a task, as illustrated in an embodiment of this application. Figure 9 A flowchart illustrating a method for resuming task execution according to an embodiment of this application is shown; Figure 10 A flowchart illustrating an embodiment of this application for implementing a degradation strategy is shown; Figure 11 A schematic diagram of the structure of an electronic device provided in an embodiment of this application is shown. Detailed Implementation
[0020] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0021] It should be noted that the term "comprising" will be used in the embodiments of this application to indicate the presence of the features declared thereafter, but does not exclude the addition of other features.
[0022] Current robot task control often employs flat state machines or simple flag mechanisms to manage the task lifecycle. When encountering scenarios requiring pauses, such as emergency obstacle avoidance, manual intervention, or resource constraints, the system typically cuts off execution commands and waits for a recovery signal. During the recovery phase, the system often continues running only based on breakpoints in the code logic, lacking deep perception and verification of changes in the robot's physical pose, dynamic environmental evolution, and system resource consumption during the pause.
[0023] However, this coarse-grained control method has significant drawbacks in practical applications. First, during pauses, the robot is susceptible to external collisions or slippery surfaces, causing positional drift. This leads to a mismatch between the robot's logical coordinates and actual physical position upon resumption, potentially resulting in path deviations or even collisions. Second, existing technologies lack effective verification of pause duration and environmental changes. Blindly resuming execution after a resumption command is issued may cause the task to idle or fail in an already compromised environment. Finally, the system lacks a dynamic degradation strategy when resources are scarce, making it highly susceptible to overall task crashes due to local resource exhaustion, failing to meet the high reliability requirements of long-cycle tasks in complex dynamic scenarios.
[0024] Based on this, this application proposes a robot control method. By constructing a three-layer state machine comprising a task layer, a subtask layer, and an action layer, upon receiving a task pause signal, the state of each layer is frozen, and action parameters, subtask progress, and pause pose information are recorded, generating complete context information for storage. Upon receiving a task resumption signal, instead of blindly resuming execution, the method comprehensively checks the validity of the task based on current environmental, time, and resource information to ensure execution conditions are met. For potential physical displacements during pauses, the deviation is calculated by comparing the pause pose information with the current pose information. If the deviation exceeds a threshold, position replanning or robot relocalization is triggered to accurately obtain the resumption position. Finally, the task queue state and state machine are restored based on the context information, and the task continues execution from the corrected resumption position. Furthermore, a degradation strategy can be dynamically triggered to address resource fluctuations.
[0025] This application achieves precise alignment between logical breakpoints and actual physical locations, resolving the execution misalignment problem caused by position drift, and avoids blind operation in invalid environments through multi-dimensional verification. Combined with hierarchical state management and degradation mechanisms, it significantly improves the reliability, continuity, and adaptability of the robot in long-cycle task execution in complex dynamic scenarios.
[0026] Next, combine Figure 1 This application describes a robot control method that can be applied to a robot control system. The system includes a robot and a control module for controlling the robot. The control module can be deployed inside the robot or in an electronic device that communicates with the robot. Figure 1 As shown, the method includes: S101. Upon receiving a task pause signal for the robot, generate and store context information based on the current task state machine and the time the task pause signal was received.
[0027] The state machine includes: task-level state machine, subtask-level state machine, and action-level state machine.
[0028] Among them, the task pause signal refers to an external or internal instruction that triggers the robot to interrupt its current execution process. For example, the controller can trigger the task pause signal through the emergency stop button, or send the task pause signal to the robot through the host computer, or the robot can automatically trigger the task pause signal based on the monitored environmental information, such as the robot detecting a low battery threshold or the collision avoidance sensor triggering the task pause signal.
[0029] When the current task is triggered for execution, a state machine corresponding to the current task can be generated, and the execution steps of the current task can be managed through the state machine. The state machine includes a task-level state machine, each of which includes multiple sub-task-level state machines, and the sub-task-level state machines can include action-level state machines.
[0030] Each task's task state machine has a corresponding task-level state machine, which is responsible for task-level pause and resume decisions and manages the overall task lifecycle of the current task. The states of the task-level state machine include: pending, running, paused, resumed, completed, and failed.
[0031] Below the task layer, complex tasks are broken down into multiple subtasks, each with its own state machine, supporting fine-grained execution control. Subtask states include: ready, in progress, blocked, and completed.
[0032] The action layer state machine manages the states of the lowest-level atomic operations, such as movement, grasping, and sensing. Each action has its own state transition rules, and the action layer state machine ensures the integrity of atomic operations. The task layer state machine, subtask layer state machine, and action layer state machine maintain consistency through a state synchronization mechanism.
[0033] When the robot control system receives a task pause signal, it first performs fine-grained collection of the current task execution status based on a three-layer state machine. Because the state machine realizes hierarchical control of tasks, subtasks, and actions, it can accurately obtain the real-time execution status of each level, avoiding information loss caused by coarse-grained state management. At the same time, it records the time of receiving the pause signal (i.e., the pause timestamp) as a key identifier of the time dimension of context information.
[0034] The system then activates the task context saving mechanism, which combines the state information collected by the three-layer state machine, the pause timestamp, the robot's pause pose information, and the task queue state information to generate complete context information according to the preset context snapshot data structure. The system then uses an incremental snapshot combined with differential backup saving strategy to store the context information in the preset storage area, while maintaining the snapshot version history to support subsequent multi-level recovery. This ensures that the stored context information is complete and traceable, and reduces storage overhead while ensuring recovery accuracy.
[0035] As another possible implementation, a finite state automaton can be used to record the current task state, or a data flow model can be used to replace the state machine model to drive task execution with data dependencies, or an event-driven architecture can be adopted to coordinate task pause and resumption through an event bus. The above three-layer state machine is only one possible implementation method given in this application and should not be limited thereto.
[0036] S102. Upon receiving a task recovery signal for the robot, obtain current environment information, current time information, and current resource information, and determine whether to continue executing the current task based on the context information, current environment information, current time information, and current resource information.
[0037] The task resumption signal is the instruction signal that triggers the robot to resume task execution from a paused state, and it serves as the trigger for the robot to initiate the breakpoint continuation process. The task resumption signal can be a received external instruction or an internal instruction that the robot automatically triggers based on detected environmental information.
[0038] Optionally, the current environmental information refers to the external environmental data at the moment the robot resumes its task, collected by sensors, including environmental parameters affecting task execution such as spatial layout, obstacle distribution, and ambient temperature and humidity. The current time information refers to the real-time time at which the robot receives the task resumption signal, used to determine whether the task pause duration is within a valid range. The current resource information refers to the internal resource status of the system at the moment the robot resumes its task, including battery level, computing resources, physical execution component status, and consumables required for the task.
[0039] Upon receiving a task resumption signal, the robot control system first collects current environmental information, current time information, and current resource information through various sensors and system monitoring modules, while retrieving the context information generated during the pause from the storage area. Then, it performs multi-dimensional verification based on a task validity verification model to determine whether to continue task execution. Only after the multi-dimensional verification passes will the system proceed with the current task, avoiding execution failure caused by resuming the task under invalid conditions.
[0040] S103. If so, obtain the current pose information, and perform position correction on the robot based on the context information and the current pose information to obtain the continued position.
[0041] Optionally, the current pose information refers to the robot's position and orientation data at the moment of task recovery, including global coordinates, joint angles, and end effector orientation, which are collected in real time by sensors. The continuation position refers to the target position for the robot to resume task execution, serving as the starting point for execution after recovery.
[0042] During a pause, the robot may drift due to external interference or internal system errors. Therefore, the drift amount can be calculated based on context information and current pose information, and the repositioning requirement can be determined to adjust the robot's execution position.
[0043] S104. Based on the context information, control the robot to continue executing the current task from the continuation position.
[0044] After determining the continuation point, the three-layer state machine can be restored from the paused state to the corresponding running state according to the context information. The execution order, priority, dependency relationship of the task queue, and the task execution progress of each level are restored synchronously. The continuation point is used as the execution starting point. According to the state transition rules of the three-layer state machine and the task execution logic recorded in the context information, execution instructions are issued layer by layer to control the robot to continue executing the current task from the breakpoint. This ensures the continuity and accuracy of task resumption and avoids task restart or execution errors caused by inconsistent states.
[0045] In this embodiment, a three-layer state machine is used to achieve fine-grained task control. Combined with pause time, complete context information is generated and stored, providing a more accurate data foundation for resuming execution from breakpoints. When resuming a task, multi-dimensional verification of environment, time, and resources is performed to avoid invalid task execution and reduce the failure rate. Precise correction is performed to address position drift issues, determining the resumption position and improving the accuracy of task resumption, thus avoiding error accumulation. Finally, task execution is resumed from the resumption position based on the context information, ensuring the continuity of task execution. This application achieves flexible pausing and precise resumption of robot tasks, effectively handling various emergencies, improving the reliability and stability of robot task execution, and optimizing the human-computer interaction experience, making human intervention more convenient.
[0046] The following is a further explanation of how context information is generated and stored based on the current task's state machine and the time of receiving the task pause signal, such as... Figure 2 As shown, the above step S101 includes: S201. Freeze the state machine of the current task to obtain the task state information of the state machine.
[0047] Task status information is a core set of data extracted from the frozen three-layer state machine, representing the execution state at the moment the task is paused. Task status information includes: action parameters of the currently executing action, the progress of the current subtask, and the task information of the current task.
[0048] Action parameters refer to the specific configuration data of the atomic operations that the robot is currently executing in the action layer state machine, such as the speed, distance, and direction of movement actions, and the force and angle of grasping actions. Subtask layer progress refers to the current completion status of a subtask in the subtask layer state machine, such as the percentage of parts installed in the assembly subtask or the path mileage completed in the transportation subtask. Task information refers to the core attributes and execution node data of the overall task in the task layer state machine, such as task number, task type, currently executed task node, and overall task completion progress.
[0049] Upon receiving the task pause signal, the robot control system first freezes the three-layer state machine. This operation is triggered by the state synchronization mechanism of the layered state machine, locking the state of each layer layer by layer to avoid information deviations caused by local state changes. After freezing each layer of the state machine, the obtained motion parameters, subtask progress, and task information are integrated to form complete task state information.
[0050] S202. Generate and store context information based on the task status information and the time of receiving the task pause signal.
[0051] Optionally, using task status information as the core, combined with the reception time corresponding to the task pause signal, the robot's pose information and task queue status information at the pause moment are retrieved simultaneously. Following a preset context snapshot data structure, multi-dimensional data is integrated and encapsulated to generate complete context information. Subsequently, a storage strategy combining incremental snapshots and differential backups is employed to store the generated context information in a preset storage area.
[0052] As another possible implementation, a database transaction log mechanism can be used to save context information and record the state change history in the state machine, or a checkpoint mechanism can be used to periodically save the state of key nodes, so that the state machine can be restored based on the state change history or the saved node states when resuming task execution.
[0053] In this embodiment, by freezing the three-layer state machine, multi-dimensional task state information is accurately collected, ensuring that the core data of the context information is consistent with the pause time. Context information is generated and stored by combining task state information with pause signals, making the generation of context information more standardized and the data more complete. This provides an accurate and reliable data foundation for subsequent state restoration after breakpoint resumption, effectively avoiding execution deviations caused by missing state information.
[0054] The following is a further explanation of how the task state information is obtained by freezing the current task's state machine, as described above. Figure 3 As shown, the above step S201 includes: S301. Set the state of the action layer state machine to the paused state and record the action parameters of the currently executed action.
[0055] Upon receiving a task pause signal, the action layer state machine can first be set to switch its running state directly to the paused state. Through the state locking mechanism of the layered state machine, the issuance and execution of instructions for the current atomic action are terminated, preventing further changes in the action state. Simultaneously, precise data acquisition is performed on the currently executing atomic operation, completely recording its action parameters, such as the global coordinate target value of the movement action and the end effector force parameters of the grasping action, ensuring that no state information at the atomic operation level is omitted.
[0056] S302. Set the state of the subtask layer state machine to the paused state and record the progress of the current subtask.
[0057] After the action layer state machine completes the pause setting and parameter recording, based on the state synchronization mechanism of the hierarchical state machine, the state update of the subtask layer state machine is triggered, setting the execution state of its subtask to the paused state and pausing the overall progress of the current subtask. Subsequently, the real-time execution completion status of the subtask is statistically analyzed, and the specific subtask progress is recorded, such as the completion rate of parts installation for the assembly subtask and the path completion mileage for the inspection subtask.
[0058] S303. Set the state of the task layer state machine to the paused state and record the task information of the current task.
[0059] After the subtask-level state machine completes the pause setting and progress recording, it continues to trigger the state setting of the task-level state machine upwards through the state synchronization mechanism of the hierarchical state machine, switching the overall task's lifecycle state to a paused state, thus achieving global pause control over the current task. Simultaneously, it extracts the core task information of the current task, including task number, task type, currently executed task node, and overall task completion progress, and fully records the execution breakpoints of the entire task.
[0060] S304. Use action parameters, subtask progress, and task information as the task status information of the current task.
[0061] After pausing and setting the state machines of the action layer, subtask layer, and task layer, and recording the action parameters, subtask progress, and task information respectively, the three types of state data collected from different levels are summarized and encapsulated according to the preset data integration rules to form structured task state information.
[0062] The task-level state machine, sub-task-level state machine, and action-level state machine can trigger each other through a state synchronization mechanism. Next, we will combine... Figure 4 A brief explanation of the state synchronization mechanism between the three-layer state machines is provided.
[0063] The task-level state machine is initially in a pending state. After starting, it enters the running state. If a pause signal is received, it is set to a paused state. If a resume signal is received, it is switched to a resumed state. Once execution is completed, it is set to a completed state. If a timeout or failure occurs, it is set to a failed state.
[0064] The subtasks in the subtask layer state machine are initially in the ready state. After resources are allocated and conditions are met, they enter the execution process. If a blocking condition is encountered, the subtask is blocked. Once the execution is completed, the subtask is considered complete. If a timeout occurs, the subtask fails. The status is fed back to the task layer in real time.
[0065] The action layer state machine starts in the initialization state. After preparation, it enters the action execution state. Instructions are issued by the sub-task layer. When the action is completed, the action is considered complete. If an error occurs, the action is considered failed. After state aggregation, the state is synchronized to the sub-task layer. If the action fails, it can be retried. After retrying, the action execution will resume.
[0066] Continue to refer to Figure 4 After the action layer state is aggregated, it is synchronized to the sub-task layer. The sub-task layer state is fed back to the task layer. The state instructions of the task layer are passed from top to bottom. The state machines of each layer are linked to achieve hierarchical control and state synchronization of task execution.
[0067] In this embodiment, the state machine pause setting and data acquisition are completed in the hierarchical order of action layer, subtask layer, and task layer. Based on the state synchronization mechanism of the hierarchical state machine, the task execution state is frozen and recorded in a refined and hierarchical manner, ensuring that the acquired state data is completely consistent with the pause time, without omissions or deviations. By integrating the data from each level to form task state information, accurate and complete core data is provided for the generation of context information, ensuring the accuracy of state restoration for subsequent breakpoint resumption.
[0068] The following is a further explanation of how context information is generated and stored based on the task status information and the reception time of the task pause signal, such as... Figure 5 As shown, the above step S202 includes: S501. Activate the context saving mechanism based on the task pause signal.
[0069] Upon receiving a task pause signal, the signal is used as a trigger to activate the context saving mechanism. Once activated, this mechanism will initiate the collection, integration, and storage of multi-dimensional pause status data according to a pre-defined standardized process.
[0070] S502, Obtain the robot's pause pose information and task queue status information during the receiving time.
[0071] Pause pose information refers to the robot's position and orientation data at the time of receiving the task pause signal, including global coordinates, joint angles, and end effector orientation. Task queue status information refers to the queue data of tasks to be executed by the robot at the time of task pause, including the queue of tasks to be executed, priority queue, and inter-task dependencies.
[0072] Once the context saving mechanism is activated, the robot's sensors first collect the robot's pause pose information at the time of receiving the task pause signal, recording the robot's physical position and attitude state at this time. At the same time, the robot's task scheduling module data is retrieved to obtain the current task queue status information, including the queue of subtasks / actions to be executed, the execution priority of each task, and the sequential dependencies between tasks, thereby achieving comprehensive collection of the robot's physical execution state and task scheduling state.
[0073] S503. Generate context information based on task status information, pause pose information, task queue status information and receiving time, and store the context information in a preset storage area.
[0074] After acquiring task status information, pause pose information, and task queue status information, and determining the task pause signal reception time, the control system integrates and encapsulates the above four types of data according to the preset context snapshot data structure, generating complete context information including task execution status, physical pose status, task scheduling status, and time identifier. Subsequently, a storage strategy combining incremental snapshots and differential backups is adopted to store the generated context information in a preset storage area, while establishing an identifier for the context information, maintaining the snapshot version history, supporting subsequent multi-level recovery needs, and ensuring the efficiency and traceability of data storage.
[0075] In this embodiment, a standardized context saving mechanism is activated by triggering a task pause signal, thereby achieving the standardized collection of multi-dimensional pause state data. By integrating task state, pose, queue and time information, the generated context information data is complete in dimensions and has a standardized structure, which can fully restore the robot state at the pause time. Combined with the incremental snapshot storage strategy, it is stored in a preset area, which reduces storage overhead and ensures data traceability, providing a complete and reliable data source for the state restoration of subsequent breakpoint resumption.
[0076] The following is a further explanation of the above method for determining whether to continue executing the current task based on context information, current environment information, current time information, and current resource information. Figure 6 As shown, the above step S102 includes: S601. Perform an integrity check on the context information to obtain the integrity check result.
[0077] The integrity verification result refers to the judgment result obtained after the integrity verification, which is divided into two categories: complete context information and incomplete context information. It serves as the basis for determining whether to conduct subsequent validity verification.
[0078] Upon receiving the task recovery signal and retrieving the context information, an integrity check is first performed. The check process uses a preset data verification algorithm to verify whether the snapshot data structure of the context information is complete, whether there are any missing or corrupted data in each dimension (task status, pose, queue, timestamp), and whether the data signature is consistent. It eliminates context information invalidation issues caused by storage failures or transmission errors, and outputs a clear integrity check result upon completion.
[0079] S602. If the integrity check result indicates that the context information is complete, then the validity of the robot's current task is checked based on the current environment information, current time information, and current resource information to obtain the validity check result.
[0080] The validity verification result refers to the judgment result obtained after the validity test. It is divided into two categories: the current task is valid and the current task is invalid. It serves as the final basis for determining whether to continue executing the current task.
[0081] If the integrity check result indicates that the context information is complete, the control system will conduct a multi-dimensional validity check based on the task validity check model. During the check, the collected current environment information, current time information, and current resource information will be used as core inputs to verify the validity of the environment, time, and resources respectively. A comprehensive judgment will be made according to multiple dimensions and logic, and the final validity check result will be output. If the integrity check result indicates that the information is incomplete, the task will be directly determined as unexecutable, and subsequent processes will be terminated.
[0082] S603. If the validity check result indicates that the current task is valid, then continue executing the current task.
[0083] If the validity check result indicates that the current task is valid, it means that the task meets all the conditions for continued execution, and the subsequent breakpoint resumption process can be initiated, including operations such as robot pose acquisition and position correction, to continue executing the current task. If the validity check result indicates that the current task is invalid, it means that any dimension of the environment, time, or resources does not meet the execution requirements, and the resumption of the current task can be terminated to avoid resource waste and execution risks caused by invalid execution.
[0084] In this embodiment, the integrity of the context information is first verified to ensure the validity of the basic data for resuming execution from breakpoints, thus avoiding execution errors caused by data failure. The validity of the task is verified based on multiple dimensions such as environment, time, and resources to accurately determine the executability of the task, avoid resuming the task under invalid conditions, significantly reduce the task execution failure rate, reduce unnecessary resource consumption, and improve the reliability and rationality of robot task execution.
[0085] The following is a further explanation of the above-mentioned validity check of the robot's current task based on the current environmental information, current time information, and current resource information, and the resulting validity check result. Step S602 includes: If the current environment information indicates that the current environment supports task execution, the current time information indicates that the current task is within the valid execution time window, and the current resource information indicates that the resources required for the execution of the current task are available, then the validity check result is determined to be that the current task is valid.
[0086] Optionally, the collected current environmental information (such as spatial layout, obstacles, environmental parameters, etc. obtained by sensors) can be compared with the environmental information at the pause time recorded in the context information to assess the degree of environmental change. If the environment does not change significantly and can still support the robot to complete tasks such as movement and grasping, then it is determined that the current environment supports task execution.
[0087] Optionally, the pause timestamp and current time information in the context information can be extracted, and the time difference between the two can be calculated. If the difference is less than the maximum pause time dynamically set for the current task type, then the current task is determined to be within the effective execution time window.
[0088] Optionally, the robot's current resource information can be checked in multiple dimensions, including whether the battery power meets the remaining task execution requirements, whether the computing module load is within a reasonable range, whether the physical execution components (such as robotic arms and grippers) are normal, and whether the resources or tools required for the task are available. If all required resources are available, it is determined that the resources meet the execution requirements.
[0089] When all three dimensions are satisfied, the control system determines that the current task is valid; if any dimension is not satisfied, the current task is determined to be invalid.
[0090] It should be noted that the above steps are only one possible way to implement validity verification given in this application. Validity verification can also be carried out in other ways and should not be limited to this.
[0091] This application clarifies the criteria for determining the effective execution of tasks by verifying the logical validity of the three dimensions of environment, time, and resources. This makes the verification process more standardized and the judgment results more accurate. It can effectively identify the risks of task execution caused by environmental changes, timeouts, and insufficient resources, avoid resuming tasks under invalid conditions, reduce resource waste and the probability of execution failure, and improve the rationality and reliability of robot task resumption.
[0092] The following is a further explanation of the above-mentioned position correction of the robot based on context information and current pose information to obtain the continued position, such as... Figure 7 As shown, step S103 above includes: S701. Obtain pause pose information from context information.
[0093] After initiating the position correction process, the pre-stored pause pose information is retrieved from the context information that has passed the integrity check. This information is the physical state of the robot at the moment of pause, including data such as global spatial coordinates, joint motion angles, and end effector posture parameters.
[0094] S702. Determine the deviation between the paused pose information and the current pose information.
[0095] After acquiring the paused pose information, the robot's current pose information is combined with the real-time sensor data. According to the preset pose deviation calculation algorithm, the values of position coordinates, joint angles, end effector posture, and other dimensions are compared. The difference in each dimension is calculated and integrated into the deviation value. The deviation value can reflect the degree of position drift of the robot during the pause due to external interference and internal system errors.
[0096] S703. If the deviation value is greater than or equal to the preset deviation threshold, determine whether to perform position replanning based on the current environmental information. If so, perform robot relocalization to obtain the continued position.
[0097] Optionally, the calculated deviation value can be compared with a preset deviation threshold. If the deviation value is greater than or equal to the threshold, it indicates that the robot's drift has affected the task execution accuracy. At this time, the control system retrieves the current environmental information, compares it with the environmental data at the pause point, and assesses whether the environment has changed significantly (such as changes in obstacle positions or adjustments to the workspace layout). If the environment has not changed significantly, position compensation is performed directly based on the drift amount; if the environment has changed significantly, the position replanning process is initiated. The robot is repositioned using technologies such as sensor fusion and visual repositioning, and a precise continuation position is determined based on the task execution requirements, ensuring that the position is suitable for the current environment and meets the task execution requirements.
[0098] In one possible implementation, if the deviation value is greater than or equal to a preset deviation threshold, the current position can be used as the continuation position, and the remaining path can be replanned from the current position, and the task can continue to be executed according to the replanned path.
[0099] S704. If the deviation value is less than the preset deviation threshold, the position indicated by the current pose information shall be used as the continuation position.
[0100] If the calculated deviation value is less than the preset deviation threshold, it indicates that the robot's position drift during the pause is minimal and within the allowable accuracy error range of the task, and will not affect the execution of subsequent tasks. In this case, there is no need for complex position compensation or replanning; the physical position indicated by the current pose information can be directly used as the continuation position, simplifying the correction process and improving the efficiency of task recovery.
[0101] In this embodiment, the pose deviation is calculated based on the paused pose. A correction strategy is divided by a preset threshold. When the drift is small, the current position is directly used to improve recovery efficiency. When the drift is too large, environmental information is combined to determine whether to replan and perform repositioning to accurately compensate for the position error. This effectively solves the position drift problem during robot pause, avoids error accumulation, and ensures the accuracy of the resumed position.
[0102] The following is a further explanation of the above-mentioned method of controlling the robot to continue executing the current task from the continuation position based on context information, such as... Figure 8 As shown, step S104 above includes: S801. Based on the context information, restore the robot to the pose indicated by the pause pose information, restore the robot's task queue to the state indicated by the task queue information, and restore the robot's task to the state indicated by the task status information, so as to restore the state machine of the robot's current task.
[0103] After determining the continuation position, the paused pose information in the context information can be retrieved. Based on the correction result of the continuation position, the robot's physical pose (such as joint angles and end effector pose) is accurately restored to the state at the pause time through the robot motion control module, completing the physical state restoration. The task queue information in the context information is extracted, and the robot's task scheduling module is restored to the state at the pause time, including the queue order of actions / subtasks to be executed, execution priority, task dependencies, etc., completing the scheduling state restoration. Based on the task state information in the context information, the action layer, subtask layer, and task layer state machines are switched from the paused state to the execution state at the pause time (e.g., the action layer is executing, the subtask layer is running). Through the state synchronization mechanism of the hierarchical state machine, the consistency of the states at each level is achieved, completing the overall restoration of the robot's current task state machine and ensuring that the state machine is without deviation from the state at the pause time.
[0104] S802. Under the instruction of the state machine, control the robot to continue executing the current task from the continuation position.
[0105] After the robot's current task state machine is fully restored, the restored three-layer state machine is used as the basis for execution instructions. According to the hierarchical state transition rules of the state machine, execution instructions are issued from top to bottom. At the same time, the continuation position is used as the physical execution starting point. The robot is controlled to continue to execute the remaining process of the current task according to the restored task queue order and task execution progress. The atomic operations of the action layer and the process advancement of the sub-task layer strictly follow the state instructions of the state machine to ensure that the task is executed continuously and accurately from the breakpoint.
[0106] In this embodiment, the robot's pose, task queue, and state machine state are fully restored based on context information. The synchronization mechanism of the hierarchical state machine ensures consistency among the states at each level. The task execution state at the pause point is fully restored from both physical and logical perspectives. The restored state machine serves as a guide, and the task is resumed from the starting point, ensuring that the task is carried out continuously from the breakpoint and avoiding re-execution or execution deviation. This significantly improves the continuity and accuracy of the robot's intermittent task execution.
[0107] While the robot is performing a task, its environment and resources can be monitored in real time to determine if degradation processing is necessary. This could involve skipping unnecessary task steps or using degraded resources during task execution. The following is a further explanation of degradation strategies, which can be applied throughout the entire task execution process, such as before pausing or after resuming execution. Figure 9 As shown, the method of this application further includes: S901. Based on the current environmental information and current resource information, determine whether to trigger the degradation strategy.
[0108] Optionally, current environmental and resource information can be continuously collected throughout the task execution process. Based on a degradation decision function, a comprehensive calculation is performed, incorporating core parameters such as battery level, system load, and environmental adaptability, to obtain a degradation level assessment result. This result is compared with a preset degradation trigger threshold. If the assessment result reaches the threshold, it indicates that the current environment or resources cannot support normal task execution, and a degradation strategy is triggered. If the threshold is not reached, the normal task execution mode is maintained.
[0109] S902. If so, the current task will be downgraded and the robot's real-time environmental and resource information will be continuously monitored until the real-time environmental and resource information meet the preset conditions, at which point the normal execution of the current task will be gradually restored.
[0110] If a degradation strategy is triggered, the control system will perform degradation execution on the current task according to the preset strategy of the graceful degradation mechanism. Specifically, this includes adjusting task priorities, prioritizing core sub-tasks, and performing functional module degradation, execution frequency adjustment, path optimization and replanning, etc., to minimize system resource consumption while ensuring the completion of core functions.
[0111] Simultaneously, real-time monitoring can be initiated around the clock to continuously collect real-time environmental and resource information of the robot and dynamically compare it with the system's preset conditions. When the real-time environmental and resource indicators meet the preset conditions, it indicates that the system status has been restored to a level that can support normal execution. Then, the normal execution of the current task is gradually restored according to the principle of gradual restoration, first restoring the core auxiliary functions and then gradually enabling advanced functions to ensure a smooth and fault-free restoration process.
[0112] like Figure 10 The diagram shown is a flowchart of a degradation strategy. (Refer to...) Figure 10 The system can initiate status monitoring, collecting key parameters such as task execution time, system load, and battery level. These parameters are then used in a degradation decision function to calculate the degradation level and determine if a preset threshold is exceeded. If the threshold is not exceeded, the current task execution strategy is maintained; if it is exceeded, a degradation strategy is implemented, including optimizing the execution path, reducing execution frequency, downgrading functional modules, and adjusting task priorities, thus degrading the task's execution. The system continuously monitors the robot's real-time environment and resource status to determine if improvements are being made. If the status does not improve, further degradation is implemented; if the status improves, it is determined whether recovery conditions have been met. If recovery conditions are not met, monitoring continues; if they are met, the task plan is updated, advanced functions are gradually restored, and the recovery effect is monitored to confirm whether normal execution has resumed.
[0113] Another possible implementation is to reserve necessary resources at the start of the task to avoid degradation during execution, or to break down large tasks into independent smaller tasks, so that even if some smaller tasks fail, it will not affect the overall execution of the task. Computationally intensive tasks can also be deployed in the cloud to reduce the pressure on local resources.
[0114] Based on the same inventive concept, this application also provides a robot control device corresponding to the robot control method. Since the principle of the device in this application is similar to that of the robot control method described above, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.
[0115] Robot control includes: generation module, determination module, correction module and execution module.
[0116] The generation module is used to generate and store context information based on the current task state machine and the time of receiving the task pause signal when a task pause signal for the robot is received. The state machine includes: task layer state machine, sub-task layer state machine and action layer state machine. The determination module is used to obtain current environmental information, current time information, and current resource information when it receives a task recovery signal for the robot, and determine whether to continue executing the current task based on the context information, current environmental information, current time information, and current resource information. The correction module is used to acquire the current pose information and correct the robot's position based on the context information and the current pose information to obtain the continued position; The execution module is used to control the robot to continue executing the current task from the continuation position based on context information.
[0117] Optionally, the generation module is specifically used for: Freeze the state machine of the current task to obtain the task state information of the state machine. The task state information includes: the action parameters of the currently executed action, the subtask progress of the current subtask, and the task information of the current task. Context information is generated and stored based on the task status information and the time when the task pause signal is received.
[0118] Optionally, the generation module is specifically used for: Set the state of the action layer state machine to the paused state and record the action parameters of the currently executing action; Set the state of the subtask layer state machine to a paused state and record the progress of the current subtask. Set the state of the task layer state machine to a paused state and record the task information of the current task; The action parameters, subtask progress, and task information are used as the task status information for the current task.
[0119] Optionally, the generation module is specifically used for: The context saving mechanism is activated based on the task pause signal; Acquire the robot's pause pose information and task queue status information during the receiving time; Context information is generated based on task status information, pause pose information, task queue status information, and reception time, and the context information is stored in a preset storage area.
[0120] Optionally, the module is specifically used for: Perform an integrity check on the context information to obtain the integrity check result; If the integrity check result indicates that the context information is complete, then the validity of the robot's current task is checked based on the current environment information, current time information, and current resource information to obtain the validity check result. If the validity check result indicates that the current task is valid, then continue executing the current task.
[0121] Optionally, the module is specifically used for: If the current environment information indicates that the current environment supports task execution, the current time information indicates that the current task is within the valid execution time window, and the current resource information indicates that the resources required for the execution of the current task are available, then the validity check result is determined to be that the current task is valid.
[0122] Optionally, the calibration module is specifically used for: Obtain the pause pose information from the context information; Determine the deviation between the paused pose information and the current pose information; If the deviation value is greater than or equal to the preset deviation threshold, then determine whether to perform position replanning based on the current environmental information. If so, then perform robot relocalization to obtain the continued position. If the deviation value is less than the preset deviation threshold, the position indicated by the current pose information will be used as the continuation position.
[0123] Optionally, the execution module is specifically used for: Based on the context information, the robot is restored to the pose indicated by the pause pose information, the robot's task queue is restored to the state indicated by the task queue information, and the robot's task is restored to the state indicated by the task status information, so as to restore the state machine of the robot's current task. Under the guidance of the state machine, the robot is controlled to continue executing the current task from the continuation position.
[0124] Optionally, the device also includes a monitoring module for: Based on the current environmental and resource information, determine whether to trigger a degradation strategy; If so, the current task will be downgraded and the robot's real-time environmental and resource information will be continuously monitored until the real-time environmental and resource information meet the preset conditions, at which point the normal execution of the current task will be gradually restored.
[0125] Figure 11This illustration shows a schematic diagram of an electronic device provided in an embodiment of this application. The electronic device can be connected to a robot for communication and control, or it can be deployed inside a robot for control. The electronic device includes a processor 1101, a storage medium 1102, and a bus 1103. The storage medium 1102 stores machine-readable instructions executable by the processor 1101. When the electronic device runs a robot control method as described in the embodiment, the processor 1101 communicates with the storage medium 1102 via the bus 1103. The processor 1101 executes the machine-readable instructions. The preamble of the method item of the processor 1101 executes the steps in the above-described robot control method.
[0126] This application also provides a computer-readable storage medium storing a computer program that is executed by a processor, which performs the steps in the robot control method described above.
[0127] In this embodiment, the computer program, when run by the processor, can also execute other machine-readable instructions to perform other methods as described in the embodiments. For details on the specific execution steps and principles, please refer to the description of the embodiments, which will not be repeated here.
[0128] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.
[0129] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0130] In addition, the functional units in the embodiments provided in this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0131] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0132] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In addition, the terms "first", "second", "third", etc. are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0133] Finally, it should be noted that the above-described embodiments are merely specific implementations of this application, used to illustrate the technical solutions of this application, and not to limit them. The protection scope of this application is not limited thereto. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this application; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application. All should be covered within the protection scope of this application. Therefore, the protection scope of this application should be determined by the protection scope of the claims.
Claims
1. A robot control method, characterized in that, include: Upon receiving a task pause signal for the robot, context information is generated and stored based on the current task's state machine and the time the task pause signal was received. The state machine includes: a task layer state machine, a sub-task layer state machine, and an action layer state machine. Upon receiving a task resumption signal for the robot, the system acquires current environment information, current time information, and current resource information, and determines whether to continue executing the current task based on the context information, the current environment information, the current time information, and the current resource information. If so, the current pose information is obtained, and the robot's position is corrected according to the context information and the current pose information to obtain the continued position; Based on the context information, the robot is controlled to continue executing the current task from the continuation position.
2. The method according to claim 1, characterized in that, The step of generating and storing context information based on the current task's state machine and the pause time of the task pause signal includes: Freeze the state machine of the current task to obtain the task state information of the state machine. The task state information includes: action parameters of the currently executed action, subtask progress of the current subtask, and task information of the current task. Context information is generated and stored based on the task status information and the reception time of the task pause signal.
3. The method according to claim 2, characterized in that, Freezing the state machine of the current task to obtain the task state information of the state machine includes: Set the state of the action layer state machine to a paused state and record the action parameters of the currently executed action; Set the state of the subtask layer state machine to a paused state and record the subtask progress of the current subtask. Set the state of the task layer state machine to a paused state and record the task information of the current task; The action parameters, the subtask progress, and the task information are used as the task status information of the current task.
4. The method according to claim 2, characterized in that, The step of generating and storing context information based on the task status information and the reception time of the task pause signal includes: The context saving mechanism is activated based on the task pause signal; Obtain the robot's pause pose information and task queue status information at the receiving time; Context information is generated based on the task status information, the pause pose information, the task queue status information, and the receiving time, and the context information is stored in a preset storage area.
5. The method according to claim 1, characterized in that, The step of determining whether to continue executing the current task based on the context information, the current environment information, the current time information, and the current resource information includes: The integrity of the context information is checked to obtain the integrity check result; If the integrity verification result indicates that the context information is complete, then the current task of the robot is validated based on the current environment information, the current time information, and the current resource information to obtain a validity verification result. If the validity check result indicates that the current task is valid, then the current task continues to be executed.
6. The method according to claim 5, characterized in that, The step of validating the robot's current task based on the current environment information, the current time information, and the current resource information, and obtaining a validity verification result, includes: If the current environment information indicates that the current environment supports task execution, the current time information indicates that the current task is within the valid execution time window, and the current resource information indicates that the resources required for the execution of the current task are available, then the validity verification result is determined to be that the current task is valid.
7. The method according to claim 1, characterized in that, The step of correcting the robot's position based on the context information and the current pose information to obtain the continued position includes: Obtain the pause pose information from the context information; Determine the deviation between the paused pose information and the current pose information; If the deviation value is greater than or equal to the preset deviation threshold, then it is determined whether to perform position replanning based on the current environmental information. If so, then robot relocalization is performed to obtain the continued position. If the deviation value is less than the preset deviation threshold, then the position indicated by the current pose information is taken as the continuation position.
8. The method according to claim 1, characterized in that, The step of controlling the robot to continue executing the current task from the continuation position based on the context information includes: Based on the context information, the robot is restored to the pose indicated by the pause pose information, the robot's task queue is restored to the state indicated by the task queue information, and the robot's task is restored to the state indicated by the task state information, so as to restore the state machine of the robot's current task; Under the guidance of the state machine, the robot is controlled to continue executing the current task from the continued execution position.
9. The method according to claim 1, characterized in that, The method further includes: Based on the current environmental and resource information, determine whether to trigger a degradation strategy; If so, the current task will be downgraded and the robot's real-time environmental and resource information will be continuously monitored until the real-time environmental and resource information meet preset conditions, at which point the normal execution of the current task will be gradually restored.
10. An electronic device, characterized in that, include: The device includes a processor, a storage medium, and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to perform the steps of a robot control method as described in any one of claims 1 to 9.