This application provides a
robot control method and electronic device. The method includes: a three-layer state
machine based on a task layer, a sub-task layer, and an action layer; upon receiving a task pause
signal, generating and storing context information based on the
signal reception time; upon receiving a
recovery signal, acquiring the current environment, time, and
resource information, and determining whether the task can continue execution based on the context information; if execution is possible, acquiring the
robot's current
pose information, performing position correction based on the context information to obtain the
continuation position, and finally controlling the
robot to continue task execution from the
continuation position based on the context information. This application achieves refined control and precise
breakpoint continuation of robot tasks, effectively solving the problems of inconsistent states and position drift during task pause and
recovery, avoiding invalid task execution, improving the flexibility, reliability, and accuracy of robot task execution, and optimizing the human-computer interaction experience.