Motor driving direction correction method and device based on encoder feedback

CN120963399BActive Publication Date: 2026-08-07深圳市信诚未来科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
深圳市信诚未来科技有限公司
Filing Date
2025-09-17
Publication Date
2026-08-07

AI Technical Summary

Technical Problem

[0002]传统的两轮平衡车辆主要依赖陀螺仪和加速度计进行姿态控制,但在复杂路况下,路面不平、载重变化、坡道行驶等因素会导致左右驱动轮之间产生耦合效应和非线性动力学特性变化,导致方向控制性能下降,当目标车辆在直行、转弯、爬坡、载重等不同运动模式之间切换时,左右轮的动力学耦合关系发生变化,固定参数控制器无法实时调整控制策略,导致方向偏差累积和控制精度不足

Benefits of technology

[0014] The technical solution provided by this invention employs an adaptive Kalman filter instead of the traditional fixed-parameter filtering method. This allows for dynamic adjustment of the process noise covariance matrix based on the real-time signal-to-noise ratio of the encoder signal. Even under complex environments such as vibration and bumps, high-quality angle data can be obtained, extracting complete dynamic features including direction angle, angular velocity, and angular acceleration. Real-time modal analysis of the direction deviation features accurately identifies different motion modes such as straight-line steady state, regular turning, uphill loading, and sharp-turn obstacle avoidance. It quantifies the dynamic influence relationship between the left and right drive wheels, offering higher recognition accuracy and anti-interference capability compared to simple threshold judgment methods, ensuring smooth and accurate mode switching. Dedicated control parameters are designed for different motion modes, and a modal probability weighted fusion mechanism enables smooth switching of the control strategy, avoiding the performance degradation problem of traditional single controllers under changing operating conditions, thereby improving the accuracy of motor drive direction correction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120963399B_ABST
    Figure CN120963399B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of motor driving, and discloses a motor driving direction correction method and device based on encoder feedback, which comprises the following steps: collecting first angle data of a first driving wheel and second angle data of a second driving wheel respectively; calculating a direction deviation feature vector based on the first angle data and the second angle data, and performing time-varying dynamic mode decomposition on the direction deviation feature vector to obtain a motion mode feature; determining a motion mode identifier according to the motion mode feature and selecting a corresponding local controller to calculate a target control quantity; and converting the target control quantity into a direction correction signal of a motor driver. The application can accurately identify different motion modes such as straight running steady state, regular turning, climbing and heavy load, and emergency turning and obstacle avoidance, quantifies the dynamic influence relationship between the two driving wheels, avoids the performance deterioration problem of a traditional single controller when the working condition changes, and further improves the accuracy of motor driving direction correction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of motor drive technology, and in particular to a method and apparatus for correcting motor drive direction based on encoder feedback. Background Technology

[0002] Traditional two-wheeled self-balancing vehicles mainly rely on gyroscopes and accelerometers for attitude control. However, under complex road conditions, factors such as uneven road surfaces, load changes, and driving on slopes can cause coupling effects and nonlinear dynamic characteristics changes between the left and right drive wheels, resulting in a decrease in directional control performance. When the target vehicle switches between different motion modes such as straight driving, turning, climbing, and carrying loads, the dynamic coupling relationship between the left and right wheels changes. The fixed parameter controller cannot adjust the control strategy in real time, resulting in the accumulation of directional deviation and insufficient control accuracy. Summary of the Invention

[0003] This invention provides a method and device for motor drive direction correction based on encoder feedback. This invention can accurately identify different motion modes such as straight steady state, normal turning, uphill loading and obstacle avoidance, and quantify the dynamic influence relationship between the two drive wheels, avoiding the performance degradation problem of traditional single controller when the working conditions change, thereby improving the accuracy of motor drive direction correction.

[0004] In a first aspect, the present invention provides a motor drive direction correction method based on encoder feedback, the motor drive direction correction method based on encoder feedback comprising: Collect the first angle data of the first drive wheel and the second angle data of the second drive wheel respectively; Based on the first angle data and the second angle data, a direction deviation feature vector is calculated, and the direction deviation feature vector is decomposed into a time-varying dynamic mode to obtain motion mode features. Based on the motion pattern characteristics, determine the motion pattern identifier and select the corresponding local controller to calculate the target control quantity; The target control quantity is converted into a direction correction signal for the motor driver.

[0005] In conjunction with the first aspect, in a first implementation of the first aspect of the present invention, the step of respectively collecting the first angle data of the first drive wheel and the second angle data of the second drive wheel includes: The first encoder pulse signal of the first drive wheel and the second encoder pulse signal of the second drive wheel are collected respectively. A first Kalman filter is established based on the first encoder pulse signal, and a second Kalman filter is established based on the second encoder pulse signal. The process noise covariance matrix in the first Kalman filter is adjusted based on the first encoder pulse signal to obtain the first covariance parameter; The process noise covariance matrix in the second Kalman filter is adjusted according to the second encoder pulse signal to obtain the second covariance parameter; The first encoder pulse signal is input into a first Kalman filter configured with the first covariance parameter for noise reduction processing, and the first angle data is obtained by pulse counting conversion. The second encoder pulse signal is input into a second Kalman filter configured with the second covariance parameter for noise reduction processing, and the second angle data is obtained by pulse counting conversion.

[0006] In conjunction with the first aspect, in a second implementation of the first aspect of the present invention, the step of inputting the first encoder pulse signal into a first Kalman filter configured with the first covariance parameter for noise reduction processing and obtaining the first angle data through pulse counting conversion includes: A first state vector is established based on the first encoder pulse signal, and a first state transition matrix and a first observation matrix are constructed according to the sampling period; The first state vector is input into the state equation of the first Kalman filter for prediction calculation, and the prediction error covariance matrix is ​​updated in combination with the first covariance parameter to obtain the first predicted state vector and the first prediction covariance matrix. Based on the observed values ​​of the first encoder pulse signal, the first predicted state vector is calculated using Kalman gain and the state is corrected to obtain the first filtered state vector. The angular position component is extracted from the first filtered state vector and converted by pulse counting using the encoder resolution to obtain the first angle data.

[0007] In conjunction with the first aspect, in a third implementation of the first aspect of the present invention, the step of calculating a direction deviation feature vector based on the first angle data and the second angle data, and performing time-varying dynamic mode decomposition on the direction deviation feature vector to obtain motion mode features, includes: Calculate the first angle increment of the first angle data at the current time compared to the previous time, and simultaneously calculate the second angle increment of the second angle data at the current time compared to the previous time; The difference between the first angle increment and the second angle increment is calculated to obtain the encoder increment difference. An encoder input vector is constructed based on the first angle data and the second angle data, and a nonlinear feature transformation is performed on the encoder input vector to obtain the directional dynamic component. The real-time direction deviation angle is calculated based on the encoder incremental difference, and then combined with the angular velocity component and angular acceleration component in the direction dynamic component to obtain the direction deviation feature vector. The directional deviation feature vector is subjected to time-varying dynamic mode decomposition, and motion mode features are extracted.

[0008] In conjunction with the first aspect, in the fourth implementation of the first aspect of the present invention, the step of calculating the real-time direction deviation angle based on the encoder incremental difference and combining it with the angular velocity component and the angular acceleration component in the direction dynamic component to obtain the direction deviation feature vector includes: Based on the encoder incremental difference, the numerator and denominator of the arctangent function are constructed, and a zero-prevention parameter is introduced to protect the denominator, thus obtaining the arctangent calculation parameters. The arctangent calculation parameters are input into the arctangent function and converted to units using a conversion coefficient from radians to angles to obtain the real-time direction deviation angle. The corresponding angular velocity component and angular acceleration component are extracted from the directional dynamic component, and the real-time directional deviation angle is combined with the angular velocity component and the angular acceleration component to obtain the directional deviation feature vector.

[0009] In conjunction with the first aspect, in a fifth implementation of the first aspect of the present invention, the step of performing time-varying dynamic pattern decomposition on the direction deviation feature vector and extracting motion pattern features includes: An augmented Hankel matrix is ​​constructed based on the directional deviation feature vector and the first and second angle data. Singular value decomposition is performed on the augmented Hankel matrix to obtain the left singular matrix, the singular value matrix, and the right singular matrix; The system mode matrix is ​​constructed based on the left singular matrix, and the corresponding modal feature set is calculated by constructing a state transition operator; Motion states are classified based on the feature amplitude of each modal feature value in the modal feature set. Features with feature amplitude less than a first threshold are classified as straight steady-state modes, features with feature amplitude between the first and second thresholds are classified as regular turning modes, features with feature amplitude between the second and third thresholds are classified as climbing load modes, and features with feature amplitude greater than the third threshold are classified as sharp turn obstacle avoidance modes, thus obtaining motion mode features.

[0010] In conjunction with the first aspect, in a sixth implementation of the first aspect of the present invention, the step of determining the motion mode identifier based on the motion mode characteristics and selecting the corresponding local controller to calculate the target control quantity includes: Based on the motion pattern characteristics, the causal influence of the first drive wheel on the second drive wheel and the causal influence of the second drive wheel on the first drive wheel are calculated to obtain a time-varying causal matrix; The modal probability vectors, including straight steady state, normal turning, uphill load, and sharp turn obstacle avoidance, are calculated based on the time-varying causal matrix. The motion mode identifier is determined based on the maximum probability value in the modal probability vector, and a local controller and controller parameter combination corresponding to the motion mode identifier are selected from a preset local controller library. The current direction error is input to the selected local controller configured with the controller parameter combination to perform control calculations, obtain the initial control quantity, and then the initial control quantity is weighted and fused with the modal probability vector to obtain the target control quantity.

[0011] In conjunction with the first aspect, in the seventh implementation of the first aspect of the present invention, the step of performing control calculations on a selected local controller that configures the controller parameter combination with the current direction error input to obtain an initial control quantity, and then weighting and fusing the initial control quantity with the modal probability vector to obtain a target control quantity, includes: The current direction error is calculated based on the reference direction input and the direction angle component in the direction deviation feature vector; The current direction error is input into the selected local controller configured with the controller parameter combination to perform proportional control, integral control and derivative control calculations to obtain the basic control parameters; The gain of the integral and derivative components in the basic control parameters is adjusted according to the motion mode identifier to obtain the initial control quantity; The initial control quantity is calculated by probability weighting based on the modal probability values ​​in the modal probability vector to obtain the target control quantity.

[0012] In conjunction with the first aspect, in an eighth implementation of the first aspect of the present invention, the step of converting the target control quantity into a direction correction signal for a motor driver includes: Construct a time-varying sliding surface function based on the current direction error and the rate of change of the direction error; The equivalent control component, switching control component, and adaptive control component are calculated based on the time-varying sliding surface function, respectively. The target control quantity is superimposed with the equivalent control component, the switching control component, and the adaptive control component to obtain the target control signal; The target control signal is input into a space vector pulse width modulator to synthesize three-phase voltage and generate PWM waveform. The switching frequency and dead time parameters are set and output to the motor drivers of the first and second drive wheels to obtain the direction correction signal.

[0013] Secondly, the present invention provides a motor drive direction correction device based on encoder feedback, the motor drive direction correction device based on encoder feedback comprising: The acquisition module is used to acquire the first angle data of the first drive wheel and the second angle data of the second drive wheel, respectively. The decomposition module is used to calculate the direction deviation feature vector based on the first angle data and the second angle data, and to perform time-varying dynamic mode decomposition on the direction deviation feature vector to obtain motion mode features. The calculation module is used to determine the motion mode identifier based on the motion mode characteristics and select the corresponding local controller to calculate the target control quantity; The conversion module is used to convert the target control quantity into a direction correction signal for the motor driver.

[0014] The technical solution provided by this invention employs an adaptive Kalman filter instead of the traditional fixed-parameter filtering method. This allows for dynamic adjustment of the process noise covariance matrix based on the real-time signal-to-noise ratio of the encoder signal. Even under complex environments such as vibration and bumps, high-quality angle data can be obtained, extracting complete dynamic features including direction angle, angular velocity, and angular acceleration. Real-time modal analysis of the direction deviation features accurately identifies different motion modes such as straight-line steady state, regular turning, uphill loading, and sharp-turn obstacle avoidance. It quantifies the dynamic influence relationship between the left and right drive wheels, offering higher recognition accuracy and anti-interference capability compared to simple threshold judgment methods, ensuring smooth and accurate mode switching. Dedicated control parameters are designed for different motion modes, and a modal probability weighted fusion mechanism enables smooth switching of the control strategy, avoiding the performance degradation problem of traditional single controllers under changing operating conditions, thereby improving the accuracy of motor drive direction correction. Attached Figure Description

[0015] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0016] Figure 1 This is a schematic diagram of the steps of the motor drive direction correction method based on encoder feedback in an embodiment of the present invention; Figure 2 This is a schematic diagram of the motor drive direction correction device based on encoder feedback in an embodiment of the present invention. Detailed Implementation

[0017] This invention provides a method and apparatus for correcting motor drive direction based on encoder feedback. The terms "first," "second," "third," "fourth," etc. (if present) in the specification, claims, and accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in a sequence other than that illustrated or described herein. Furthermore, the terms "comprising" or "having" and any variations thereof are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0018] For ease of understanding, the specific process of the embodiments of the present invention is described below. Please refer to [link / reference]. Figure 1 One embodiment of the motor drive direction correction method based on encoder feedback in this invention includes: Step S11: Collect the first angle data of the first drive wheel and the second angle data of the second drive wheel respectively; Specifically, incremental photoelectric encoders deployed on the two drive wheels acquire the first encoder pulse signal of the first drive wheel and the second encoder pulse signal of the second drive wheel, respectively, and independent data acquisition channels are constructed to avoid crosstalk and data loss. Kalman filter models are established for the first and second drive wheels respectively to perform dynamic state estimation and noise reduction processing on the encoder pulse signals corresponding to the drive wheels. The internal structure of the filter includes core modules such as state prediction, observation update, covariance estimation, and error feedback. A joint estimation model for position and speed is established to simultaneously reflect the changing trends of encoder angle and speed. Due to factors such as disturbances, slippage, or load changes in the motor's operating environment, the noise level in the encoder signal exhibits dynamic characteristics. Therefore, based on the real-time acquired first encoder pulse signal, the process noise covariance matrix in the first Kalman filter is adaptively adjusted to generate a first covariance parameter adapted to the current operating condition, enhancing the filter's response capability to abnormal operating conditions. Based on the second encoder pulse signal, the process noise covariance matrix of the second Kalman filter is adjusted to generate a second covariance parameter, making the filtering strategy for the left and right wheel encoder signals targeted and differentiated. The first encoder pulse signal is input into the first Kalman filter configured with the first covariance parameter for dynamic filtering. The first angle data is converted and analyzed by combining the state estimation result output by the filter with the encoder resolution parameter and the pulse number conversion rule. At the same time, the second encoder pulse signal is input into the second Kalman filter configured with the second covariance parameter to obtain the denoised state variable and complete the angle calculation, and output the second angle data.

[0019] Step S12: Calculate the direction deviation feature vector based on the first angle data and the second angle data, and perform time-varying dynamic mode decomposition on the direction deviation feature vector to obtain motion mode features; Specifically, during real-time operation, time-series processing is performed on the first and second angle data. Within each control cycle, the first angle value at the current moment and the value at the previous moment are extracted synchronously, and their change is calculated to obtain the first angle increment. Simultaneously, the increment of the second angle data is calculated in the same way to obtain the second angle increment. The difference between the two angle increments is calculated to obtain the encoder increment difference, reflecting the inconsistency in the rotation of the two wheels and initially revealing the system's directional deviation trend. A multi-dimensional encoder input vector is constructed based on the first and second angle data at the current moment. This multi-dimensional encoder input vector is then input into a pre-trained nonlinear mapping model. The nonlinear mapping model is a neural network structure or a transformation function with an embedded nonlinear activation function, used to extract directional dynamic components including angular velocity and angular acceleration, thereby fully restoring the continuous change characteristics of the motion trajectory in the time domain. Based on the obtained encoder increment difference, a scaling parameter and a safety compensation factor are introduced to calculate the directional deviation angle at the current moment. The directional deviation angle is then combined with the directional angular velocity and angular acceleration components obtained from the nonlinear mapping according to a unified data structure to construct a directional deviation feature vector. The direction deviation feature vectors at several consecutive time points are aggregated using a sliding window approach, and a time-varying dynamic mode decomposition algorithm is used to extract the mode of the direction deviation feature vectors. By performing singular value decomposition and feature vector projection operations within each window, the dominant motion mode features under the current working condition are extracted, including steady-state straight driving, regular turning, loaded uphill or sharp turn obstacle avoidance, etc. The output mode vectors and corresponding feature values ​​constitute the motion mode features.

[0020] Step S13: Determine the motion mode identifier based on the motion mode characteristics and select the corresponding local controller to calculate the target control quantity; Specifically, causal relationship analysis is performed on motion mode characteristics. This includes constructing a vector autoregressive model based on the historical sequence of the direction deviation feature vector and the encoder angle data sequence to calculate the causal influence of the first drive wheel on the second drive wheel and the second drive wheel on the first drive wheel. These two models are then combined to form a time-varying causal description matrix, reflecting the dynamic coupling state and interaction strength between different drive units in the current system. Using the time-varying causal matrix as input, and combining it with the established modal probability prior distribution model, the posterior probability of the system's current state under four typical motion modes is calculated. These correspond to four motion modes: straight steady state, normal turning, climbing with load, and sharp turn obstacle avoidance, forming a modal probability vector containing four components. The modal type corresponding to the current highest probability component is extracted from the modal probability vector as the motion mode identifier. This identifier is then used as an index to retrieve the corresponding local controller instance from a pre-set local controller library. Simultaneously, the control parameter combination matched to the local controller is loaded, including key control coefficients such as proportional gain, integral gain, derivative gain, feedforward compensation coefficient, and filter time constant. The current direction error is input into the selected local controller for control quantity calculation, and the initial control quantity is obtained as the basic control output under this mode. Considering that mode recognition itself has a certain degree of uncertainty, a weighted fusion calculation is performed on the initial control quantities of all controllers based on the mode probability vector, where the weights are jointly determined by the mode probability and the controller adaptation factor, and the target control quantity is output.

[0021] Step S14: Convert the target control quantity into a direction correction signal for the motor driver.

[0022] Specifically, based on the current direction error and its rate of change, a time-varying sliding surface function is constructed. This function includes the magnitude of the error itself and incorporates the error's trend and integral history, effectively characterizing the dynamic behavior of the current system deviating from the target state. Based on this time-varying sliding surface function, three independent but collaboratively compensating control components are decomposed. The equivalent control component is used for feedforward compensation of the ideal system model, ensuring basic control requirements are met. The switching control component adjusts the sign based on the amplitude and direction of the sliding surface, providing robust suppression of system uncertainties and external disturbances. The adaptive control component responds in real-time to unmodeled dynamic behavior through an online adjustment mechanism, enhancing overall control performance and robustness. These three control components are then superimposed with the target control quantity to output the target control signal. This target control signal is input to a space vector pulse width modulator (SVM), where the target voltage in the three-phase stationary coordinate system is synthesized in a two-dimensional plane using space vector projection. Combined with the set switching frequency and dead-time parameters, a PWM waveform sequence is generated. The three-phase PWM signals are transmitted to the brushless motor drivers corresponding to the first and second drive wheels according to a predetermined modulation period, thereby adjusting the torque of the left and right wheel motors. The actual current and torque changes driven by the three-phase PWM signals constitute the direction correction signal.

[0023] In one specific embodiment, the process of performing step S11 may specifically include the following steps: The first encoder pulse signal of the first drive wheel and the second encoder pulse signal of the second drive wheel are collected respectively. A first Kalman filter is established based on the pulse signal of the first encoder, and a second Kalman filter is established based on the pulse signal of the second encoder. The process noise covariance matrix in the first Kalman filter is adjusted based on the pulse signal of the first encoder to obtain the first covariance parameter; The process noise covariance matrix in the second Kalman filter is adjusted based on the pulse signal from the second encoder to obtain the second covariance parameter; The first encoder pulse signal is input into a first Kalman filter configured with a first covariance parameter for noise reduction processing, and the first angle data is obtained by pulse counting conversion. The second encoder pulse signal is input into the second Kalman filter configured with the second covariance parameter for noise reduction processing, and the second angle data is obtained by pulse counting conversion.

[0024] Specifically, incremental photoelectric encoders are configured on both drive wheels to capture pulse signals generated by the photoelectric code disk during motor rotation. The pulse signals are square wave sequences uniformly distributed with the rotation angle, possessing high time resolution and stable signal frequency, serving as raw input data reflecting the rotational state of the gear train. Through a dual-channel pulse acquisition interface, the first encoder pulse signal generated by the first drive wheel and the second encoder pulse signal generated by the second drive wheel are sampled in real time, with the sampling frequency set to above 1 kHz. After acquisition, the number of pulses in each time period is used as input to construct a first Kalman filter and a second Kalman filter for state estimation. Each filter includes two stages: prediction and correction. The state variables are designed to include angular position and angular velocity components, and are equipped with process and observation models to achieve dynamic denoising and high-precision recovery of the encoder signals. During filter initialization, basic parameters such as the initial covariance matrix, state transition model, and measurement matrix are set. An adaptive process noise adjustment mechanism is introduced for each encoder signal. Specifically, within each update cycle, the process noise covariance matrix in the first Kalman filter is corrected online based on the amplitude and mean drift of the first encoder pulse signal, generating a first covariance parameter reflecting the current disturbance intensity. This dynamically adjusts the filter's prediction confidence and measurement dependence. Similarly, equivalent processing logic is applied to the second encoder pulse signal, adjusting the process noise covariance of the second Kalman filter based on its fluctuations and abrupt changes, generating a second covariance parameter. This enables separate modeling and fine filtering of the dual-wheel input signals under different noise environments. After the covariance parameter is updated, the real-time received first encoder pulse signal is input to the first Kalman filter configured with the first covariance parameter. After state prediction and measurement update steps, the estimated first angular position at the current moment is output. Simultaneously, to accommodate the angle expression required by the control module, a pulse counting conversion is performed on the filter's output internal variables, multiplying the angle value corresponding to each unit pulse by the cumulative pulse count to convert it into standard first angle data. Simultaneously, the second encoder pulse signal is input to the second Kalman filter configured with the second covariance parameter. After state fusion is completed, the real-time angle estimate corresponding to the second drive wheel is output, and the second angle data is generated by the pulse conversion method.

[0025] In one specific embodiment, the process of performing noise reduction processing on the first encoder pulse signal input to a first Kalman filter configured with a first covariance parameter and obtaining the first angle data through pulse counting conversion can specifically include the following steps: A first state vector is established based on the pulse signal of the first encoder, and a first state transition matrix and a first observation matrix are constructed according to the sampling period; The first state vector is input into the state equation of the first Kalman filter for prediction calculation, and the prediction error covariance matrix is ​​updated in combination with the first covariance parameter to obtain the first predicted state vector and the first prediction covariance matrix. Based on the observed values ​​of the first encoder pulse signal, the Kalman gain of the first predicted state vector is calculated and the state is corrected to obtain the first filtered state vector. The angular position component is extracted from the first filtered state vector and converted by pulse counting using the encoder resolution to obtain the first angle data.

[0026] Specifically, using the first encoder pulse signal as input, a first state vector containing two physical quantities, angular position and angular velocity, is established. This first state vector is composed of the angle at the current time step and the velocity at the previous time step. Based on a preset fixed sampling period, a first state transition matrix is ​​derived. This first state transition matrix defines the physical laws governing the system's evolution from one moment to the next, containing a combination of a unit increment factor and the sampling period length, used to describe the dynamic characteristics of the angular position derived from the velocity integral. Simultaneously, a first observation matrix is ​​constructed to describe the mapping relationship between the actual encoder pulse observations and the state vector. Its structure determines how the filter correlates the observed signal with the system's internal state variables. The first state vector is input into the state prediction equation of the first Kalman filter, and the prediction calculation process is executed. The prediction operation is based on the state estimation result at the previous moment, undergoing a forward evolution through the state transition matrix to output the first predicted state vector at the current moment. During the prediction process, the prediction error covariance matrix is ​​updated simultaneously with the first covariance parameter, resulting in the first prediction covariance matrix, which characterizes the uncertainty level of the current predicted state. Its value directly affects the filter's response sensitivity to new observation data. The observed value of the first encoder pulse signal at the current moment is used as input and compared with the first predicted state vector. The Kalman gain at the current moment is calculated. The Kalman gain factor is used to weight the predicted and observed values, so that the final state correction result considers both the model prediction trend and can quickly respond to new changes in the observed data. After obtaining the Kalman gain, a state correction operation is performed on the first predicted state vector. The observed residual and the prediction result are fused in a gain-weighted manner to generate the first filtered state vector at the current moment. The component representing the motor angular position is extracted from the first filtered state vector as the object of subsequent processing. Combined with the encoder resolution parameter, i.e., the number of pulses per revolution, the physical value corresponding to the angular position component is converted with the current cumulative total number of pulses, thereby completing the pulse counting conversion process and generating the first angle data of the first drive wheel at the current moment.

[0027] Specifically, the second encoder pulse signal is input into a second Kalman filter configured with a second covariance parameter for noise reduction processing, and the second angle data is obtained through pulse counting conversion, including: A second state vector is established based on the pulse signal of the second encoder, and a second state transition matrix and a second observation matrix are constructed according to the sampling period; The second state vector is input into the state equation of the second Kalman filter for prediction calculation, and the prediction error covariance matrix is ​​updated in combination with the second covariance parameter to obtain the second predicted state vector and the second prediction covariance matrix. Based on the observed values ​​of the second encoder pulse signal, the Kalman gain of the second predicted state vector is calculated and the state is corrected to obtain the second filtered state vector. The angular position component is extracted from the second filtered state vector and converted by pulse counting using the encoder resolution to obtain the second angle data.

[0028] In one specific embodiment, the process of performing step S12 may specifically include the following steps: Calculate the first angle increment of the first angle data at the current time compared to the previous time, and simultaneously calculate the second angle increment of the second angle data at the current time compared to the previous time; The difference between the first angle increment and the second angle increment is calculated to obtain the encoder increment difference. The encoder input vector is constructed based on the first angle data and the second angle data, and the nonlinear feature transformation is performed on the encoder input vector to obtain the directional dynamic component. The real-time orientation deviation angle is calculated based on the encoder incremental difference, and then combined with the angular velocity and angular acceleration components in the orientation dynamic component to obtain the orientation deviation feature vector. The direction deviation feature vector is decomposed into time-varying dynamic patterns, and motion pattern features are extracted.

[0029] Specifically, angle data for the first and second drive wheels are extracted at two consecutive sampling times. The first angle data reflects the rotational position of the left wheel at the current time point, while the second angle data corresponds to the synchronization state of the right wheel. By calculating the difference between the angle values ​​at the current time and the previous time point, the first angle increment and the second angle increment are obtained, representing the actual rotational angle changes of the two wheels within one sampling period. The difference between the first and second angle increments is calculated to determine the deviation between the two wheel increments, resulting in the encoder increment difference, which reflects the synchronization deviation of the left and right wheels caused by uneven drive or external disturbances within the current control period. The first and second angle data from the current time point and the two previous time points are combined to generate an encoder input vector containing information from multiple time points. This encoder input vector arranges the original angle data in a time series format, reflecting the rotational history characteristics of the system within a short time window. The encoder input vector is input into the deployed nonlinear feature mapping model, which employs a three-layer feedforward neural network structure with activation functions. This model extracts dynamic features related to direction changes through a nonlinear transformation process, including higher-order derivative information such as angular velocity and angular acceleration, to obtain the directional dynamic components. The real-time direction deviation angle is calculated based on the encoder incremental difference. The direction deviation angle value is converted using a proportional mapping function to maintain numerical scale consistency. The obtained direction deviation angle is used to quantify the degree to which the two wheels deviate from the ideal synchronization state within this control cycle. The direction deviation angle is then combined with the angular velocity and angular acceleration components extracted from the nonlinear feature transformation to construct the direction deviation feature vector. The directional deviation feature vector is subjected to time-varying dynamic mode decomposition. The feature vectors at several consecutive time points are integrated and processed in a sliding window manner, and the time-varying dynamic mode decomposition algorithm is executed. By performing operations such as singular value decomposition, state reconstruction and mode extraction in the time dimension, the input feature vector is mapped to a low-dimensional modal space, the dominant motion modal features are extracted, and the typical motion modes of the current system, such as steady-state straight driving, normal turning, climbing with load or sharp turning and obstacle avoidance, are identified. The transient behavior during the mode switching process is modeled and decomposed. The output motion mode features include structural information such as modal vectors, eigenvalue matrices and reconstruction errors.

[0030] In one specific embodiment, the process of calculating the real-time orientation deviation angle based on the encoder incremental difference and combining it with the angular velocity and angular acceleration components in the orientation dynamic components to obtain the orientation deviation feature vector can specifically include the following steps: The numerator and denominator of the arctangent function are constructed based on the encoder incremental difference, and the denominator is protected by introducing a zero-prevention parameter to obtain the arctangent calculation parameters. Input the arctangent calculation parameters into the arctangent function and convert the units using the radian-to-angle conversion coefficient to obtain the real-time direction deviation angle; The corresponding angular velocity and angular acceleration components are extracted from the directional dynamic components. The real-time directional deviation angle is combined with the angular velocity and angular acceleration components to obtain the directional deviation feature vector.

[0031] Specifically, the first and second angle data between the previous and current control cycles are differentially processed to calculate the first and second angle increments, corresponding to the angle changes of the left and right wheels within one sampling cycle, respectively. A difference and summation operation is performed on the two incremental signals. The difference constitutes the numerator of the arctangent function, representing the relative inconsistency in the rotation of the two wheels within the current cycle. The sum constitutes the denominator, representing the sum or average degree of change in the angles of the two wheels, reflecting the overall rotation trend. In actual calculations, certain special operating scenarios exist, such as boundary situations where the angle changes of the two wheels are extremely close or the rotational change amplitude is extremely small, causing the denominator to approach zero, leading to division by zero errors or numerical instability. Therefore, a zero-division protection parameter is introduced. This parameter is a preset, extremely small positive number. Adding the zero-division protection parameter to the denominator forms a protective structure, ensuring that the denominator is always non-zero, thus constructing a safe and calculable arctangent function input parameter. The ratio of the numerator to the denominator (including zero-counting processing) is passed as a parameter to the arctangent function. Through the arctangent function's bilateral nonlinear mapping capability, the directional offset angle corresponding to the dual-wheel rotation deviation within the current sampling period is obtained. The angle value is expressed in radians. Multiplying the radian value by a radian-to-angle conversion factor completes the unit conversion, outputting the real-time directional offset angle in degrees, reflecting the system's attitude offset direction and magnitude at the current moment. Simultaneously, structural analysis is performed on the directional dynamic components, extracting the directional angular velocity and directional angular acceleration components to reflect the dynamic trend and dynamic response capability of directional changes, respectively characterizing the instantaneous rate and slope of directional change at the current moment. The angular velocity and angular acceleration components are combined and integrated with the real-time directional offset angle to construct a unified vector structure for the directional offset feature vector. The vector's three components—directional offset angle, angular velocity, and angular acceleration—correspond to the static error, dynamic response, and system inertial compensation requirements in directional control, respectively. These three components jointly describe the steady-state deviation, dynamic disturbance, and nonlinear inertial effects faced by the system during directional adjustment.

[0032] In one specific embodiment, the process of performing time-varying dynamic pattern decomposition on the direction deviation feature vector and extracting motion pattern features may specifically include the following steps: An augmented Hankel matrix is ​​constructed based on the directional deviation eigenvector and the first and second angle data. Singular value decomposition is performed on the augmented Hankel matrix to obtain the left singular matrix, the singular value matrix, and the right singular matrix; The system mode matrix is ​​constructed based on the left singular matrix, and the corresponding set of modal features is calculated by constructing a state transition operator; Motion states are classified based on the amplitude of the characteristic values ​​of each modal feature in the modal feature set. Specifically, the characteristic value amplitude is less than the first threshold and is classified as straight steady-state mode; the characteristic value amplitude is between the first and second thresholds and is classified as regular turning mode; the characteristic value amplitude is between the second and third thresholds and is classified as climbing load mode; and the characteristic value amplitude is greater than the third threshold and is classified as sharp turn obstacle avoidance mode. Thus, motion mode features are obtained.

[0033] Specifically, the directional deviation feature vectors calculated in the current control cycle and several preceding cycles, along with the corresponding first and second angle data, are organized chronologically into a sliding window sequence. A multi-dimensional state sample set is constructed based on the sequence's evolution trajectory in the time dimension. This multi-dimensional state sample set includes the directional deviation angle, directional angular velocity, directional angular acceleration, and the angle state data of the left and right wheels at each moment, forming a directional behavior feature set. The time-series samples are stacked using a Hankel structure, arranging the state vectors of consecutive time steps column-wise to construct an augmented Hankel matrix, capturing the continuous evolution characteristics of the system state in the time dimension. Singular value decomposition (SVD) is performed on the augmented Hankel matrix, decomposing it into a left singular matrix, a singular value matrix, and a right singular matrix. The left singular matrix contains the orthogonal basis vectors of the dominant dynamic modes in the state space, the singular value matrix provides a quantitative indicator of each mode's contribution to the overall system energy, and the right singular matrix describes the response degree to different modes at each time interval. Using the left singular matrix as input, a modal matrix representing the main dynamic characteristics of the current system is constructed. This modal matrix transforms the singular space projection into a physically meaningful modal structure, enabling low-dimensional modeling and structural classification of system behavior. A state transition operator construction process is introduced, and two forward-and-backward shifted data submatrices are constructed based on the sliding window structure of the time series in the augmented Hankel matrix. One represents the current state, and the other represents the successor state. By solving the least-squares mapping relationship between these two submatrices, the state transition operator is obtained, thus establishing a time-progressive model in the modal space. Based on the state transition model, feature analysis is performed on the modal matrix to calculate the corresponding modal feature set. Each modal feature vector and its corresponding modal feature value form a modal description pair. The magnitude of the modal feature value represents whether the mode exhibits decay, growth, or stability in the system, directly quantifying the stability and dynamic characteristics of the system behavior. To identify motion patterns, the amplitudes of all modal feature values ​​are uniformly normalized and then classified according to their amplitude range. Motion state mapping is implemented based on a set multi-level threshold structure. If the modal feature value amplitude is less than the first threshold, it indicates that the current mode is in a low dynamic response state and is classified as a straight steady-state mode. If the modal feature value amplitude is between the first and second thresholds, it indicates that the system has a certain directional change but the amplitude is controllable and is judged as a regular turning mode. If the modal feature value amplitude further increases and falls between the second and third thresholds, it indicates that the system is being subjected to external load disturbances or increased road resistance and belongs to the climbing load mode. If the modal feature value amplitude is greater than the third threshold, it indicates that the system exhibits obvious nonlinear response and has the characteristics of drastic directional change or obstacle avoidance, and is classified as a sharp turn obstacle avoidance mode.

[0034] In one specific embodiment, the process of performing step S13 may specifically include the following steps: The causal influence of the first drive wheel on the second drive wheel and the causal influence of the second drive wheel on the first drive wheel are calculated based on motion pattern characteristics to obtain a time-varying causal matrix; The modal probability vectors, including straight steady state, normal turning, uphill load, and sharp turn obstacle avoidance, are calculated based on the time-varying causal matrix. The motion mode identifier is determined based on the maximum probability value in the modal probability vector, and the local controller and controller parameter combination corresponding to the motion mode identifier are matched and selected from the preset local controller library. The current direction error is input into the selected local controller of the configuration controller parameter combination for control calculation to obtain the initial control quantity. The initial control quantity is then weighted and fused with the modal probability vector to obtain the target control quantity.

[0035] Specifically, a time series of bidirectional variables is constructed based on motion pattern characteristics and historical angle data of the left and right drive wheels. This time series is then modeled to capture the dynamic dependency between the two variables over time. A sliding window mechanism is used to extract the angle change sequences of the first and second drive wheels over a given period. A vector autoregression (VAR) model is then constructed based on historical data within the window. This allows for the quantification of the explanatory power of one variable in predicting another variable through joint modeling, without making prior assumptions about causality. The VAR model is used to calculate the prediction error changes under two scenarios: considering only its own historical data and considering both of the other's historical data. By comparing the variance of the prediction errors, the causal influence strength of the first drive wheel on the second drive wheel and vice versa is derived. These causal influence values ​​are combined to construct a two-dimensional time-varying causal matrix, reflecting the cooperative or restrictive relationship between the two wheels in the current drive system. Using the time-varying causal matrix as input, modal probability inference is performed in conjunction with a standard modal causal distribution model constructed during the training phase. Based on Bayesian inference, causal distribution parameters corresponding to four typical modes—straight-line steady state, normal turning, uphill loading, and sharp-turn obstacle avoidance—are introduced from the training set. These parameters include the mean vector and covariance matrix. The observation probabilities of the current time-varying causal matrix under these four modes are calculated using the Gaussian likelihood function. Combined with the prior distribution of modes obtained from historical data statistics, the posterior probability of each mode at the current moment is calculated using Bayes' theorem, forming a mode probability vector of length four. Each component in the mode probability vector represents the probability that the current state belongs to the corresponding mode, possessing clear physical meaning and control adaptation value. After obtaining the mode probability vector, the mode label corresponding to the maximum probability value is extracted as the motion mode identifier for the current moment. Based on the current motion mode identifier, a set of corresponding local controllers is retrieved and selected from a pre-set local controller library. The local controller structure is functionally divided according to the characteristics of the current mode, and its internal parameter configuration is optimized and adjusted for the dynamic response, disturbance characteristics, and inertia coefficient of the current mode. The parameters involved include proportional gain, integral gain, derivative gain, feedforward coefficient, and filtering time constant. The direction error value calculated by the real-time sensor at the current moment is input into the selected local controller. Based on the controller's structure and parameters, a control calculation process is executed to obtain the initial control quantity, representing the single control output of the optimal system response under the current modal conditions. A weighted fusion model of the control quantity is constructed based on the numerical values ​​of each modal component in the current modal probability vector. The weighted fusion model constructs a set of modal fusion control quantities by weighting and superimposing the control outputs corresponding to each controller according to their modal probabilities. An adaptation weight matrix is ​​introduced during fusion to adjust the contribution ratio of different controllers to different modal responses, thus constructing a target control quantity with modal sensing capability and multi-controller fusion capability.

[0036] In one specific embodiment, the process of performing control calculations on a selected local controller that inputs the current direction error into the configuration controller parameter combination to obtain an initial control quantity, and then weighting and fusing the initial control quantity with the modal probability vector to obtain the target control quantity, can specifically include the following steps: The current direction error is calculated based on the reference direction input and the direction angle component in the direction deviation feature vector; The current direction error is input into the selected local controller of the configuration controller parameter combination to perform proportional control, integral control and derivative control calculations to obtain the basic control parameters; The gain of the integral and derivative components in the basic control parameters is adjusted according to the motion mode identifier to obtain the initial control quantity; The target control quantity is obtained by performing probability weighting calculation on the initial control quantity based on the modal probability values ​​in the modal probability vector.

[0037] Specifically, the desired direction signal is acquired in each sampling period to represent the ideal attitude angle that the vehicle or robot should maintain at the current moment. Simultaneously, the angular component in the direction deviation feature vector is used to represent the actual direction state obtained after filtering and dynamic feature fusion. A difference operation is performed on the desired direction signal and the angular component, comparing the reference direction with the actual direction angle to obtain the direction error at the current moment. This direction error is input into a preset and optimized local controller. The local controller selects and loads a set of controller parameter combinations based on the current motion mode. Its internal structure includes three parts: a proportional element, an integral element, and a derivative element. In the proportional element, the direction error is directly amplified into a proportional control quantity to provide rapid response capability. In the integral element, the direction error is accumulated over time to eliminate system offset or static errors that occur during long-term operation. In the derivative element, the rate of change of the error over time is calculated to predict future trends, providing advance compensation for the control output. After these three calculations, the controller generates a set of basic control parameters, composed of proportional, integral, and derivative components, representing the ideal control output without considering complex external environmental changes. Considering the varying sensitivity of the motor drive system to error response under different motion modes, the integral and derivative components of the basic control parameters are adjusted based on the motion mode identifier. In straight-line steady-state mode, the focus is on eliminating long-term small deviations, enhancing the integral gain to ensure directional stability. In normal turning mode, the emphasis is on sensitive response to dynamic changes, with a moderate increase in the derivative component gain to maintain control smoothness during rapid directional changes. In climbing and load-bearing mode, external disturbances and inertial effects are significant, requiring a balance between steady-state and dynamic performance, necessitating a balance adjustment between the integral and derivative components. In sharp-turn obstacle avoidance mode, high-speed response and anti-interference capabilities are emphasized, increasing the weight of the derivative component while limiting the cumulative effect of the integral component to prevent control lag under abrupt operations. An initial control quantity is obtained through a mode-based differentiated adjustment mechanism. The initial control quantity is calculated using probability weighting based on the modal probability values ​​in the modal probability vector; that is, a weighted control quantity is calculated for each possible motion mode, and weights are assigned according to the probability values. All weighted results are then superimposed to obtain the target control quantity.

[0038] In one specific embodiment, the process of performing step S14 may specifically include the following steps: Construct a time-varying sliding surface function based on the current direction error and the rate of change of the direction error; The equivalent control components, switching control components, and adaptive control components are calculated based on the time-varying sliding surface function. The target control signal is obtained by superimposing the target control quantity with the equivalent control component, the switching control component, and the adaptive control component. The target control signal is input to the space vector pulse width modulator for three-phase voltage synthesis and PWM waveform generation. The switching frequency and dead time parameters are set and output to the motor drivers of the first and second drive wheels to obtain the direction correction signal.

[0039] Specifically, an adaptive sliding surface function is constructed based on the current directional error and its rate of change. This function includes a linear superposition of the error term and its derivative term as in the traditional form, and introduces a dynamic convergence factor that automatically adjusts based on the current error magnitude. This enhances the control system's response capability under different deviation magnitudes. When the error magnitude is large, the convergence factor in the sliding surface increases, accelerating the state's convergence towards the sliding surface. When the error is small, the convergence factor tends to stabilize, avoiding oscillations caused by over-adjustment. The constructed time-varying sliding surface function reflects the degree of deviation and its changing trend of the current system state in the directional space in real time. Based on the time-varying sliding surface function, equivalent control components, switching control components, and adaptive control components are calculated sequentially. The equivalent control component is used to compensate for the deterministic dynamics described in the ideal system model. Its calculation depends on known structural parameters of the system, such as the equivalent moment of inertia and damping coefficient of the motor, and is analytically solved in conjunction with the desired directional acceleration, the sliding surface convergence term, and the system load model. The goal is to guide the system state onto the sliding surface and maintain its sliding motion state. The switching control component is used to suppress uncertainties and external disturbances in the system. By introducing a boundary layer design based on the sign function of the sliding surface function, the high-frequency chattering problem caused by the traditional sign function is effectively avoided. A band-limited saturation function is used to smooth the control quantity, enhancing the system's robustness and extending the lifespan of the actuator. Simultaneously, to compensate for unmodeled dynamic and variable disturbances in the system, an adaptive control component is introduced. This adaptive control component is dynamically estimated based on the absolute value amplitude of the sliding surface and the disturbance suppression parameters are updated online through an adaptive law. This allows the controller to maintain good tracking performance and error convergence rate even in complex scenarios such as parameter changes and sudden load changes. The entire adaptive process prevents instability caused by excessive gain by limiting the maximum growth amplitude. The target control quantity is superimposed with the equivalent control component, the switching control component, and the adaptive control component to generate the target control signal for the current moment. The target control signal undergoes coordinate transformation and waveform modulation to meet the input requirements of the actual motor driver for the three-phase drive voltage. The target control signal is converted into a two-dimensional voltage vector in the α-β coordinate system. Based on the principle of space vector pulse width modulation, the two-dimensional voltage vector is projected onto the two nearest effective voltage vectors in the three-phase stationary coordinate system. The on-time ratio of each switch in one cycle of the PWM waveform is determined by time weighting, thereby achieving the approximate synthesis of the required space vector. Simultaneously, the switching frequency and dead time parameters are set. The switching frequency determines the resolution and modulation accuracy of the PWM waveform and is set at around 20kHz to ensure silent operation outside the audio range. The dead time is used to prevent short circuits caused by simultaneous conduction of the upper and lower bridge arms and is set at the level of a few microseconds.The generated three PWM control signals are output to the input terminals of the motor drivers corresponding to the first and second drive wheels, respectively. The drivers adjust the voltage of each phase according to the PWM duty cycle to achieve precise energization control of the motor windings.

[0040] The encoder-feedback-based motor drive direction correction method in the embodiments of the present invention has been described above. The encoder-feedback-based motor drive direction correction device in the embodiments of the present invention is described below. Please refer to [link / reference]. Figure 2 One embodiment of the motor drive direction correction device based on encoder feedback in this invention includes: The acquisition module 21 is used to acquire the first angle data of the first drive wheel and the second angle data of the second drive wheel respectively. The decomposition module 22 is used to calculate the direction deviation feature vector based on the first angle data and the second angle data, and to perform time-varying dynamic mode decomposition on the direction deviation feature vector to obtain motion mode features. Calculation module 23 is used to determine the motion mode identifier based on the motion mode characteristics and select the corresponding local controller to calculate the target control quantity; The conversion module 24 is used to convert the target control quantity into a direction correction signal for the motor driver.

[0041] Through the collaborative efforts of the aforementioned components, an adaptive Kalman filter is used instead of the traditional fixed-parameter filtering method. This allows for dynamic adjustment of the process noise covariance matrix based on the real-time signal-to-noise ratio of the encoder signal. High-quality angle data can be obtained even in complex environments such as vibration and bumps. Complete dynamic features, including direction angle, angular velocity, and angular acceleration, are extracted, and real-time modal analysis of directional deviation characteristics is performed. This accurately identifies different motion modes such as straight-line steady-state, regular turning, uphill loading, and sharp-turn obstacle avoidance, quantifying the dynamic influence relationship between the left and right drive wheels. Compared to simple threshold judgment methods, this approach offers higher recognition accuracy and anti-interference capabilities, ensuring smooth and accurate mode switching. Dedicated control parameters are designed for different motion modes, and a modal probability weighted fusion mechanism enables smooth switching of control strategies, avoiding the performance degradation problem of traditional single controllers under changing operating conditions, thereby improving the accuracy of motor drive direction correction.

[0042] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0043] If the integrated 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, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part 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 the present invention. 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.

[0044] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention 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 the present invention.

Claims

1. A method for correcting the direction of motor drive based on encoder feedback, characterized in that, include: The process involves collecting first angle data from the first drive wheel and second angle data from the second drive wheel, respectively. Specifically, this includes: collecting first encoder pulse signals from the first drive wheel and second encoder pulse signals from the second drive wheel; establishing a first Kalman filter based on the first encoder pulse signals and a second Kalman filter based on the second encoder pulse signals; adjusting the process noise covariance matrix in the first Kalman filter according to the first encoder pulse signals to obtain a first covariance parameter; adjusting the process noise covariance matrix in the second Kalman filter according to the second encoder pulse signals to obtain a second covariance parameter; establishing a first state vector based on the first encoder pulse signals, and constructing a second state vector based on the sampling period. A state transition matrix and a first observation matrix are defined. The first state vector is input into the state equation of the first Kalman filter for prediction calculation, and the prediction error covariance matrix is ​​updated in combination with the first covariance parameter to obtain a first predicted state vector and a first prediction covariance matrix. Based on the observed values ​​of the first encoder pulse signal, the first predicted state vector is subjected to Kalman gain calculation and state correction to obtain a first filtered state vector. The angular position component is extracted from the first filtered state vector and converted by pulse counting through the encoder resolution to obtain first angle data. The second encoder pulse signal is input into a second Kalman filter configured with the second covariance parameter for noise reduction processing and converted by pulse counting to obtain second angle data. Based on the first angle data and the second angle data, a direction deviation feature vector is calculated, and the direction deviation feature vector is decomposed into a time-varying dynamic mode to obtain motion mode features. Based on the motion pattern characteristics, determine the motion pattern identifier and select the corresponding local controller to calculate the target control quantity; The target control quantity is converted into a direction correction signal for the motor driver.

2. The motor drive direction correction method based on encoder feedback according to claim 1, characterized in that, The process involves calculating a direction deviation feature vector based on the first angle data and the second angle data, and then performing time-varying dynamic pattern decomposition on the direction deviation feature vector to obtain motion pattern features, including: Calculate the first angle increment of the first angle data at the current time compared to the previous time, and simultaneously calculate the second angle increment of the second angle data at the current time compared to the previous time; The difference between the first angle increment and the second angle increment is calculated to obtain the encoder increment difference. An encoder input vector is constructed based on the first angle data and the second angle data, and a nonlinear feature transformation is performed on the encoder input vector to obtain the directional dynamic component. The real-time direction deviation angle is calculated based on the encoder incremental difference, and then combined with the angular velocity component and angular acceleration component in the direction dynamic component to obtain the direction deviation feature vector. The directional deviation feature vector is subjected to time-varying dynamic mode decomposition, and motion mode features are extracted.

3. The motor drive direction correction method based on encoder feedback according to claim 2, characterized in that, The step of calculating the real-time orientation deviation angle based on the encoder incremental difference and combining it with the angular velocity and angular acceleration components in the orientation dynamic components to obtain the orientation deviation feature vector includes: Based on the encoder incremental difference, the numerator and denominator of the arctangent function are constructed, and a zero-prevention parameter is introduced to protect the denominator, thus obtaining the arctangent calculation parameters. The arctangent calculation parameters are input into the arctangent function and converted to units using a conversion coefficient from radians to angles to obtain the real-time direction deviation angle. The corresponding angular velocity component and angular acceleration component are extracted from the directional dynamic component, and the real-time directional deviation angle is combined with the angular velocity component and the angular acceleration component to obtain the directional deviation feature vector.

4. The motor drive direction correction method based on encoder feedback according to claim 3, characterized in that, The step of performing time-varying dynamic pattern decomposition on the direction deviation feature vector and extracting motion pattern features includes: An augmented Hankel matrix is ​​constructed based on the directional deviation feature vector and the first and second angle data. Singular value decomposition is performed on the augmented Hankel matrix to obtain the left singular matrix, the singular value matrix, and the right singular matrix; The system mode matrix is ​​constructed based on the left singular matrix, and the corresponding modal feature set is calculated by constructing a state transition operator; Motion states are classified based on the feature amplitude of each modal feature value in the modal feature set. Features with feature amplitude less than a first threshold are classified as straight steady-state modes, features with feature amplitude between the first and second thresholds are classified as regular turning modes, features with feature amplitude between the second and third thresholds are classified as climbing load modes, and features with feature amplitude greater than the third threshold are classified as sharp turn obstacle avoidance modes, thus obtaining motion mode features.

5. The motor drive direction correction method based on encoder feedback according to claim 4, characterized in that, The step of determining the motion mode identifier based on the motion mode characteristics and selecting the corresponding local controller to calculate the target control quantity includes: Based on the motion pattern characteristics, the causal influence of the first drive wheel on the second drive wheel and the causal influence of the second drive wheel on the first drive wheel are calculated to obtain a time-varying causal matrix; The modal probability vectors, including straight steady state, normal turning, uphill load, and sharp turn obstacle avoidance, are calculated based on the time-varying causal matrix. The motion mode identifier is determined based on the maximum probability value in the modal probability vector, and a local controller and controller parameter combination corresponding to the motion mode identifier are selected from a preset local controller library. The current direction error is input to the selected local controller configured with the controller parameter combination to perform control calculations, obtain the initial control quantity, and then the initial control quantity is weighted and fused with the modal probability vector to obtain the target control quantity.

6. The motor drive direction correction method based on encoder feedback according to claim 5, characterized in that, The process involves inputting the current direction error into a selected local controller configured with the controller parameter combination, performing control calculations to obtain an initial control quantity, and then weighting and fusing the initial control quantity with the modal probability vector to obtain the target control quantity, including: The current direction error is calculated based on the reference direction input and the direction angle component in the direction deviation feature vector; The current direction error is input into the selected local controller configured with the controller parameter combination to perform proportional control, integral control and derivative control calculations to obtain the basic control parameters; The gain of the integral and derivative components in the basic control parameters is adjusted according to the motion mode identifier to obtain the initial control quantity; The initial control quantity is calculated by probability weighting based on the modal probability values ​​in the modal probability vector to obtain the target control quantity.

7. The motor drive direction correction method based on encoder feedback according to claim 6, characterized in that, The step of converting the target control quantity into a direction correction signal for the motor driver includes: Construct a time-varying sliding surface function based on the current direction error and the rate of change of the direction error; The equivalent control component, switching control component, and adaptive control component are calculated based on the time-varying sliding surface function, respectively. The target control quantity is superimposed with the equivalent control component, the switching control component, and the adaptive control component to obtain the target control signal; The target control signal is input into a space vector pulse width modulator to synthesize three-phase voltage and generate PWM waveform. The switching frequency and dead time parameters are set and output to the motor drivers of the first and second drive wheels to obtain the direction correction signal.

8. A motor drive direction correction device based on encoder feedback, characterized in that, A method for performing motor drive direction correction based on encoder feedback as described in any one of claims 1-7, comprising: The acquisition module is used to acquire the first angle data of the first drive wheel and the second angle data of the second drive wheel, respectively. The decomposition module is used to calculate the direction deviation feature vector based on the first angle data and the second angle data, and to perform time-varying dynamic mode decomposition on the direction deviation feature vector to obtain motion mode features. The calculation module is used to determine the motion mode identifier based on the motion mode characteristics and select the corresponding local controller to calculate the target control quantity; The conversion module is used to convert the target control quantity into a direction correction signal for the motor driver.

Citation Information

Patent Citations

  • Cascade PID (Proportion Integration Differentiation)-based double-wheel balance car system

    CN120491679A

  • Vehicle control method and system, and vehicle

    WO2022183410A1