Robot control methods and robots
By generating a spatial rate of change constraint matrix and fusing it with future state trajectories, the optimal control quantity is optimized and solved. The control quantity is then corrected using historical samples. This solves the problem of robot control frequency and accuracy on edge computing platforms, achieving high-frequency and precise robot control.
Patent Information
- Application Number
- CN202611223626.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-12
- Publication Date
- 2026-11-06
AI Technical Summary
On low-power, computationally limited edge heterogeneous computing platforms, existing technologies struggle to complete the full forward and backward derivative calculations of deep neural networks within control cycles of hundreds of microseconds. This forces robot controllers to reduce control frequency or simplify network models, sacrificing control accuracy and dynamic response performance.
A spatial rate of change constraint matrix is generated, which is then fused with the future state trajectory to optimize the solution of the optimal control quantity. Historical samples are generated by collecting real state data to correct the control quantity in subsequent control cycles, thus avoiding repeated system identification or disturbance observation calculations.
It achieves high-frequency, precise robot control without sacrificing control accuracy and dynamic response performance, thus improving the real-time performance and accuracy of control.
Smart Images

Figure CN123040035A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of robotics technology, and in particular relates to a robot control method and a robot. Background Technology
[0002] With the development of embodied intelligence technology, deploying real-time robot control algorithms based on deep neural networks on low-power, computationally limited edge heterogeneous computing platforms has become an industry trend. These methods typically utilize neural networks to perform end-to-end fitting of the robot's dynamics model and solve for safety constraints through online automatic differentiation, thereby combining this with model predictive control to achieve real-time optimal decision-making in highly dynamic environments. Deep network models can have millions to tens of millions of parameters, and full forward and backward differentiation involves massive floating-point multiplication and addition operations and data transfer to external memory. The computing power and storage bandwidth of edge hardware accelerators are insufficient to complete this computational task within control cycles of hundreds of microseconds, forcing controllers to reduce control frequency or simplify the network model, thus sacrificing control accuracy and dynamic response performance. Summary of the Invention
[0003] This application provides a robot control method and a robot, which helps to achieve high-frequency, precise robot control.
[0004] The first aspect of this application provides a robot control method, comprising: generating a spatial rate of change constraint matrix for the current control cycle, the spatial rate of change constraint matrix representing the changing trend of the robot's motion state relative to a preset safety boundary; predicting the robot's future state trajectory and fusing the spatial rate of change constraint matrix with the future state trajectory to obtain constraint coefficients; optimizing the solution based on the desired motion trajectory and constraint coefficients to determine the optimal control quantity for the current control cycle, and driving a motor to perform an action based on the optimal control quantity; collecting real state data after the motor performs the action, comparing the real state data with the future state trajectory, and extracting a control residual vector; generating historical samples for the current control cycle based on the control residual vector and the future state trajectory, the historical samples for the current control cycle being used to correct the optimal control quantity for subsequent control cycles.
[0005] In some embodiments of the first aspect, generating a spatial rate of change constraint matrix for the current control cycle includes: acquiring motion state data of the robot in the current control cycle; comparing the motion state data bit by bit with a preset safety boundary to generate mask information, the mask information being used to mark motion state components that exceed the preset safety boundary; and, based on the mask information, performing forward propagation and backward differentiation operations on the network weight matrix corresponding to the motion state components that exceed the preset safety boundary to obtain the spatial rate of change constraint matrix.
[0006] In some embodiments of the first aspect, comparing real state data with future state trajectories to extract control residual vectors includes: aligning real state data and future state trajectories with the same timestamp; performing a difference operation on the data values of the same motion variable in the aligned real state data and future state trajectories to obtain control residual vectors.
[0007] In some embodiments of the first aspect, the constraint coefficients are obtained by fusing the spatial rate of change constraint matrix with the future state trajectory, including: obtaining the predicted state value of each time step in the future state trajectory; using the difference between the predicted state value and the baseline state value of each time step as the state increment of that time step; and performing calculations on the state increment of each time step with the spatial rate of change constraint matrix to obtain the constraint coefficients.
[0008] In some implementations of the first aspect, generating historical samples of the current control cycle based on the control residual vector and the future state trajectory includes: asynchronously moving the control residual vector to the on-chip cache of a dedicated hardware accelerator; controlling the dedicated hardware accelerator to perform encoding operations on the control residual vector to obtain a residual feature representation; and aligning and concatenating the future state trajectory and the residual feature representation in physical memory space to generate historical samples of the current control cycle.
[0009] In some implementations of the first aspect, after generating historical samples for the current control cycle based on the control residual vector and future state trajectories, the method further includes: obtaining write pointers and read pointers of the memory bank, wherein the memory bank is configured as a ring topology in the physical address space; when it is verified that the write pointer and read pointer have overlapping addresses, triggering the marking of the physical memory page containing the historical sample with the longest unaccessed duration in the memory bank as an overwriteable state; and writing the historical samples of the current control cycle into the overwriteable physical memory page.
[0010] In some implementations of the first aspect, after generating historical samples for the current control cycle based on the control residual vector and the future state trajectory, the method further includes: at the start of the next control cycle, using the robot's current state data as a query vector; retrieving the historical sample with the highest similarity to the query vector from the memory, and extracting the control residual vector corresponding to the historical sample with the highest similarity; and representing the control residual vector corresponding to the historical sample with the highest similarity as a feedforward compensation amount to correct the control command for the next control cycle.
[0011] In some implementations of the first aspect, retrieving and querying the historical sample with the highest vector similarity in the memory bank includes: extracting the historical state field of each historical sample in the memory bank in parallel; performing an absolute value summation operation on the difference between the query vector and each group of historical state fields to obtain the cumulative difference corresponding to each historical sample; outputting the cumulative difference corresponding to each historical sample in parallel within a preset fixed clock cycle; and determining the historical sample with the smallest cumulative difference as the historical sample with the highest similarity.
[0012] In some embodiments of the first aspect, collecting real-state data after the motor performs an action includes: detecting the count value of a hardware timer after the motor performs an action; triggering a sampling interrupt when the count value reaches the sampling boundary; and triggering multiple source sensors to perform synchronous sampling and digitization processing on the same clock edge to obtain real-state data.
[0013] A second aspect of this application provides a robot control device, comprising: a constraint matrix generation unit for generating a spatial rate of change constraint matrix for the current control cycle, the spatial rate of change constraint matrix representing the trend of the robot's motion state relative to a preset safety boundary; a constraint coefficient generation unit for predicting the robot's future state trajectory and fusing the spatial rate of change constraint matrix with the future state trajectory to obtain constraint coefficients; a robot control unit for optimizing the solution based on the desired motion trajectory and constraint coefficients to determine the optimal control quantity for the current control cycle and driving the motor to perform actions based on the optimal control quantity; a residual extraction unit for collecting real state data after the motor performs actions, comparing the real state data with the future state trajectory, and extracting a control residual vector; and a historical sample generation unit for generating historical samples for the current control cycle based on the control residual vector and the future state trajectory, the historical samples for the current control cycle being used to correct the optimal control quantity for subsequent control cycles.
[0014] A third aspect of this application provides a robot, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the robot control method described above.
[0015] A fourth aspect of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the robot control method described above.
[0016] The fifth aspect of this application provides a computer program product that, when run, causes the above-described robot control method to be executed.
[0017] In the embodiments of this application, a spatial rate of change constraint matrix representing the trend of motion state change relative to a preset safety boundary is generated. The spatial rate of change constraint matrix is fused with the future state trajectory to obtain constraint coefficients. Based on the desired motion trajectory and constraint coefficients, optimization is performed to determine the optimal control quantity for the current control cycle. The motor is driven to perform actions based on the optimal control quantity. The real state data after the motor performs the actions is compared with the future state trajectory to extract the control residual vector. Then, historical samples of the current control cycle are generated based on the control residual vector and the future state trajectory. This ensures that the execution deviation generated in the current control cycle is no longer discarded, but is retained in the form of structured samples and used to correct the optimal control quantity for subsequent control cycles. This eliminates the need to repeatedly perform additional system identification or disturbance observation calculations, which helps to achieve high-frequency and precise robot control. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This is a schematic diagram illustrating the implementation process of a robot control method provided in an embodiment of this application; Figure 2 This is a schematic diagram illustrating the implementation process of the correction method for the next control cycle provided in the embodiments of this application; Figure 3 This is a schematic diagram of the structure of a robot control device provided in an embodiment of this application; Figure 4 This is a schematic diagram of the robot provided in the embodiments of this application. Detailed Implementation
[0020] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are protected by this application.
[0021] Deep network models can have millions to tens of millions of parameters. The full forward and backward differentiation involves massive floating-point multiplication and addition operations and data transfer to external memory. The computing power and storage bandwidth of edge hardware accelerators are insufficient to complete this computational task within control cycles of hundreds of microseconds, forcing controllers to reduce control frequency or simplify network models, thus sacrificing control accuracy and dynamic response performance. Therefore, this application proposes a robot control method that eliminates the need for repeated system identification or disturbance observation calculations, enabling high-frequency, precise robot control without sacrificing control accuracy and dynamic response performance.
[0022] To illustrate the technical solution of this application, specific embodiments are described below.
[0023] Figure 1 The illustration shows a schematic diagram of the implementation process of a robot control method provided in an embodiment of this application, which can be applied to robots.
[0024] Specifically, the above-mentioned robot control method may include the following steps S101 to S105.
[0025] Step S101: Generate the spatial rate of change constraint matrix for the current control cycle.
[0026] In the embodiments of this application, the robot can cyclically perform state perception, decision calculation, and command output according to a fixed control cycle length. The current control cycle refers to the control cycle for the current output command.
[0027] The spatial rate of change constraint matrix characterizes the trend of the robot's motion state relative to a preset safety boundary. The robot's motion state describes its motion characteristics in the current control cycle and can include variables such as the angles, angular velocities, and angular accelerations of each joint, as well as the position, velocity, and forces acting on the end effector. The preset safety boundary is a pre-defined allowable range of motion states to ensure safe robot operation, determined by the robot's physical limits, task space constraints, and safety regulations. A robot's motion state is considered safe when it lies within the preset safety boundary, while exceeding it constitutes a potential risk. Therefore, the spatial rate of change constraint matrix ensures that control commands never exceed the safe range during robot motion control.
[0028] Step S102: Predict the robot's future state trajectory and fuse the spatial rate of change constraint matrix with the future state trajectory to obtain the constraint coefficients.
[0029] The future state trajectory is a sequence of robot motion states, obtained by forward extrapolation from the robot's physical dynamics model within the current control cycle, covering all time steps within a preset future time window. The future state trajectory provides information on the changes in motion states for solving the control variables.
[0030] By fusing the spatial rate of change constraint matrix with the future state trajectory, the process combines boundary information, which originally existed only as a trend, with specific predicted state values to form constraint coefficients that use the state at each time step in the future trajectory as variables. These constraint coefficients can then serve as constraints during robot motion control, ensuring that control commands meet safety constraints at each future time step.
[0031] Step S103: Based on the desired motion trajectory and constraint coefficients, perform optimization to determine the optimal control quantity for the current control cycle, and drive the motor to perform actions based on the optimal control quantity.
[0032] The desired trajectory is given as a sequence of desired states at each time step within the predicted time range, serving as the tracking target for optimization. The desired trajectory and constraint coefficients are input into the optimization solver. The optimization objective is to make the robot's actual trajectory as close as possible to the desired trajectory, with the constraints defined by the constraint coefficients within a safe range. The optimization solver, combined with the robot's physical dynamics model, searches for the control sequence that minimizes the tracking error within the safe range defined by the constraint coefficients, thus obtaining the optimal control quantity.
[0033] The optimal control quantity obtained through optimization is a control sequence for each time step within the predicted time range. The control quantity at the first time step in this sequence is taken as the output command for the current control cycle. The output command can be sent to the servo drive chip by rewriting the settings of the motor drive register (such as the PWM duty cycle or current loop setting value) to drive the robot's motor to perform actions.
[0034] Step S104: Collect the actual state data after the motor performs the action, compare the actual state data with the future state trajectory, and extract the control residual vector.
[0035] After the motor performs its actions, it samples data from multiple sources, including encoders, force sensors, and inertial measurement units, to obtain real-state data. This real-state data reflects the physical execution results of the motor and may include, but is not limited to, the actual angles, angular velocities, and angular accelerations of each joint, as well as the actual position, velocity, and forces acting on the end effector.
[0036] The difference between the actual state data and the data at the corresponding time step in the future state trajectory is calculated variable-wise. Let the predicted value at a certain time step in the future state trajectory be x_pred, and the measured value of the corresponding variable at the same time step in the actual state data be x_real. Then, the corresponding element in the control residual vector is x_real - x_pred. Arranging the differences at each time step within the prediction time range in chronological order forms the control residual vector. Each element in the residual vector reflects the prediction deviation of the corresponding variable at the corresponding time step. Sources of deviation include unmodeled dynamic characteristics (such as friction, load changes), external environmental disturbances (such as contact forces, gravity interference), and physical factors such as sensor noise.
[0037] Step S105: Generate historical samples for the current control cycle based on the control residual vector and the future state trajectory.
[0038] Among them, the historical samples of the current control cycle represent the state information (future state trajectory) and the corresponding disturbance information (control residual vector) of the current control cycle, which can be used to correct the optimal control quantity for subsequent control cycles.
[0039] Understandably, in real physical environments, the disturbances faced by robots (such as friction, load changes, and external contact forces) are often repetitive, and the characteristics of these disturbances are usually similar under the same or similar motion states. Therefore, by binding and storing the control residual vector extracted in the current control cycle with the corresponding future state trajectory, when a motion state similar to the future state trajectory occurs again in a subsequent control cycle, the control residual vector recorded in this historical sample can be directly called for feedforward compensation without the need for re-identification of the system or recalculation of disturbance observation.
[0040] In the embodiments of this application, a spatial rate of change constraint matrix representing the trend of motion state change relative to a preset safety boundary is generated. The spatial rate of change constraint matrix is fused with the future state trajectory to obtain constraint coefficients. Based on the desired motion trajectory and constraint coefficients, optimization is performed to determine the optimal control quantity for the current control cycle. The motor is driven to perform actions based on the optimal control quantity. The real state data after the motor performs the actions is compared with the future state trajectory to extract the control residual vector. Then, historical samples of the current control cycle are generated based on the control residual vector and the future state trajectory. This ensures that the execution deviation generated in the current control cycle is no longer discarded, but is retained in the form of structured samples and used to correct the optimal control quantity for subsequent control cycles. This eliminates the need to repeatedly perform additional system identification or disturbance observation calculations, which helps to achieve high-frequency and precise robot control.
[0041] In some embodiments of this application, generating the spatial rate of change constraint matrix for the current control cycle may include: acquiring the motion state data of the robot in the current control cycle; comparing the motion state data bit by bit with a preset safety boundary to generate mask information; and performing forward propagation and backward differentiation operations on the network weight matrix corresponding to the motion state components that exceed the preset safety boundary based on the mask information to obtain the spatial rate of change constraint matrix.
[0042] Specifically, the direct memory access (DMA) controller of the robot's hardware accelerator can read the real-time motion state data of the robot's current control cycle from the main memory via the AXI4 bus and write it into the on-chip Level 1 cache (L1 Cache) in the form of continuous address mapping.
[0043] The on-chip vector computation unit inputs motion state data into a pre-stored state prediction operator for matrix multiplication and addition operations. The output result is sent to an on-chip hardware comparator, which compares it bit-by-bit with a preset safety threshold in a register. This identifies the components whose rate of change needs to be calculated, yielding mask information. The mask information is used to mark motion state components that exceed the preset safety boundary. Specifically, for components whose motion state data exceeds the preset safety boundary, a high-level signal is written to the corresponding bit in the dedicated hardware mask register, marking them as high-risk sensitive channels; components that do not exceed the preset safety boundary are written with a low-level signal, marking them as safe cold channels.
[0044] Based on the high-level index (i.e., the component exceeding the preset security threshold) in the mask information, the weight matrix can be loaded in a targeted manner. That is, the network weight matrix corresponding to the high-risk sensitive channel is loaded into the on-chip static random access memory, while address blocking is applied to the network weight matrix corresponding to the safe cold channel. The multiply-accumulator performs forward propagation. When the data flows through the activation function layer, the dedicated mathematical function unit calls the internal hardware lookup table to perform floating-point smoothing operations and outputs the activation values of neurons in each layer. Subsequently, the arithmetic logic unit starts the reverse differentiation pipeline, performing chained multiplication and addition of derivatives only along the high-level hardware path recorded in the mask register. The hardware register corresponding to the safe cold channel is directly cleared to zero, skipping all differentiation calculations. Finally, each high-risk sensitive channel can obtain a rate of change value. The rates of change at different time steps are arranged in time sequence to form a complete spatial rate of change constraint matrix.
[0045] To achieve hardware decoupling between computation and data transmission, a dual-buffer ping-pong structure can be adopted: while the periodic spatial rate of change constraint matrix of the current control cycle is written to the first buffer for subsequent reading, the hardware accelerator directly switches the write pointer to the second buffer to begin computation for the next control cycle, without waiting for the main control processor to finish reading. Specifically, the accelerator's internal tensor rearrangement engine concatenates the analytical spatial rate of change matrices generated at each time step within the prediction time range into a continuous temporal constraint gradient chain matrix in chronological order, and writes it, along with the forward prediction boundary values, to the first buffer in the shared memory of the heterogeneous chips. After writing is complete, a computation completion pulse signal is sent to the interrupt controller, switching the internal write pointer to the second buffer to begin computation for the next cycle.
[0046] In some embodiments of this application, predicting the future state trajectory of a robot may include: reading the robot's own physical dynamics and kinematic state equations, and predicting the robot's future state trajectory based on encoder readings fed back by the robot's physical actuators in the previous control cycle.
[0047] Specifically, the prediction of future state trajectories can be executed by the main control central processing unit and can be performed in parallel or overlapping with the generation of the spatial rate of change constraint matrix on the time axis. That is, while the hardware accelerator generates the spatial rate of change constraint matrix of the current control cycle, the main control central processing unit can simultaneously execute the state prediction of the next control cycle, realizing the overlap of data transfer and logical calculation.
[0048] The main control central processing unit reads the robot's own physical dynamics and kinematic state equations through its internal arithmetic pipeline, and combines them with the encoder readings fed back by the physical actuators in the previous control cycle. Starting from the current motion state, it recursively calculates the motion state values at each future moment within the predicted time range, forming the future state trajectory.
[0049] Meanwhile, the main control CPU can receive the desired motion trajectory issued by the upper-level high-order policy model through the external bus, and store the desired motion trajectory as a target tracking item in the cache of the main control CPU for use in subsequent optimization and solution steps.
[0050] In some embodiments of this application, the constraint coefficients are obtained by fusing the spatial rate of change constraint matrix with the future state trajectory. This may include: obtaining the predicted state value of each time step in the future state trajectory; using the difference between the predicted state value and the baseline state value of each time step as the state increment of that time step; and performing calculations on the state increments of each time step with the spatial rate of change constraint matrix to obtain the constraint coefficients.
[0051] Specifically, after receiving the interrupt pulse signal from the hardware accelerator, the main control CPU's bus controller reads the timing constraint gradient chain matrix (i.e., the storage form of the spatial rate of change constraint matrix in shared memory) and the forward prediction boundary values from the first cache of shared memory using direct memory access. While the main control CPU reads and processes the data of the current control cycle, the floating-point pipeline of the hardware accelerator synchronously starts the calculation of the rate of change matrix for the next control cycle. The two processes overlap in a predetermined phase on the time axis, achieving the overlap of data transfer and logical calculation.
[0052] The floating-point unit of the main CPU extracts the predicted state values for each time step in the future state trajectory from the cache, along with the spatial rate of change constraint matrix and forward prediction boundary values. The difference between the predicted state value and the baseline state value at each time step is used as the state increment for that time step. The CPU's instruction decoder issues a Single Instruction Multiple Data (SIMD) multiply-add instruction, and the control vector coprocessor performs parallel matrix multiplication operations on the state increments of each time step with the spatial rate of change constraint matrix, and then sums the product results with the forward prediction boundary values to obtain the linear inequality constraint expressions for each time step. The coefficient matrix of the linear inequality constraint expressions for each time step, together with the boundary constant vector, is used as constraint coefficients and overwritten into the designated model prediction control constraint boundary memory-mapped register area.
[0053] Subsequently, the core computing cluster of the main control CPU reads the robot's physical dynamics model matrix and desired motion trajectory pre-stored in memory, and fuses them with constraint coefficients to construct a standard quadratic programming optimization problem matrix. The desired motion trajectory defines the desired motion state at each time step, the physical dynamics model matrix establishes the mapping relationship between control inputs and the state trajectory, and the constraint coefficients limit the safety range that the state variables must satisfy at each time step. The main control CPU calls its internally hard-optimized matrix decomposition operator hardware circuit and iterative optimization algorithm to cascade and solve the optimization problem matrix, calculating the future optimal control parameter sequence within the safety boundaries defined by the constraint coefficients.
[0054] The output control interface of the main control central processing unit extracts the first time step control quantity from the optimal control parameter sequence as the control instruction for the current control cycle. By rewriting the pulse width modulation (PWM) duty cycle register value (or current loop setpoint register) in the external timer register, it sends the value to the robot's servo drive chip through the external industrial communication bus, which can drive the physical motor to perform actions.
[0055] In some embodiments of this application, collecting real state data after the motor performs an action may include: after the motor performs an action, detecting the count value of a hardware timer, triggering a sampling interrupt when the count value reaches the sampling boundary, and triggering multiple source sensors to perform synchronous sampling and digitization processing on the same clock edge to obtain real state data.
[0056] While the motor-driven actuator completes its action response, the onboard hardware timer continuously counts. When its count value reaches the preset sampling period boundary, a high-priority hardware clock interrupt signal is sent to the interrupt controller. This hardware clock interrupt signal synchronously triggers the onboard analog-to-digital converter and quadrature encoder pulse counting chip. These hardware sampling chips perform hardware-level synchronous latching and digital sampling of the robot's multi-source sensor physical signals (such as actual joint angles, end-effector physical forces, and actual motor currents) on the same clock edge.
[0057] After digital sampling is completed, the Direct Memory Access Controller (DMI) is activated by a hardware full-capacity signal and automatically enters burst transfer mode. In burst transfer mode, the DMI exclusively uses the system data bus channel, bypassing the main CPU core, and directly transfers the real-state data collected by the multi-source sensors to the main CPU's L2 cache in the form of continuous address mapping, latching it as the real-state data for the current control cycle.
[0058] In some embodiments of this application, comparing real state data with future state trajectories to extract control residual vectors may include: aligning real state data and future state trajectories with the same timestamp; performing difference operations on the data values of the same motion variable in the aligned real state data and future state trajectories to obtain control residual vectors.
[0059] Specifically, the memory management unit of the main control CPU initiates address alignment logic, simultaneously accessing the memory starting address of the future state trajectory and the memory starting address of the actual state data in the first-level data cache. The memory management unit ensures, through address offset alignment, that motion state components with the same timestamp in the two data blocks are in a state where they can be extracted in pairs. The CPU's instruction decoder issues a vector loading instruction, loading the aligned future state trajectory and actual state data into two sets of wide-bit single-instruction multiple-data vector register arrays, respectively. Subsequently, the vector coprocessor issues a hardware subtraction instruction, controlling the arithmetic logic unit to perform parallel floating-point difference operations on corresponding elements (i.e., data values belonging to the same motion variable and the same timestamp) in the two sets of vector registers within a single clock cycle. This difference operation directly filters out the known consistency components in the nominal dynamics model, stripping away nonlinear prediction errors caused by external unknown environmental disturbances and unmodeled physical characteristics.
[0060] The arithmetic logic unit defines the result of the difference operation as a control residual vector and writes it over the data into a specially allocated residual data storage area in the heterogeneous shared static random access memory, which is protected by read-write interlocks.
[0061] In some embodiments of this application, generating historical samples of the current control cycle based on the control residual vector and the future state trajectory may include: asynchronously moving the control residual vector to the on-chip cache of a dedicated hardware accelerator; controlling the dedicated hardware accelerator to perform encoding operations on the control residual vector to obtain a residual feature representation; and aligning and concatenating the future state trajectory and the residual feature representation in physical memory space to generate historical samples of the current control cycle.
[0062] Specifically, after completing the write of the control residual vector, the main control CPU rewrites the status flags of the shared memory and sends an asynchronous computation interrupt to the dedicated hardware accelerator via a mailbox mechanism. Upon receiving the interrupt, the internal bus controller of the hardware accelerator immediately reads the control residual vector in the shared memory residual data storage area asynchronously into the hardware accelerator's own on-chip high-speed dedicated cache via the cross-chip high-speed bus, while simultaneously releasing the memory lock of the main control CPU.
[0063] The hardware accelerator internally deploys a pre-trained encoding network. The weight matrices of each layer of this encoding network are permanently locked by the on-chip memory management unit and reside in the high-bandwidth dedicated storage cluster within the hardware accelerator. Simultaneously, the hardware scheduler within the accelerator dynamically allocates activation channels of the on-chip multiply-accumulate computing array based on the dimension of the control residual vector. Subsequently, the multiply-accumulate array of the hardware accelerator initiates pipelined forward feature extraction computation: the control residual vector is used as input data, and multi-layer nonlinear spatial dimensionality reduction multiply-accumulate mapping is performed in the multiply-accumulate computing array. As the data flows through the network's hidden layers, dedicated mathematical function units perform nonlinear smoothing feature amplification by calling internal hardware lookup tables. The final layer of the network outputs a fixed-dimensional, low-dimensional, high-density feature vector, which is latched into the accelerator's output data register and defined as the residual feature representation.
[0064] The memory management unit of the main control CPU is activated, initiating the spatial address remapping logic. In the first-level data cache, it sequentially retrieves the future state trajectory data block for the current control cycle from small to large addresses, along with the residual feature representation data block latched by the hardware accelerator output data register. The memory management unit concatenates the two sets of data by controlling the address offset pointer and performs cache line boundary alignment, reconstructing them into a composite residual empirical sample data block that is absolutely contiguous in physical memory addresses, recorded as the historical sample for the current control cycle. In this historical sample, the future state trajectory serves as the index key for subsequent retrievals, and the residual feature representation serves as the compensation value extracted after a successful retrieval.
[0065] In some embodiments of this application, after generating historical samples for the current control cycle based on the control residual vector and future state trajectory, the method may further include: obtaining the write pointer and read pointer of the memory bank, wherein the memory bank is configured as a ring topology in the physical address space; when the write pointer and read pointer are found to overlap in address, triggering the marking of the physical memory page containing the historical sample with the longest unaccessed duration in the memory bank as an overwriteable state; and writing the historical samples for the current control cycle into the overwriteable physical memory page.
[0066] Specifically, the memory bank is pre-allocated in an external static random access memory, which is configured in a ring topology in the physical address space. Historical samples are stored and managed in a circular manner through write pointers and read pointers: the write pointer points to the storage location that is about to be written, and the read pointer points to the location of the earliest stored historical sample. Both move unidirectionally along the ring address space.
[0067] The memory controller reads the address values of the current write and read pointers and executes verification logic. When the write and read pointers overlap, it means the circular memory space is full, triggering the on-chip hardware-level page replacement controller. This controller reads the on-chip least recently used counter register array, which records the duration of time since each existing historical sample was last read. The historical sample with the largest counter value is the sample with the longest inaccessible time. The controller marks the physical memory page containing this sample as writable.
[0068] After the page space is freed up, the Direct Memory Access Controller switches to burst transfer mode, exclusively occupying the data bus channel. It then writes the assembled historical samples of the current control cycle from the CPU's L1 cache into the physical memory page marked as writable using a single-cycle, multi-word continuous spraying method. Upon completion of the write, the external memory controller's status register automatically sets the read / write interlock flag corresponding to that physical memory address to a locked state to prevent read / write conflicts and data tearing during multi-core computation.
[0069] In some embodiments of this application, such as Figure 2 As shown, after generating historical samples of the current control cycle based on the control residual vector and future state trajectory, the process may further include steps S201 to S203.
[0070] Step S201: When the next control cycle starts, the robot's current state data is used as the query vector.
[0071] Specifically, when the next control cycle starts and the global hard synchronization clock rises, the main control CPU captures the robot's latest motion state data through the peripheral interface, packages it as a query vector, and distributes it synchronously to the local register arrays of each independent computing core of the parallel vector coprocessor inside the main control chip in a broadcast manner through the on-chip network router.
[0072] Step S202: Retrieve the historical sample with the highest similarity to the query vector in the memory, and extract the control residual vector corresponding to the historical sample with the highest similarity.
[0073] The process of retrieving and querying the historical sample with the highest vector similarity in the memory bank can include: extracting the historical state field of each historical sample in the memory bank in parallel; performing an absolute value summation operation on the difference between the query vector and each group of historical state fields to obtain the cumulative difference corresponding to each historical sample; outputting the cumulative difference corresponding to each historical sample in parallel within a preset fixed clock cycle; and determining the historical sample with the smallest cumulative difference as the historical sample with the highest similarity.
[0074] Specifically, the vector coprocessor issues parallel comparison instructions, activating the internal single-instruction multiple-data vector parallel computing array. The coprocessor controls multiple arithmetic logic units to operate simultaneously, retrieving historical state fields from multiple sets of historical samples in batches from the memory bank via a multi-channel data bus and loading them into the vector register array. The chip's integrated dedicated hardware difference absolute value accumulation cascade circuit is activated, controlling the arithmetic logic units to perform parallel floating-point difference subtraction operations between the query vector and each historical state field, followed by absolute value conversion and accumulation. The cumulative difference corresponding to each historical sample is output in parallel within a preset fixed clock cycle. The entire retrieval process does not contain any conditional branch jump instructions in the hardware pipeline, ensuring that the set of historical samples with the smallest cumulative difference is directly output within the fixed clock cycle; this sample is the historical sample with the highest similarity to the current query vector.
[0075] Step S203: The control residual vector corresponding to the historical sample with the highest similarity is used as the feedforward compensation amount to correct the control command for the next control cycle.
[0076] The main control CPU extracts the control residual vector (i.e., the residual feature representation in the historical sample) stored in the historical sample with the highest similarity and uses it as the optimal feedforward estimation feature for the current unmodeled dynamic disturbance. This feature is overwritten into the designated model predictive control optimization feedforward compensation register area and cascaded and fused with the optimal control quantity obtained from the optimization solution of the current control cycle to complete the real-time adaptive feedforward correction of the dynamic uncertainty of the current cycle. Finally, the pulse width modulation drive register is rewritten to output the physical current to control the mechanical mechanism to perform motion.
[0077] It should be noted that, for the sake of simplicity, the aforementioned method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, because according to this application, some steps can be performed in other orders.
[0078] like Figure 3 The diagram shown is a structural schematic of a robot control device 300 provided in an embodiment of this application. The robot control device 300 is disposed on a robot.
[0079] Specifically, the robot control device 300 may include: The constraint matrix generation unit 301 is used to generate the spatial rate of change constraint matrix of the current control cycle. The spatial rate of change constraint matrix represents the trend of the robot's motion state relative to the preset safety boundary. The constraint coefficient generation unit 302 is used to predict the future state trajectory of the robot and fuse the spatial rate of change constraint matrix with the future state trajectory to obtain the constraint coefficients. The robot control unit 303 is used to perform optimization solutions based on the desired motion trajectory and constraint coefficients, determine the optimal control quantity for the current control cycle, and drive the motor to perform actions based on the optimal control quantity. The residual extraction unit 304 is used to collect the real state data after the motor performs the action, compare the real state data with the future state trajectory, and extract the control residual vector. The historical sample generation unit 305 is used to generate historical samples for the current control cycle based on the control residual vector and the future state trajectory. The historical samples for the current control cycle are used to correct the optimal control quantity for subsequent control cycles.
[0080] In some embodiments of this application, the constraint matrix generation unit 301 is specifically used to: acquire the motion state data of the robot in the current control cycle; compare the motion state data with the preset safety boundary bit by bit to generate mask information, the mask information being used to mark the motion state components that exceed the preset safety boundary; and, based on the mask information, perform forward propagation and backward differentiation operations on the network weight matrix corresponding to the motion state components that exceed the preset safety boundary to obtain the spatial rate of change constraint matrix.
[0081] In some embodiments of this application, the residual extraction unit 304 is specifically used to: align the real state data and the future state trajectory with the same timestamp; and perform a difference operation on the data values of the same motion variable in the aligned real state data and the future state trajectory to obtain the control residual vector.
[0082] In some embodiments of this application, the constraint coefficient generation unit 302 is specifically used to: obtain the predicted state value of each time step in the future state trajectory, take the difference between the predicted state value and the baseline state value of each time step as the state increment of that time step, and perform calculation processing on the state increment of each time step with the spatial rate of change constraint matrix to obtain the constraint coefficient.
[0083] In some embodiments of this application, the historical sample generation unit 305 is specifically used to: asynchronously transport the control residual vector to the on-chip cache of the dedicated hardware accelerator; control the dedicated hardware accelerator to perform encoding operations on the control residual vector to obtain a residual feature representation; and perform address alignment and splicing of the future state trajectory and the residual feature representation in the physical memory space to generate historical samples of the current control cycle.
[0084] In some embodiments of this application, the historical sample generation unit 305 can also be used to: obtain the write pointer and read pointer of the memory bank, wherein the memory bank is configured as a ring topology in the physical address space; when the write pointer and read pointer are found to overlap in address, trigger the marking of the physical memory page where the historical sample with the longest unaccessed time in the memory bank is located as an overwriteable state; and write the historical sample of the current control cycle into the overwriteable physical memory page.
[0085] In some embodiments of this application, the robot control device 300 further includes a correction unit, configured to: at the start of the next control cycle, use the robot's current state data as a query vector; retrieve the historical sample with the highest similarity to the query vector from the memory bank, and extract the control residual vector corresponding to the historical sample with the highest similarity; represent the control residual vector corresponding to the historical sample with the highest similarity as a feedforward compensation amount, and correct the control command for the next control cycle.
[0086] In some embodiments of this application, the correction unit is specifically used for: extracting the historical state fields of each historical sample in the memory in parallel; performing an absolute value summation operation on the query vector and each group of historical state fields to obtain the cumulative difference corresponding to each historical sample; outputting the cumulative difference corresponding to each historical sample in parallel within a preset fixed clock cycle; and determining the historical sample with the smallest cumulative difference as the historical sample with the highest similarity.
[0087] In some embodiments of this application, the residual extraction unit 304 is specifically used to: detect the count value of the hardware timer after the motor performs an action; when the count value reaches the sampling boundary, a sampling interrupt is triggered, and the sampling interrupt triggers multiple source sensors to perform synchronous sampling and digital processing on the same clock edge to obtain real state data.
[0088] It should be noted that, for the sake of convenience and brevity, the specific working process of the robot control device 300 described above can be found in the following reference: Figures 1 to 2 The corresponding process of the method will not be described in detail here.
[0089] like Figure 4 The diagram shown is a schematic representation of a robot according to an embodiment of this application. The robot 4 may include: a processor 40, a memory 41, and a computer program 42 stored in the memory 41 and executable on the processor 40, such as a robot control program. When the processor 40 executes the computer program 42, it implements the steps described in the various robot control method embodiments above, for example... Figure 1 Steps S101 to S105 are shown. Alternatively, when the processor 40 executes the computer program 42, it implements the functions of each module / unit in the above-described device embodiments, for example... Figure 3 The functions of the constraint matrix generation unit 301, constraint coefficient generation unit 302, robot control unit 303, residual extraction unit 301, and historical sample generation unit 305 are shown.
[0090] The computer program can be divided into one or more modules / units, which are stored in the memory 41 and executed by the processor 40 to complete this application. The one or more modules / units can be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the robot.
[0091] For example, a computer program can be divided into: a constraint matrix generation unit, used to generate a spatial rate of change constraint matrix for the current control cycle, which represents the trend of the robot's motion state relative to a preset safety boundary; a constraint coefficient generation unit, used to predict the robot's future state trajectory and fuse the spatial rate of change constraint matrix with the future state trajectory to obtain constraint coefficients; a robot control unit, used to optimize the solution based on the desired motion trajectory and constraint coefficients, determine the optimal control quantity for the current control cycle, and drive the motor to perform actions based on the optimal control quantity; a residual extraction unit, used to collect the real state data after the motor performs actions, compare the real state data with the future state trajectory, and extract the control residual vector; and a historical sample generation unit, used to generate historical samples for the current control cycle based on the control residual vector and the future state trajectory, which are used to correct the optimal control quantity for subsequent control cycles.
[0092] The robot may include, but is not limited to, a processor 40 and a memory 41. Those skilled in the art will understand that... Figure 4 This is merely an example of a robot and does not constitute a limitation on the robot. It may include more or fewer parts than shown, or combine certain parts, or different parts. For example, the robot may also include a chassis, robotic arm, display screen, input / output devices, network access devices, bus, etc.
[0093] The processor 40 may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.
[0094] The memory 41 can be an internal storage unit of the robot, such as a hard drive or RAM. Alternatively, the memory 41 can be an external storage device of the robot, such as a plug-in hard drive, Smart Media Card (SMC), Secure Digital (SD) card, or FlashCard. Furthermore, the memory 41 can include both internal and external storage units. The memory 41 is used to store the computer program and other programs and data required by the robot. The memory 41 can also be used to temporarily store data that has been output or will be output.
[0095] It should be noted that, for the sake of convenience and brevity, the structure of the robot described above can also be referred to the specific description of the structure in the method embodiment, which will not be repeated here.
[0096] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments 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. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0097] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0098] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for various specific applications, but such implementations should not be considered beyond the scope of this application.
[0099] In the embodiments provided in this application, it should be understood that the disclosed robots and methods can be implemented in other ways. For example, the robot embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.
[0100] 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.
[0101] Furthermore, the functional units in the various embodiments of 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. The integrated unit can be implemented in hardware or as a software functional unit.
[0102] If the integrated module / unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, 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 can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.
[0103] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications 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, and should all be included within the protection scope of this application.
Claims
1. A robot control method, characterized in that, include: Generate a spatial rate of change constraint matrix for the current control cycle, wherein the spatial rate of change constraint matrix characterizes the changing trend of the robot's motion state relative to a preset safety boundary; Predict the robot's future state trajectory and fuse the spatial rate of change constraint matrix with the future state trajectory to obtain constraint coefficients; Based on the desired motion trajectory and the constraint coefficients, an optimization solution is performed to determine the optimal control quantity for the current control cycle, and the motor is driven to perform actions based on the optimal control quantity. Collect real-state data after the motor performs an action, compare the real-state data with the future state trajectory, and extract the control residual vector; The historical samples of the current control cycle are generated based on the control residual vector and the future state trajectory. The historical samples of the current control cycle are used to correct the optimal control quantity for subsequent control cycles.
2. The robot control method according to claim 1, characterized in that, The generation of the spatial rate of change constraint matrix for the current control cycle includes: Obtain the robot's motion state data during the current control cycle; The motion state data is compared bit by bit with the preset safety boundary to generate mask information, which is used to mark motion state components that exceed the preset safety boundary. Based on the mask information, forward propagation and backward differentiation operations are performed on the network weight matrix corresponding to the motion state components that exceed the preset safety boundary to obtain the spatial rate of change constraint matrix.
3. The robot control method according to claim 1, characterized in that, The step of comparing the real state data with the future state trajectory and extracting the control residual vector includes: Align the actual state data with the future state trajectory using the same timestamp; The control residual vector is obtained by performing a difference operation on the aligned real state data and the data values of the same motion variable in the future state trajectory.
4. The robot control method according to claim 1, characterized in that, The process of fusing the spatial rate of change constraint matrix with the future state trajectory to obtain constraint coefficients includes: Obtain the predicted state value at each time step in the future state trajectory, and use the difference between the predicted state value and the baseline state value at each time step as the state increment at that time step. The state increment at each time step is processed by the spatial rate of change constraint matrix to obtain the constraint coefficients.
5. The robot control method according to claim 1, characterized in that, The step of generating historical samples for the current control cycle based on the control residual vector and the future state trajectory includes: The control residual vector is asynchronously moved to the on-chip cache of a dedicated hardware accelerator. The dedicated hardware accelerator is controlled to perform an encoding operation on the control residual vector to obtain a residual feature representation; The future state trajectory and the residual feature representation are addressed and concatenated in the physical memory space to generate the historical sample of the current control cycle.
6. The robot control method according to claim 1, characterized in that, After generating the historical samples of the current control cycle based on the control residual vector and the future state trajectory, the method further includes: Obtain the write pointer and read pointer of the memory bank, which is configured as a ring topology in the physical address space; When it is detected that the write pointer and the read pointer have overlapping addresses, the physical memory page containing the historical sample with the longest unaccessed time in the memory bank is marked as writable. Write the historical samples of the current control cycle into the physical memory page that is in an overwriteable state.
7. The robot control method according to any one of claims 1-6, characterized in that, After generating historical samples of the current control cycle based on the control residual vector and the future state trajectory, the method further includes: When the next control cycle starts, the robot's current state data is used as a query vector; Retrieve the historical sample with the highest similarity to the query vector from the memory bank, and extract the control residual vector corresponding to the historical sample with the highest similarity; The control residual vector corresponding to the historical sample with the highest similarity is represented as the feedforward compensation amount, and the control command of the next control cycle is corrected.
8. The robot control method according to any one of claims 7, characterized in that, The step of retrieving the historical sample with the highest similarity to the query vector from the memory includes: The historical state fields of each historical sample in the memory are extracted in parallel. The query vector is summed with the absolute value of the difference of each group of historical state fields to obtain the cumulative difference of each historical sample. The cumulative difference of each historical sample is output in parallel within a preset fixed clock cycle. The historical sample with the smallest cumulative difference is determined as the historical sample with the highest similarity.
9. The robot control method according to any one of claims 1-6, characterized in that, The collected real-state data after the motor performs its actions includes: After the motor performs an action, the count value of the hardware timer is detected; When the count value reaches the sampling boundary, a sampling interrupt is triggered. The sampling interrupt triggers multiple source sensors to perform synchronous sampling and digitization processing on the same clock edge to obtain the real state data.
10. A robot, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the steps of the robot control method as described in any one of claims 1 to 9.
