Motor driving direction correction method and device based on encoder feedback
By using an encoder-based motor drive direction correction method, and employing Kalman filters and dynamic mode decomposition technology, the problem of insufficient direction control accuracy of traditional controllers under complex road conditions is solved, achieving accurate correction and smooth switching of motor drive direction.
Patent Information
- Application Number
- CN202511329846.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-17
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2045-09-17
AI Technical Summary
Traditional two-wheeled self-balancing vehicles experience coupling effects and nonlinear dynamic characteristics between the left and right drive wheels under complex road conditions such as uneven road surfaces, load changes, and slope driving. This leads to a decline in directional control performance, and the fixed parameter controller cannot adjust the control strategy in real time, resulting in the accumulation of directional deviation and insufficient control accuracy.
An encoder-based motor drive direction correction method is adopted. By collecting the angle data of the drive wheels separately, noise reduction is performed using a Kalman filter, the direction deviation feature vector is calculated and time-varying dynamic mode decomposition is performed to identify different motion modes, select the corresponding local controller to calculate the target control quantity, and convert it into the direction correction signal of the motor driver.
It achieves real-time and accurate identification and correction of directional deviation in complex environments, improves the accuracy of motor drive directional correction, avoids the performance degradation of traditional single controllers when operating conditions change, and ensures the smoothness and accuracy of mode switching.
Smart Images

Figure CN120963399A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of motor driving, in particular to a motor driving direction correction method and device based on encoder feedback. BACKGROUND
[0002] Traditional two-wheeled balance vehicles mainly rely on gyroscopes and accelerometers for attitude control, but in complex road conditions, factors such as uneven road surfaces, changes in load, and slope driving can cause coupling effects and changes in nonlinear dynamics between the left and right drive wheels, resulting in a decline in direction control performance. When the target vehicle switches between different motion modes such as straight driving, turning, climbing, and load, the dynamic coupling relationship between the left and right wheels changes, and a fixed parameter controller cannot adjust the control strategy in real time, resulting in accumulated direction deviation and insufficient control accuracy. SUMMARY
[0003] The present application provides a motor driving direction correction method and device based on encoder feedback, which can accurately identify different motion modes such as straight driving, regular turning, climbing, and emergency turning obstacle avoidance, quantify the dynamic influence relationship between the two drive wheels, avoid the performance deterioration problem of traditional single controllers when the working condition changes, and thus improve the accuracy of motor driving direction correction.
[0004] In a first aspect, the present application provides a motor driving direction correction method based on encoder feedback, which comprises: collecting first angle data of a first drive wheel and second angle data of a second drive 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; converting the target control quantity into a direction correction signal of a motor driver.
[0005] In combination with the first aspect, in a first implementation manner of the first aspect of the present application, the collecting of the first angle data of the first drive wheel and the second angle data of the second drive wheel respectively comprises: collecting a first encoder pulse signal of the first drive wheel and a second encoder pulse signal of the second drive wheel respectively; establishing a first Kalman filter based on the first encoder pulse signal, and simultaneously establishing a second Kalman filter based on the second encoder pulse signal; adjusting a process noise covariance matrix in the first Kalman filter according to the first encoder pulse signal, to obtain a first covariance parameter; adjusting a process noise covariance matrix in the second Kalman filter according to the second encoder pulse signal, to obtain a second covariance parameter; inputting the first encoder pulse signal into the first Kalman filter configured with the first covariance parameter for noise reduction processing and pulse count conversion to obtain first angle data; inputting the second encoder pulse signal into the second Kalman filter configured with the second covariance parameter for noise reduction processing and pulse count conversion to obtain second angle data.
[0006] With reference to the first aspect, in a second implementation manner of the first aspect, the inputting the first encoder pulse signal into the first Kalman filter configured with the first covariance parameter for noise reduction processing and pulse count conversion to obtain first angle data comprises: establishing a first state vector based on the first encoder pulse signal, and constructing a first state transition matrix and a first observation matrix according to a sampling period; inputting the first state vector into a state equation of the first Kalman filter for prediction calculation, and updating a prediction error covariance matrix in combination with the first covariance parameter, to obtain a first predicted state vector and a first predicted covariance matrix; performing Kalman gain calculation and state correction on the first predicted state vector based on an observation value of the first encoder pulse signal, to obtain a first filtered state vector; extracting an angular position component from the first filtered state vector and performing pulse count conversion through an encoder resolution, to obtain first angle data.
[0007] With reference to the first aspect, in a third implementation manner of the first aspect, the 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 comprises: calculating a first angle increment of the first angle data at a current time and a previous time, and synchronously calculating a second angle increment of the second angle data at the current time and the previous time; performing difference operation on the first angle increment and the second angle increment, to obtain an encoder increment difference value; constructing an encoder input vector based on the first angle data and the second angle data, and performing nonlinear feature transformation on the encoder input vector, to obtain a direction dynamic component; The encoder incremental difference value is used to calculate a real-time direction deviation angle, and the direction deviation angle is combined with an angular velocity component and an angular acceleration component in the direction dynamic component to obtain a direction deviation feature vector; The direction deviation feature vector is subjected to time-varying dynamic mode decomposition, and a motion mode feature is extracted.
[0008] In a fourth implementation manner of the first aspect, the real-time direction deviation angle is calculated based on the encoder incremental difference value, and the real-time direction deviation angle is combined with an angular velocity component and an angular acceleration component in the direction dynamic component to obtain a direction deviation feature vector, and the combination operation includes: The numerator item and the denominator item of an inverse tangent function are constructed based on the encoder incremental difference value, and a protection processing is performed on the denominator item by introducing an anti-zero parameter to obtain an inverse tangent calculation parameter; The inverse tangent calculation parameter is input into the inverse tangent function and is subjected to unit conversion through an arc-to-angle conversion coefficient to obtain the real-time direction deviation angle; The corresponding angular velocity component and angular acceleration component are extracted from the direction dynamic component, and the real-time direction deviation angle is combined with the angular velocity component and the angular acceleration component to obtain the direction deviation feature vector.
[0009] In a fifth implementation manner of the first aspect, the direction deviation feature vector is subjected to time-varying dynamic mode decomposition, and a motion mode feature is extracted, and the time-varying dynamic mode decomposition includes: An augmented Hankel matrix is constructed based on the direction deviation feature vector and the first angle data and the second angle data; The augmented Hankel matrix is subjected to singular value decomposition to obtain a left singular matrix, a singular value matrix and a right singular matrix; A system modal matrix is constructed based on the left singular matrix, and a corresponding modal feature set is calculated by constructing a state transition operator; Motion state classification is performed according to the eigenvalue amplitudes of the modal feature values in the modal feature set, wherein a modal feature value with an eigenvalue amplitude less than a first threshold value is classified as a straight-line steady-state modal, a modal feature value with an eigenvalue amplitude between the first threshold value and a second threshold value is classified as a regular turning modal, a modal feature value with an eigenvalue amplitude between the second threshold value and a third threshold value is classified as a climbing load modal, and a modal feature value with an eigenvalue amplitude greater than the third threshold value is classified as an emergency turning obstacle avoidance modal, to obtain the motion mode feature.
[0010] In a sixth implementation manner of the first aspect, the motion mode feature is used to determine a motion mode identifier and select a corresponding local controller to calculate a target control quantity, and the determination and selection include: calculating a causal effect of the first driving wheel on the second driving wheel and a causal effect of the second driving wheel on the first driving wheel based on the motion mode feature, to obtain a time-varying causal matrix; calculating a modal probability vector including a straight-line steady state, a regular turning, a climbing load and an emergency turning obstacle avoidance according to the time-varying causal matrix; determining a motion mode identifier according to a maximum probability value in the modal probability vector, and matching and selecting a local controller and a controller parameter combination corresponding to the motion mode identifier from a preset local controller library; performing control calculation on the selected local controller configured with the controller parameter combination by inputting a current direction error, to obtain an initial control amount, and performing weighted fusion on the initial control amount in combination with the modal probability vector, to obtain a target control amount.
[0011] In a seventh implementation manner of the first aspect, the control calculation on the selected local controller configured with the controller parameter combination by inputting the current direction error, to obtain the initial control amount, and the weighted fusion on the initial control amount in combination with the modal probability vector, to obtain the target control amount, include: calculating a current direction error according to a reference direction input and a direction angle component in the direction deviation feature vector; performing proportional control, integral control and differential control calculation on the selected local controller configured with the controller parameter combination by inputting the current direction error, to obtain a basic control parameter; performing gain adjustment on integral and differential components in the basic control parameter according to the motion mode identifier, to obtain the initial control amount; performing probability weighted calculation on the initial control amount based on each modal probability value in the modal probability vector, to obtain the target control amount.
[0012] In an eighth implementation manner of the first aspect, the conversion of the target control amount into a direction correction signal of a motor driver includes: constructing a time-varying sliding mode surface function based on a current direction error and a direction error change rate; calculating an equivalent control component, a switching control component and an adaptive control component respectively according to the time-varying sliding mode surface function; superimposing the target control amount with the equivalent control component, the switching control component and the adaptive control component to obtain a target control signal; inputting the target control signal into a space vector pulse width modulation (SVPWM) to perform three-phase voltage synthesis and PWM waveform generation, and setting a switching frequency and a dead time parameter to be output to a motor driver of the first driving wheel and the second driving wheel, to obtain the direction correction signal.
[0013] In a second aspect, the present application provides a motor driving direction correction device based on encoder feedback, comprising: A collection module is configured to collect first angle data of the first driving wheel and second angle data of the second driving wheel respectively; A decomposition module is configured to calculate a 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 a motion mode feature; A calculation module is configured to determine a motion mode identifier according to the motion mode feature and select a corresponding local controller to calculate a target control quantity; A conversion module is configured to convert the target control quantity into a direction correction signal of a motor driver.
[0014] In the technical solution provided by the present application, the adaptive Kalman filter is used to replace the traditional fixed parameter filtering method, which can dynamically adjust the process noise covariance matrix according to the real-time signal-to-noise ratio of the encoder, and still obtain high-quality angle data in complex environments such as vibration and jolt. The complete dynamic features including the direction angle, angular velocity and angular acceleration are extracted, the real-time modal analysis of the direction deviation feature is performed, different motion modes such as straight-line steady state, regular turning, climbing load and emergency turning obstacle avoidance can be accurately identified, the dynamic influence relationship between the left and right driving wheels is quantified, and compared with the simple threshold judgment method, the recognition accuracy and anti-interference ability are higher, and the smoothness and accuracy of the modal switching are ensured. The special control parameters are designed for different motion modes, the smooth switching of the control strategy is realized through the modal probability weighted fusion mechanism, the performance deterioration problem of the traditional single controller when the working condition changes is avoided, and the accuracy of the motor driving direction correction is improved. BRIEF DESCRIPTION OF DRAWINGS
[0015] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0016] Figure 1 The steps of the motor driving direction correction method based on encoder feedback in the embodiment of the present application are shown in the figure. Figure 2 The structure diagram of the motor driving direction correction device based on encoder feedback in the embodiment of the present application is shown in the figure. DETAILED DESCRIPTION
[0017] The embodiment of the present application provides a motor driving direction correction method and device based on encoder feedback. The terms "first", "second", "third", "fourth" and the like (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not have to be used to describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" or "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0018] For the convenience of understanding, the specific flow of the embodiment of the present application is described below. Please refer to Figure 1 One embodiment of the motor driving direction correction method based on encoder feedback in the embodiment of the present application comprises the following steps. Step S11, respectively collecting first angle data of the first driving wheel and second angle data of the second driving wheel; Specifically, by arranging incremental photoelectric encoders on the two drive wheels, the first encoder pulse signal of the first drive wheel and the second encoder pulse signal of the second drive wheel are obtained respectively, and independent data acquisition channels are constructed to avoid crosstalk and data loss. Kalman filter models are established for the first drive wheel and the second drive wheel respectively, to perform dynamic state estimation and noise reduction processing on the encoder pulse signals corresponding to the drive wheels, wherein the internal structure of the filter includes core modules such as state prediction, observation update, covariance estimation and error feedback, and a joint estimation model of position and speed is established to reflect the change trend of the encoder angle and the rotation speed at the same time. Due to the existence of disturbances, slip or load changes and other factors in the motor working environment, the noise level in the encoder signal has dynamic change characteristics, so the process noise covariance matrix in the first Kalman filter is adaptively adjusted according to the first encoder pulse signal collected in real time, to generate the first covariance parameter suitable for the current working condition, and to enhance the response ability of the filter to abnormal working conditions. The process noise covariance matrix of the second Kalman filter is adjusted based on the second encoder pulse signal, to generate the second covariance parameter, so that the filtering strategy of the left and right wheel encoder signals has pertinence and differentiation. The first encoder pulse signal is input into the first Kalman filter configured with the first covariance parameter for dynamic filtering processing, and through the state estimation result output by the filter, combined with the encoder resolution parameter and the pulse number conversion rule, the conversion and analysis of the first angle data are completed; 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 the motion mode feature; Specifically, the first angle data and the second angle data are time series processed during real-time running, the first angle values at the current time and the previous time are synchronously extracted and the variation thereof is calculated in each control period to obtain the first angle increment, and the second angle data is calculated in the same way to obtain the second angle increment. The two angle increments are subjected to difference operation to obtain an encoder increment difference value, reflecting the inconsistency of the double-wheel rotation and preliminarily revealing the system direction deviation trend. A multi-dimensional encoder input vector is constructed based on the first angle data and the second angle data at the current time, and the multi-dimensional encoder input vector is input into a pre-trained nonlinear mapping model, which is a neural network structure or a transformation function with an embedded nonlinear activation function, to extract the direction dynamic components including the direction angular velocity and the angular acceleration, so as to fully restore the continuous change characteristics of the motion trajectory in the time domain. On the basis of the encoder increment difference value, a proportional scaling parameter and a safety compensation factor are introduced to calculate the direction deviation angle at the current time, and the direction deviation angle and the direction angular velocity and angular acceleration components obtained in the nonlinear mapping are combined and operated according to a unified data structure to construct a direction deviation feature vector. The direction deviation feature vectors at continuous time points are aggregated in a sliding window manner, and a time-varying dynamic mode decomposition algorithm is used to extract the modes of the direction deviation feature vectors. Through singular value decomposition and eigenvector projection operation in each window, the dominant motion mode features under the current working condition are extracted, including steady straight running, regular turning, load uphill or emergency turning to avoid obstacles, and the output mode vector and the corresponding characteristic value constitute the motion mode features.
[0020] Step S13, determining a motion mode identifier according to the motion mode features and selecting a corresponding local controller to calculate a target control quantity; Specifically, the causal relationship analysis of the motion mode features includes constructing a vector autoregressive model based on the historical sequence of the direction deviation feature vector and the sequence of the encoder angle data, calculating the causal influence degree of the first drive wheel on the second drive wheel and the causal influence degree of the second drive wheel on the first drive wheel, and combining the two to form a causal description matrix with time-varying dynamic characteristics, i.e., a time-varying causal matrix, which reflects the dynamic coupling state and interaction strength between different drive units in the current system. With the time-varying causal matrix as input, combined with the established modal probability prior distribution model, the posterior probability of the current state of the system under four typical motion modes is calculated, corresponding to straight-line steady state, regular turning, climbing load and sharp turning obstacle avoidance respectively, forming a modal probability vector containing four components. The modal type corresponding to the maximum probability component in the modal probability vector is extracted as the motion mode identifier, and the local controller instance corresponding to the motion mode identifier is retrieved from the preset local controller library with this as the index, and the control parameter combination matched by the local controller is loaded at the same time, 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 amount calculation, and the initial control amount is obtained as the basic control output under this mode. Considering that there is a certain degree of uncertainty in modal identification, weighted fusion calculation is performed on the initial control amount of all controllers based on the modal probability vector, where the weight is jointly determined by the modal probability and the controller adaptation factor, and the target control amount is output.
[0021] Step S14, converting the target control amount into a direction correction signal of the motor driver.
[0022] Specifically, based on the direction error at the current moment and the rate of change of the direction error, a sliding mode surface function with time-varying characteristics is constructed, which contains the amplitude information of the error itself and integrates the error change trend and the integral history, so as to effectively represent the dynamic behavior of the current system deviating from the target state. Based on the time-varying sliding mode surface function, three independent but complementary control components are decomposed, among which the equivalent control component is used for feedforward compensation of the ideal system model to ensure the satisfaction of the basic control requirement; the switching control component adjusts the sign according to the amplitude and direction of the sliding mode surface, and provides robust suppression ability to the system uncertainty and external disturbance; and the adaptive control component responds to the unmodeled dynamic behavior of the system in real time through an online adjustment mechanism to enhance the overall control performance and robustness. The above three types of control components and the target control quantity are subjected to unified superposition operation to output the target control signal. The target control signal is input into a space vector pulse width modulator, and the target voltage in the three-phase stationary coordinate system is synthesized in the two-dimensional plane through space vector projection, and combined with the set switching frequency and dead time parameters to generate a PWM waveform sequence. According to the predetermined modulation period, the three-phase PWM signals are transmitted to the corresponding brushless motor drivers of the first and second drive wheels to realize the adjustment of the torque of the left and right wheel motors. The actual current and torque change driven by the three-phase PWM signal constitute the direction correction signal.
[0023] In a specific embodiment, the process of performing step S11 can specifically include the following steps: respectively collect a first encoder pulse signal of the first drive wheel and a second encoder pulse signal of the second drive wheel; establish a first Kalman filter based on the first encoder pulse signal, and simultaneously establish a second Kalman filter based on the second encoder pulse signal; adjust the process noise covariance matrix in the first Kalman filter according to the first encoder pulse signal to obtain a first covariance parameter; adjust the process noise covariance matrix in the second Kalman filter according to the second encoder pulse signal to obtain a second covariance parameter; input the first encoder pulse signal into the first Kalman filter configured with the first covariance parameter for noise reduction processing and obtain first angle data through pulse count conversion; input the second encoder pulse signal into the second Kalman filter configured with the second covariance parameter for noise reduction processing and obtain second angle data through pulse count conversion.
[0024] Specifically, incremental optical encoders are configured on both sides of the driving wheels to capture the pulse signals generated by the optical encoder during the rotation of the motor. The pulse signals are a sequence of square waves uniformly distributed with the rotation angle, with the characteristics of high time resolution and stable signal frequency, serving as the original input data reflecting the rotation state of the wheel train. Through a double-channel pulse acquisition interface, the first encoder pulse signal generated by the first driving wheel and the second encoder pulse signal generated by the second driving wheel are sampled in real time, with a sampling frequency of more than 1 kHz. After acquisition, the number of pulses in each time period is taken as input to construct a first Kalman filter and a second Kalman filter for state estimation. Each filter contains two stages of prediction and correction, and the state variable design includes angle position and angular velocity components, with process models and observation models to achieve dynamic noise reduction and high-precision recovery of the encoder signal. In the filter initialization stage, basic parameters such as initial covariance matrix, state transition model, and measurement matrix are set. For each encoder signal, an adaptive process noise adjustment mechanism is introduced, i.e., in each update period, the process noise covariance matrix in the first Kalman filter is corrected online based on the amplitude and mean shift of the first encoder pulse signal, generating a first covariance parameter reflecting the current disturbance intensity, and then dynamically adjusting the prediction confidence and measurement dependence of the filter. Similarly, the second encoder pulse signal is processed with equivalent logic, and the second covariance parameter is generated by adjusting the process noise covariance of the second Kalman filter according to its fluctuation and mutation trend, achieving separate modeling and fine filtering of the double-wheel input signals in different noise environments. After the covariance parameters are updated, the first encoder pulse signal is input into the first Kalman filter configured with the first covariance parameter, and after the state prediction and measurement update steps, the first angular position estimate at the current time is output. To be compatible with the angle expression form required by the control module, the internal variables output by the filter are converted by pulse counting, and the angle value corresponding to each unit pulse is multiplied by the cumulative pulse number to convert it into standard first angle data. Simultaneously, the second encoder pulse signal is input into the second Kalman filter configured with the second covariance parameter, and after state fusion, the real-time angle estimate corresponding to the second driving wheel is output, and the second angle data is also generated by pulse conversion.
[0025] In a specific embodiment, the process of inputting the first encoder pulse signal into the first Kalman filter configured with the first covariance parameter for noise reduction and obtaining the first angle data through pulse counting conversion can include the following steps: 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 a state equation of the first Kalman filter for prediction calculation, and a first covariance parameter is combined to update a prediction error covariance matrix, to obtain a first predicted state vector and a first predicted covariance matrix; Kalman gain calculation and state correction are performed on the first predicted state vector based on an observation value of the first encoder pulse signal, to obtain a first filtered state vector; An angular position component is extracted from the first filtered state vector and is converted through pulse counting based on an encoder resolution, to obtain first angle data.
[0026] Specifically, the first encoder pulse signal is taken as input, a first state vector including two physical quantities of angular position and angular velocity is established, the first state vector is composed of an angle at a current time step and a velocity at a previous time step, and a first state transition matrix is derived based on a preset fixed sampling period, the first state transition matrix defines a physical law of evolution of the system from one time to the next, includes a combination structure of a unit increment factor and a sampling period length, and is used to describe a dynamic characteristic of the angular position integrated from the velocity; meanwhile, a first observation matrix is constructed, used to describe a mapping relationship between an actual encoder pulse observation value and the state vector, and the structure of the first observation matrix determines how the filter associates the observation signal with the internal state variable. The first state vector is input into a state prediction equation of the first Kalman filter, a prediction calculation process is performed, the prediction operation is based on a state estimation result at the previous time step, a forward evolution is performed through the state transition matrix, and a first predicted state vector at the current time step is output; in the prediction process, a first covariance matrix is updated based on a first covariance parameter, to obtain a first predicted covariance matrix, used to depict an uncertainty level of the current predicted state, and a numerical value of the first predicted covariance matrix directly affects a response sensitivity of the filter to new observation data. An observation value of the first encoder pulse signal at the current time step is taken as input, compared with the first predicted state vector, and a Kalman gain at the current time step is calculated, the Kalman gain factor is used for weight distribution between a prediction value and an observation value, so that a final state correction result considers both a model prediction trend and a new change trend in the observation data. After the Kalman gain is obtained, a state correction operation is performed on the first predicted state vector, the observation residual and the prediction result are fused through gain weighting, and a first filtered state vector at the current time step is generated. An angular position component representing a motor angular position is extracted from the first filtered state vector as a subsequent processing object, and a pulse counting conversion process is performed based on a resolution parameter of the encoder, i.e., a number of pulses corresponding to one rotation, so as to convert a physical value of the angular position component into a total number of current cumulative pulses, thereby generating first angle data of the first drive wheel at the current time step.
[0027] The second encoder pulse signal is input into a second Kalman filter configured with a second covariance parameter for noise reduction processing and pulse count conversion to obtain second angle data, including: A second state vector is established based on the second encoder pulse signal, and a second state transition matrix and a second observation matrix are constructed according to a sampling period; The second state vector is input into a state equation of the second Kalman filter for prediction calculation, and a prediction error covariance matrix is updated in combination with the second covariance parameter to obtain a second predicted state vector and a second predicted covariance matrix; The second predicted state vector is subjected to Kalman gain calculation and state correction based on an observation value of the second encoder pulse signal to obtain a second filtered state vector; An angular position component is extracted from the second filtered state vector and subjected to pulse count conversion through an encoder resolution to obtain second angle data.
[0028] In a specific embodiment, the process of performing step S12 can specifically include the following steps: A first angle increment of the first angle data at the current time and the previous time is calculated, and a second angle increment of the second angle data at the current time and the previous time is calculated synchronously; The first angle increment and the second angle increment are subjected to difference operation to obtain an encoder increment difference value; An encoder input vector is constructed based on the first angle data and the second angle data, and the encoder input vector is subjected to nonlinear feature transformation to obtain a direction dynamic component; A real-time direction deviation angle is calculated according to the encoder increment difference value, and combined with an angular velocity component and an angular acceleration component in the direction dynamic component to obtain a direction deviation feature vector; The direction deviation feature vector is subjected to time-varying dynamic mode decomposition, and a motion mode feature is extracted.
[0029] Specifically, the angle data of the first driving wheel and the second driving wheel are extracted at two continuous sampling time points, respectively, wherein the first angle data reflects the rotation position of the left wheel at the current time point, and the second angle data corresponds to the synchronization state of the right wheel. By differentiating the angle values at the current time and the previous time, the first angle increment and the second angle increment are obtained, respectively, representing the actual rotation angle change of the two wheels in a sampling period. The difference between the first angle increment and the second angle increment is calculated to obtain the encoder increment difference, which reflects the deviation of the left and right wheel synchronization caused by uneven driving or external disturbance in the current control period. The first angle data and the second angle data at the current time and the previous two times are combined to generate an encoder input vector containing information of multiple time points. The encoder input vector arranges the original angle data in time series form, reflecting the rotation history characteristics of the system in a short time window. The encoder input vector is input into the deployed nonlinear feature mapping model. The nonlinear feature mapping model uses a three-layer feedforward neural network structure with an activation function, which extracts dynamic features related to direction changes, including direction angular velocity and direction angular acceleration, through a nonlinear transformation process to obtain direction dynamic components. The real-time direction deviation angle at the current time is calculated according to the encoder increment difference. The direction deviation angle value is converted by a proportional mapping function to maintain the uniformity of the numerical scale, and the obtained direction deviation angle is used to quantify the degree of deviation of the two wheels from the ideal synchronization state in the control period. The direction deviation angle, the direction angular velocity component and the direction angular acceleration component extracted from the nonlinear feature transformation are combined to construct a direction deviation feature vector. The direction deviation feature vector is subjected to time-varying dynamic mode decomposition. The feature vectors at several continuous time points are integrated and processed in a sliding window manner, and the time-varying dynamic mode decomposition algorithm is executed. By implementing singular value decomposition, state reconstruction and mode extraction in the time dimension, the input feature vector is mapped to a low-dimensional modal space, and the dominant motion modal features are extracted to identify the typical motion modes of the current system, such as steady straight running, regular turning, climbing load or emergency turning obstacle avoidance, and the transient behavior in the modal switching process is modeled and decomposed. The output motion mode features include modal vectors, eigenvalue matrices and reconstruction errors.
[0030] In a specific embodiment, the process of calculating the real-time direction deviation angle according to the encoder increment 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 can specifically include the following steps: Based on the encoder increment difference, the numerator and denominator of the arctangent function are constructed, and the denominator is protected by introducing a zero-preventing parameter to obtain the arctangent calculation parameters. The arctangent calculation parameter is input into the arctangent function and unit conversion is performed through the radian-to-angle conversion factor to obtain the real-time direction deviation angle; The corresponding angular velocity component and angular acceleration component are extracted from the direction dynamic component, and the real-time direction deviation angle is combined with the angular velocity component and the angular acceleration component to obtain a direction deviation feature vector.
[0031] Specifically, the first angle data and the second angle data between the previous control period and the current control period are respectively subjected to differential operation, and the first angle increment and the second angle increment are calculated, which respectively correspond to the angle changes of the left wheel and the right wheel in one sampling period. The difference and sum operation is performed on the two increment signals, the difference part constitutes the numerator item of the arctangent function, which is used to represent the relative inconsistency of the double wheels in the rotation amount in the current period, and the sum part constitutes the denominator item, which represents the total or average change degree of the double wheel angle change, reflecting the overall rotation trend. In the actual calculation process, due to some special running scenarios, such as the boundary condition that the angle changes of the two wheels are extremely close or the rotation change amplitude is extremely small, the denominator item tends to zero, thereby causing a zero division error or a numerical instability problem. A zero protection parameter is introduced, which is a preset small positive number. The zero protection parameter is added to the denominator item to form a protection structure, ensuring that the denominator is a non-zero value at any time, and a safe and calculable arctangent function input parameter is constructed. The ratio of the numerator item and the zero protection denominator item is taken as the parameter input into the arctangent function. Through the double nonlinear mapping capability of the arctangent function, the direction deviation angle corresponding to the rotation deviation of the double wheels in the current sampling period is obtained. The angle value is represented in radians. The radian value is multiplied by the radian-to-angle unit conversion factor to complete the unit conversion. The real-time direction deviation angle represented in degrees is output, reflecting the attitude deviation direction and deviation amplitude of the system at the current time. At the same time, the direction dynamic component is structurally analyzed, and the direction angular velocity component and the direction angular acceleration component are extracted, reflecting the dynamic trend and dynamic response capability of the direction change, respectively describing the instantaneous rate and change slope of the system direction change at the current time. The angular velocity component and the angular acceleration component are combined with the real-time direction deviation angle to construct a direction deviation feature vector in a unified vector structure. The three components of the vector: the direction deviation angle, the angular velocity, and the angular acceleration, correspond to the static error, the dynamic response, and the system inertia compensation demand in the direction control, respectively. The three jointly describe the steady-state deviation, dynamic disturbance, and nonlinear inertia effect faced by the system in the direction adjustment process.
[0032] In a specific embodiment, the process of performing step of performing time-varying dynamic mode decomposition on the direction deviation feature vector and extracting motion pattern features can specifically include the following steps: An augmented Hankel matrix is constructed based on the direction deviation feature vector and the first angle data and the second angle data. singular value decomposition is performed on the augmented Hankel matrix to obtain a left singular matrix, a singular value matrix and a right singular matrix; a system modal matrix is constructed based on the left singular matrix, and a corresponding modal feature set is calculated by constructing a state transition operator; motion state classification is performed according to the eigenvalue amplitudes of the modal eigenvalues in the modal feature set, wherein the modal eigenvalues with an eigenvalue amplitude less than a first threshold value are classified as a straight steady-state modal, the modal eigenvalues with an eigenvalue amplitude between the first threshold value and a second threshold value are classified as a regular turning modal, the modal eigenvalues with an eigenvalue amplitude between the second threshold value and a third threshold value are classified as a climbing load modal, and the modal eigenvalues with an eigenvalue amplitude greater than the third threshold value are classified as an emergency turning obstacle avoidance modal, to obtain a motion mode feature.
[0033] Specifically, the direction deviation feature vector calculated in the current control period and the previous several periods, and the corresponding first angle data and second angle data are organized in time sequence as a sliding window sequence, and a multi-dimensional state sample set is constructed based on the evolution trajectory of the sequence in the time dimension. The multi-dimensional state sample set includes the direction deviation angle, the direction angle velocity, the direction angle acceleration, and the angle state data of the left and right wheels at each time, forming a direction behavior feature set. The time sequence samples are stacked through Hankel structure, the state vectors of consecutive time steps are arranged in columns, and an augmented Hankel matrix is constructed to capture the continuous evolution characteristics of the system state in the time dimension. Singular value decomposition operation is performed on the augmented Hankel matrix to decompose the matrix into left singular matrix, singular value matrix and right singular matrix, wherein the left singular matrix contains the orthogonal basis vectors of the dominant dynamic mode in the state space, the singular value matrix provides a quantitative index of the energy contribution of each mode to the overall system, and the right singular matrix is used to describe the response degree of each time period to different modes. Taking the left singular matrix as the input, a mode matrix representing the main dynamic characteristics of the current system is constructed. The mode matrix converts the singular space projection into a modal structure with physical meaning, and has the ability to model and classify the system behavior in low dimension. The state transition operator construction process is introduced, and two data sub-matrices of the sliding window structure in the time sequence in the augmented Hankel matrix are constructed, one representing the current state and the other representing the subsequent state. By solving the least square mapping relationship between the two sub-matrices, the state transition operator is obtained, and a time advancing model is established in the modal space. Based on the state transition model, feature analysis is performed on the mode matrix to calculate the corresponding mode feature set, wherein each mode feature vector and its corresponding mode feature value constitute a mode description pair. The amplitude part of the mode feature value represents whether the mode presents attenuation, growth or maintains stability in the system, and has a direct quantitative effect on the stability and dynamic characteristics of the system behavior. To realize the recognition of motion mode, the amplitudes of all mode feature values are uniformly normalized and classified according to the amplitude range, and the motion state mapping is implemented according to the set multi-level threshold structure. If the amplitude of the mode feature value is less than the first threshold value, it indicates that the current mode is in a low dynamic response state, and is classified as a straight line steady state mode. If the amplitude of the mode feature value is between the first threshold value and the second threshold value, it indicates that the system has certain direction change but the amplitude is controllable, and is determined as a regular turning mode. If the amplitude of the mode feature value further increases and falls between the second threshold value and the third threshold value, it indicates that the system is disturbed by external load or the road resistance increases, and belongs to the climbing load mode. If the amplitude of the mode feature value is greater than the third threshold value, it indicates that the system presents obvious nonlinear response and has the characteristics of sharp direction change or obstacle avoidance, and is classified as an urgent turning obstacle avoidance mode.
[0034] In a specific embodiment, the process of performing step S13 can specifically include the following steps: calculating the causal influence of the first driving wheel on the second driving wheel and the causal influence of the second driving wheel on the first driving wheel based on the motion mode features, to obtain a time-varying causal matrix; calculating a modal probability vector containing a straight-line steady state, a regular turn, a climbing load, and an emergency turn obstacle avoidance according to the time-varying causal matrix; determining a motion mode identifier according to the maximum probability value in the modal probability vector, and matching and selecting a local controller and a controller parameter combination corresponding to the motion mode identifier from a preset local controller library; inputting the current direction error into the selected local controller configured with the controller parameter combination for control calculation to obtain an initial control amount, and combining the modal probability vector to perform weighted fusion on the initial control amount to obtain a target control amount.
[0035] Specifically, a time series of two variables is constructed based on the motion pattern characteristics and the historical angle data of the left and right drive wheels, and a model is built for the time series to capture the dynamic dependence of the two variables in the time dimension. A sliding window mechanism is used to extract the first drive wheel angle change sequence and the second drive wheel angle change sequence within a period of time, and a vector autoregressive model is built based on the historical data within the window, so that without making prior assumptions about the causal relationship, the explanatory ability of one variable in predicting another variable is quantified through joint modeling. The vector autoregressive model is used to calculate the prediction error changes under the conditions of considering only the historical data of itself and considering the historical data of the other party, respectively. By comparing the variance of the prediction error, the causal influence strength of the first drive wheel on the second drive wheel and the causal influence strength of the second drive wheel on the first drive wheel are derived, and the causal influence values in both directions are combined to construct a two-dimensional time-varying causal matrix, reflecting the coordination or constraint relationship between the two wheels in the current drive system. The time-varying causal matrix is used as input, and the standard modal causal distribution model built in the training stage is used for modal probability inference. Based on the Bayesian inference mechanism, the causal distribution parameters corresponding to the four typical modes of straight driving, regular turning, climbing load and emergency turning obstacle avoidance in the training set are introduced, including the mean vector and the covariance matrix, and the observation probability of the current time-varying causal matrix under the four modes is calculated through the Gaussian likelihood function. Combined with the modal prior distribution obtained by statistical analysis of the historical data, the posterior probability of each mode at the current time is calculated using the Bayesian formula to form a modal probability vector with a length of four. Each component in the modal probability vector represents the possibility of the current state belonging to the corresponding mode, which has clear physical meaning and control adaptation value. After obtaining the modal probability vector, the modal label corresponding to the maximum probability value is extracted as the motion pattern identifier at the current time. According to the current motion pattern identifier, a set of corresponding local controllers is retrieved and selected from the preset local controller library. The local controller is functionally divided according to the characteristics of the current mode, and its internal parameter configuration is optimized and adjusted according to 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 filter time constant, etc. The directional error value calculated by the real-time sensor at the current time is input into the selected local controller, and the initial control quantity is obtained by executing a control calculation process according to the structure and parameters of the controller. The initial control quantity represents the single control output of the system under the optimal response of the current mode. Based on the numerical value of each mode component in the current modal probability vector, a weighted fusion model of the control quantity is constructed. The weighted fusion model constructs a set of modal fusion control quantities by weighting and superimposing the control output of each controller according to its modal probability, and introduces an adaptive weight matrix during the fusion to adjust the contribution proportion of different controllers to different modes, thereby constructing a target control quantity with modal awareness and multi-controller fusion capability.
[0036] In a specific embodiment, the process that the execution step inputs the current direction error into the selected local controller of the configuration controller parameter combination to perform a control calculation to obtain an initial control quantity, and combines the initial control quantity with the modal probability vector to perform a weighted fusion to obtain a target control quantity can specifically include the following steps: Calculate the current direction error according to the direction angle component in the reference direction input and the direction deviation feature vector; Input the current direction error into the selected local controller of the configuration controller parameter combination to perform proportional control, integral control and differential control calculation to obtain a basic control parameter; According to the motion mode identifier, adjust the gain of the integral component and the differential component in the basic control parameter to obtain an initial control quantity; Based on the modal probability value in the modal probability vector, perform a probability weighted calculation on the initial control quantity to obtain a target control quantity.
[0037] Specifically, in each sampling period, an expected direction signal is obtained to represent the ideal posture angle that the vehicle or robot should maintain at the current time. At the same time, the direction angle component in the direction deviation feature vector is used to represent the actual direction state obtained after filtering and dynamic feature fusion. The difference operation is performed on the expected direction signal and the direction angle component to compare the reference direction with the actual direction angle and obtain the direction error at the current time. The direction error is input into a pre-set and optimized local controller. The local controller selects and loads a set of controller parameter combinations according to the current motion mode. The internal structure includes three parts: a proportional part, an integral part and a differential part. In the proportional part, the direction error is directly amplified as a proportional control quantity to provide fast response capability; in the integral part, the direction error is accumulated over time to eliminate system drift or static error that occurs during long-term operation; and in the differential part, the rate of change of the error over time is calculated to predict future trends and provide advance compensation for the control output. After the calculation of the three parts, the controller generates a set of basic control parameters, which are composed of proportional, integral and differential components, representing the ideal control output when the complex external environment changes are not considered. Considering that the motor drive system has different sensitivities to error responses in different motion modes, the integral and differential components in the basic control parameters are gain-adjusted according to the motion mode identifier. In the straight-line steady-state mode, more attention is paid to eliminating long-term small deviations, and the integral gain is increased to ensure the stability of the direction; in the regular turning mode, the focus is on the dynamic change of the sensitive response, and the gain of the differential component is moderately increased to maintain the control smoothness when the direction changes rapidly; in the climbing load mode, the external disturbance and inertia effect are large, and the balance adjustment between the integral and differential components is introduced to balance the steady-state and dynamic performance; in the emergency turning obstacle avoidance mode, the high-speed response and anti-interference ability are emphasized, and the weight of the differential component is increased, while the cumulative effect of the integral component is limited to prevent control lag in sharp operation. Through the differential adjustment mechanism based on the mode, the initial control quantity is obtained. Based on the probability value of each mode in the modal probability vector, the initial control quantity is calculated by probability weighting, that is, a weighted control quantity is calculated for each possible motion mode, and the weights are allocated according to the size of the probability value. The target control quantity is obtained by superimposing all the weighted results.
[0038] In a specific embodiment, the process of performing step S14 can specifically include the following steps: constructing a time-varying sliding mode surface function based on the current direction error and the direction error rate of change; calculating an equivalent control component, a switching control component and an adaptive control component according to the time-varying sliding mode surface function, respectively; superimposing the target control quantity and the equivalent control component, the switching control component and the adaptive control component to obtain a target control signal; The target control signal is input into a space vector pulse width modulator for three-phase voltage synthesis and PWM waveform generation, and a switching frequency and dead time parameter are set and output to a motor driver of the first driving wheel and the second driving wheel to obtain a direction correction signal.
[0039] Specifically, a sliding mode surface function with adaptive characteristics is constructed based on the current direction error and the direction error change rate, which contains the linear superposition structure of the error term and the error derivative term in the traditional form, and a dynamic convergence factor based on the current error amplitude is introduced to enhance the response ability of the control system under different deviation amplitude conditions. When the error amplitude is large, the convergence factor in the sliding mode surface will increase accordingly, thereby accelerating the state to the sliding mode surface; when the error is small, the convergence factor tends to be stable to avoid the oscillation caused by excessive adjustment. The constructed time-varying sliding mode surface function reflects the deviation degree and its trend of the current system state in the direction space in real time. According to the time-varying sliding mode surface function, the equivalent control component, the switching control component, and the adaptive control component are calculated in turn. The equivalent control component is used to compensate for the deterministic dynamics described in the ideal system model, and its calculation depends on the known structural parameters of the system such as the equivalent moment of inertia and the damping coefficient of the motor, and combines the expected direction acceleration, the sliding mode surface convergence term, and the system load model to solve analytically. The goal is to guide the system state to the sliding mode surface and maintain its sliding motion state. The switching control component is used to suppress the uncertainties and external disturbances in the system. By introducing a boundary layer design based on the sign function of the sliding mode surface function, the high-frequency chattering problem caused by the traditional sign function is effectively avoided, and the control quantity is smoothed by using a band-limited saturation function, which enhances the robustness of the system and prolongs the service life of the actuator. At the same time, to compensate for the unmodeled dynamics and variable disturbance terms in the system, an adaptive control component is introduced. The adaptive control component is dynamically estimated based on the absolute value amplitude of the sliding mode surface, and the disturbance suppression parameter is updated online through the adaptive law, so that the controller can maintain good tracking performance and error convergence rate when facing parameter changes, load mutations, and other complex scenarios. The entire adaptive process prevents instability caused by excessive gain through 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 at the current time. The target control signal is subjected to coordinate transformation and waveform modulation to meet the input requirements of the three-phase driving voltage of the actual motor driver. The target control signal is converted into a two-dimensional voltage vector in the α-β coordinate system, and based on the principle of space vector pulse width modulation, the two-dimensional voltage vector is projected between the nearest two groups of effective voltage vectors in the three-phase stationary coordinate system. The on-time ratio of each switch in a cycle is determined by time weighting, thereby realizing the approximate synthesis of the required space vector. At the same time, 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 20 kHz to ensure silent operation outside the audio range. The dead time is used to prevent short circuit caused by the simultaneous conduction of the upper and lower bridge arms, and is set at a few microseconds.The generated three-way PWM control signals are respectively output to motor driver input terminals corresponding to the first driving wheel and the second driving wheel, and the driver adjusts each phase voltage according to the PWM duty ratio to realize accurate energization control of the motor winding.
[0040] The motor driving direction correction method based on encoder feedback in the embodiment of the application is described above, and the motor driving direction correction device based on encoder feedback in the embodiment of the application is described below, please refer to Figure 2 The motor driving direction correction device based on encoder feedback in the embodiment of the application includes one embodiment: The acquisition module 21 is configured to acquire first angle data of the first driving wheel and second angle data of the second driving wheel respectively. The decomposition module 22 is configured to calculate a 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 a motion mode feature. The calculation module 23 is configured to determine a motion mode identifier according to the motion mode feature and select a corresponding local controller to calculate a target control quantity. The conversion module 24 is configured to convert the target control quantity into a direction correction signal of the motor driver.
[0041] Through the cooperation of the above-mentioned components, the adaptive Kalman filter is used to replace the traditional fixed parameter filtering method, the process noise covariance matrix can be dynamically adjusted according to the real-time signal-to-noise ratio of the encoder, high-quality angle data can be obtained in complex environments such as vibration and jolt, complete dynamic features including direction angle, angular velocity and angular acceleration are extracted, real-time modal analysis is performed on the direction deviation feature, different motion modes such as straight stable state, regular turning, climbing load and emergency turning obstacle avoidance can be accurately identified, the dynamic influence relationship between the left and right driving wheels is quantified, compared with the simple threshold judgment method, the recognition accuracy and anti-interference ability are higher, the smoothness and accuracy of the modal switching are ensured. The control parameters are designed for different motion modes, the smooth switching of the control strategy is realized through the modal probability weighted fusion mechanism, the performance deterioration problem of the traditional single controller when the working condition changes is avoided, and the accuracy of the motor driving direction correction is improved.
[0042] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described system, system and unit can refer to the corresponding process in the foregoing method embodiments, which will not be repeated here.
[0043] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application or the entire or part of the technical solutions that essentially contribute to the prior art can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.
[0044] The above description and the above embodiments are only used to illustrate the technical solutions of the present application, but not to limit them. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements for some technical features. These modifications or replacements do not make the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for correcting the driving direction of a motor based on encoder feedback, characterized by, The method comprises: respectively collecting first angle data of the first driving wheel and second angle data of the second driving wheel; 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; converting the target control quantity into a direction correction signal of a motor driver.
2. The encoder feedback-based motor drive direction correction method of claim 1, wherein, The method of respectively collecting first angle data of the first driving wheel and second angle data of the second driving wheel comprises: respectively collecting first encoder pulse signals of the first driving wheel and second encoder pulse signals of the second driving wheel; establishing a first Kalman filter based on the first encoder pulse signals and simultaneously establishing a second Kalman filter based on the second encoder pulse signals; adjusting a process noise covariance matrix in the first Kalman filter according to the first encoder pulse signals to obtain a first covariance parameter; adjusting a process noise covariance matrix in the second Kalman filter according to the second encoder pulse signals to obtain a second covariance parameter; inputting the first encoder pulse signals into the first Kalman filter configured with the first covariance parameter for noise reduction processing and obtaining first angle data through pulse counting conversion; inputting the second encoder pulse signals into the second Kalman filter configured with the second covariance parameter for noise reduction processing and obtaining second angle data through pulse counting conversion.
3. The encoder feedback-based motor drive direction correction method of claim 2, wherein, The method of inputting the first encoder pulse signals into the first Kalman filter configured with the first covariance parameter for noise reduction processing and obtaining first angle data through pulse counting conversion comprises: establishing a first state vector based on the first encoder pulse signals and constructing a first state transition matrix and a first observation matrix according to a sampling period; inputting the first state vector into a state equation of the first Kalman filter for predictive calculation, updating a prediction error covariance matrix in combination with the first covariance parameter, and obtaining a first predicted state vector and a first predicted covariance matrix; performing Kalman gain calculation and state correction on the first predicted state vector based on an observation value of the first encoder pulse signals to obtain a first filtered state vector; extracting an angular position component from the first filtered state vector and performing pulse counting conversion through an encoder resolution to obtain the first angle data.
4. The encoder feedback-based motor drive direction correction method of claim 3, wherein, The method 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 a motion mode feature comprises: calculating a first angle increment of the first angle data at a current time and a previous time, and synchronously calculating a second angle increment of the second angle data at the current time and the previous time; performing difference operation on the first angle increment and the second angle increment to obtain an encoder increment difference value; construct an encoder input vector based on the first angle data and the second angle data, and perform nonlinear feature transformation on the encoder input vector to obtain a direction dynamic component; calculate a real-time direction deviation angle based on the encoder incremental difference value, and perform combined operation on the direction dynamic component, an angular velocity component and an angular acceleration component to obtain a direction deviation feature vector; perform time-varying dynamic mode decomposition on the direction deviation feature vector, and extract a motion mode feature.
5. The encoder feedback-based motor drive direction correction method of claim 4, wherein, The method of calculating a real-time direction deviation angle based on the encoder incremental difference value, and performing combined operation on the direction dynamic component, an angular velocity component and an angular acceleration component to obtain a direction deviation feature vector, comprises: construct a numerator item and a denominator item of an inverse tangent function based on the encoder incremental difference value, and introduce a zero-preventing parameter to protect the denominator item to obtain an inverse tangent calculation parameter; input the inverse tangent calculation parameter into an inverse tangent function and perform unit conversion through a radian-to-angle conversion coefficient to obtain a real-time direction deviation angle; extract a corresponding angular velocity component and an angular acceleration component from the direction dynamic component, and combine the real-time direction deviation angle with the angular velocity component and the angular acceleration component to obtain a direction deviation feature vector.
6. The encoder feedback-based motor drive direction correction method of claim 5, wherein, The method of performing time-varying dynamic mode decomposition on the direction deviation feature vector, and extracting a motion mode feature, comprises: construct an augmented Hankel matrix based on the direction deviation feature vector, the first angle data and the second angle data; perform singular value decomposition on the augmented Hankel matrix to obtain a left singular matrix, a singular value matrix and a right singular matrix; construct a system modal matrix based on the left singular matrix, and calculate a corresponding modal feature set by constructing a state transition operator; classify motion states according to the eigenvalue amplitudes of the modal feature values in the modal feature set, wherein eigenvalue amplitudes less than a first threshold value are classified as a straight-line steady-state mode, eigenvalue amplitudes between the first threshold value and a second threshold value are classified as a regular turning mode, eigenvalue amplitudes between the second threshold value and a third threshold value are classified as a climbing load mode, and eigenvalue amplitudes greater than the third threshold value are classified as an emergency turning obstacle avoidance mode, to obtain a motion mode feature.
7. The encoder feedback-based motor drive direction correction method of claim 6, wherein, The method of determining a motion mode identifier based on the motion mode feature and selecting a corresponding local controller to calculate a target control quantity, comprises: calculate 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 based on the motion mode feature to obtain a time-varying causal matrix; calculate a modal probability vector containing a straight-line steady-state, a regular turning, a climbing load and an emergency turning obstacle avoidance according to the time-varying causal matrix; determine a motion mode identifier according to the maximum probability value in the modal probability vector, and match and select a local controller and a controller parameter combination corresponding to the motion mode identifier from a pre-set local controller library; input a current direction error into the selected local controller configured with the controller parameter combination to perform control calculation to obtain an initial control quantity, and perform weighted fusion on the initial control quantity in combination with the modal probability vector to obtain a target control quantity.
8. The encoder feedback-based motor drive direction correction method of claim 7, wherein, The current direction error is input into the selected local controller configured with the controller parameter combination to perform control calculation to obtain an initial control amount, and the initial control amount is weighted and fused in combination with the modal probability vector to obtain a target control amount, including: calculating a current direction error according to a reference direction input and a direction angle component in the direction deviation feature vector; inputting the current direction error into the selected local controller configured with the controller parameter combination to perform proportional control, integral control and differential control calculation to obtain a basic control parameter; performing gain adjustment on integral and differential components in the basic control parameter according to the motion mode identifier to obtain an initial control amount; performing probability weighted calculation on the initial control amount based on each modal probability value in the modal probability vector to obtain a target control amount.
9. The encoder feedback-based motor drive direction correction method of claim 8, wherein, The target control amount is converted into a direction correction signal of a motor driver, including: constructing a time-varying sliding mode surface function based on the current direction error and the direction error change rate; calculating an equivalent control component, a switching control component and an adaptive control component according to the time-varying sliding mode surface function; superimposing the target control amount with the equivalent control component, the switching control component and the adaptive control component to obtain a target control signal; inputting the target control signal into a space vector pulse width modulation (SVPWM) to perform three-phase voltage synthesis and PWM waveform generation, and setting a switching frequency and a dead time parameter to output to a motor driver of the first driving wheel and the second driving wheel to obtain a direction correction signal.
10. An encoder feedback based motor drive direction correction apparatus, characterized by, A motor driving direction correction method based on encoder feedback is provided, including: a collection module configured to collect first angle data of a first driving wheel and second angle data of a second driving wheel; a decomposition module configured to calculate a 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 a motion mode feature; a calculation module configured to determine a motion mode identifier according to the motion mode feature and select a corresponding local controller to calculate a target control amount; a conversion module configured to convert the target control amount into a direction correction signal of a motor driver.
Citation Information
Patent Citations
PID (Proportion Integration Differentiation) control-based tracked robot automatic deviation correction method and system
CN118182523A
Steering control method and equipment for distributed wheel set independent drive steering drive-by-wire chassis
CN120246079A
Somatosensory driving control method and system of scooter
CN120481693A
Cascade PID (Proportion Integration Differentiation)-based double-wheel balance car system
CN120491679A
Method and apparatus for tuning compensation parameters
US20020156541A1
Cited By
Pedestrian positioning method and system based on building structured information assistance
CN121346839A
Power distribution network high-resistance fault identification method and device and nonvolatile storage medium
CN121385540A