Motor driving direction adjusting method and system based on attitude sensor

By employing a dynamic weighted quaternion complementary filtering algorithm and a space vector modulation strategy, the problems of decreased attitude calculation accuracy and insufficient rider intention prediction in traditional vehicle control systems are solved, enabling accurate adjustment of the motor drive direction and improving vehicle stability and ride comfort.

CN121004901AActive Publication Date: 2025-11-25深圳市信诚未来科技有限公司
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202511347060.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-19
Publication Date
2025-11-25
Estimated Expiration
2045-09-19

AI Technical Summary

Technical Problem

Traditional vehicle control systems cannot dynamically adjust the fusion ratio of gyroscopes and accelerometers according to changes in vehicle motion, resulting in decreased attitude calculation accuracy, affecting the accuracy of control decisions, and lacking the ability to predict the rider's control intentions, leading to low accuracy in motor drive direction adjustment.

Method used

A dynamic weighted quaternion complementary filtering algorithm is used to calculate the attitude. The motor torque command is generated by combining the attitude angle data. The smooth adjustment of the motor drive direction is achieved by using a space vector modulation strategy and S-curve function transition processing.

Benefits of technology

It improves the accuracy and stability of posture angle measurement, accurately predicts the rider's control intentions, avoids mode misjudgment and frequent switching, and improves the smoothness of vehicle operation and riding comfort.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121004901A_ABST
    Figure CN121004901A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of motor driving, and discloses a motor driving direction adjusting method and system based on an attitude sensor, and the method comprises the steps: carrying out the motion state analysis of a target vehicle, and obtaining a target operation mode; calculating a zero vector distribution proportion and a vector switching sequence according to the target operation mode; generating a first motor torque instruction and a second motor torque instruction according to the attitude angle data of the target vehicle; and when it is detected that the target operation mode is switched, smooth transition processing is carried out on the zero vector distribution proportion, the vector switching sequence, the first motor torque instruction and the second motor torque instruction, and a PWM control signal is output. The control intention of a rider can be accurately predicted, mode misjudgment and frequent switching are effectively avoided, reliability and continuity of operation mode recognition are ensured, parameter sudden change impact during mode switching is effectively eliminated, and vehicle operation stability and riding comfort are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of motor driving, and in particular to a motor driving direction adjusting method and system based on a posture sensor. BACKGROUND

[0002] The conventional vehicle control system cannot dynamically adjust the fusion proportion of the gyroscope and the accelerometer according to the change of the vehicle motion state, resulting in a decrease in the attitude calculation accuracy when there is linear acceleration interference, and affecting the control decision accuracy. At the same time, the conventional pattern recognition method lacks the prediction ability of the rider's control intention, and only performs simple threshold judgment based on the current attitude state, which is easy to produce frequent switching near the mode boundary, and cannot accurately distinguish the real intention of the rider and the external environmental interference, thereby causing low accuracy of the motor driving direction adjustment. SUMMARY

[0003] The present application provides a motor driving direction adjusting method and system based on a posture sensor, which can accurately predict the control intention of the rider, effectively avoid mode misjudgment and frequent switching, ensure the reliability and continuity of the operation mode recognition, effectively eliminate the parameter mutation impact when switching the mode, and improve the stability and ride comfort of the vehicle operation.

[0004] The first aspect of the present application provides a motor driving direction adjusting method based on a posture sensor, which comprises: analyzing the motion state of a target vehicle to obtain a target operation mode; calculating a zero vector distribution proportion and a vector switching sequence according to the target operation mode; generating a first motor torque instruction and a second motor torque instruction according to the attitude angle data of the target vehicle; when detecting that the target operation mode switches, performing smooth transition processing on the zero vector distribution proportion, the vector switching sequence, the first motor torque instruction and the second motor torque instruction, and outputting a PWM control signal.

[0005] In the first implementation manner of the first aspect, the motion state of the target vehicle is analyzed to obtain the target operation mode, which comprises: calculating the vector amplitude of the three-axis acceleration component of the target vehicle to obtain the total acceleration amplitude, and calculating the weight coefficient based on the deviation amount of the total acceleration amplitude and the gravitational acceleration; inputting the three-axis angular velocity component of the target vehicle into a quaternion differential equation to perform gyroscope attitude calculation, obtaining a gyroscope quaternion, and simultaneously performing gravity vector correction on the three-axis acceleration component to obtain an accelerometer quaternion; weighting and fusing the gyroscope quaternion and the accelerometer quaternion based on the weight coefficients to obtain a fused attitude quaternion; performing Euler angle conversion on the fused attitude quaternion to obtain attitude angle data; performing motion state analysis based on the attitude angle data to obtain a target running mode.

[0006] In combination with the first aspect, in a second implementation manner of the first aspect of the application, the motion state analysis based on the attitude angle data to obtain a target running mode comprises: calculating an attitude change rate based on the attitude angle data, and calculating a motion intensity based on the attitude change rate; calculating a confidence degree of a current motion state according to a deviation of the motion intensity from a preset threshold, and determining whether a stable condition is met based on the confidence degree; when the confidence degree meets the stable condition, performing safety constraint verification on a current speed of the target vehicle, a battery power and a road inclination to obtain the target running mode, the stable condition being a static balance mode, a dynamic cruise mode or an agile steering mode.

[0007] In combination with the first aspect, in a third implementation manner of the first aspect of the application, the calculation of the zero vector distribution proportion and the vector switching sequence according to the target running mode comprises: selecting a corresponding space vector modulation strategy according to the target running mode, the space vector modulation strategy being a seven-segment type when the target running mode is a static balance mode, a five-segment type when the target running mode is a dynamic cruise mode, and a three-segment type when the target running mode is an agile steering mode; performing voltage vector action time calculation on a vector amplitude and a vector angle of a reference voltage based on the space vector modulation strategy to obtain a zero vector distribution proportion; performing vector sequence combination according to the space vector modulation strategy and the zero vector distribution proportion to obtain a vector switching sequence.

[0008] In combination with the first aspect, in a fourth implementation manner of the first aspect of the application, the voltage vector action time calculation on the vector amplitude and the vector angle of the reference voltage based on the space vector modulation strategy to obtain the zero vector distribution proportion comprises: performing sine function calculation on the vector amplitude and the vector angle of the reference voltage respectively to obtain a first vector action time and a second vector action time; performing zero vector total time calculation based on a time difference between the first vector action time and the second vector action time and a sampling period to obtain a total zero vector time; The total zero vector time is proportionally allocated according to a golden section ratio based on the number of segments of the space vector modulation strategy, to obtain a pre-zero vector time and a post-zero vector time, and a zero vector allocation ratio is calculated based on the pre-zero vector time and the post-zero vector time.

[0009] With reference to the first aspect, in a fifth implementation form of the first aspect of the present application, the generating the first motor torque instruction and the second motor torque instruction according to the attitude angle data of the target vehicle comprises: performing front-rear driving torque calculation based on the pitch angle in the attitude angle data to obtain a front-rear direction driving torque instruction; performing differential torque calculation based on the roll angle in the attitude angle data and the current speed of the target vehicle to obtain left-right differential torque; performing double-motor torque allocation according to the front-rear direction driving torque instruction and the left-right differential torque to obtain the first motor torque instruction and the second motor torque instruction.

[0010] With reference to the first aspect, in a sixth implementation form of the first aspect of the present application, when the switching of the target operating mode is detected, the zero vector allocation ratio, the vector switching sequence, the first motor torque instruction and the second motor torque instruction are subjected to smooth transition processing, and a PWM control signal is output, comprising: when the switching of the target operating mode is detected, an S-shaped transition function is constructed based on the current time and a transition rate parameter, and a pre-switching phase of a preset time length is started; the zero vector allocation ratio and the vector switching sequence are pre-adjusted in the pre-switching phase to obtain intermediate transition parameters; the intermediate transition parameters, the first motor torque instruction and the second motor torque instruction are subjected to smooth processing based on the S-shaped transition function to obtain mode conversion parameters; a PWM control signal for driving the target vehicle is generated based on the mode conversion parameters.

[0011] With reference to the first aspect, in a seventh implementation form of the first aspect of the present application, the smooth processing of the intermediate transition parameters, the first motor torque instruction and the second motor torque instruction based on the S-shaped transition function to obtain mode conversion parameters comprises: the S-shaped transition function is calculated based on the time difference between the current time and the switching start time to obtain an S-shaped transition factor; the intermediate transition parameters are subjected to linear interpolation based on the S-shaped transition factor to obtain a real-time transition zero vector allocation ratio and a real-time transition vector switching sequence; linearly interpolating the first motor torque instruction and the second motor torque instruction to obtain a transition torque instruction; monitoring a standard deviation of an attitude angle in the process of executing the real-time transition zero vector distribution ratio, the real-time transition vector switching sequence and the transition torque instruction, and confirming that the transition is completed when the standard deviation of the attitude angle meets a preset stable threshold condition to obtain a mode conversion parameter.

[0012] In combination with the first aspect, in an eighth implementation manner of the first aspect of the application, the generating of the PWM control signal for driving the target vehicle based on the mode conversion parameter comprises: calculating PWM timing parameters of the on-time and off-time of each switching device based on the mode conversion parameter; performing a triangular wave comparison based on the PWM timing parameters and a preset carrier frequency to obtain a first motor PWM waveform and a second motor PWM waveform; performing task scheduling and timing synchronization on the first motor PWM waveform and the second motor PWM waveform to obtain a synchronous PWM control instruction; transmitting the synchronous PWM control instruction to a dual-motor driver of the target vehicle through a CAN bus to obtain a PWM control signal for driving the target vehicle to realize attitude control and direction adjustment.

[0013] The second aspect of the application provides a motor driving direction adjustment system based on an attitude sensor, which comprises: a motion state analysis module for performing motion state analysis on a target vehicle to obtain a target running mode; a calculation module for calculating a zero vector distribution ratio and a vector switching sequence according to the target running mode; a generation module for generating a first motor torque instruction and a second motor torque instruction according to attitude angle data of the target vehicle; an output module for performing smooth transition processing on the zero vector distribution ratio, the vector switching sequence, the first motor torque instruction and the second motor torque instruction when detecting that the target running mode is switched, and outputting a PWM control signal.

[0014] Compared with the prior art, the application has the following beneficial effects: the dynamic weight quaternion complementary filtering algorithm is adopted, the fusion weight can be adjusted in real time according to the deviation degree of the total acceleration amplitude and the gravitational acceleration, the influence of linear acceleration interference on attitude solution is effectively inhibited, and the accuracy and stability of attitude angle measurement are improved. The control intention of the rider can be accurately predicted, mode misjudgment and frequent switching are effectively avoided, and the reliability and continuity of the running mode recognition are ensured. A special space vector modulation strategy library is designed for different running modes, the torque ripple is minimized when static balance, the switching loss is optimized when dynamic cruising, and the response speed is improved when agile steering. The direct mapping relationship between the attitude angle and the motor torque instruction is established, the control response time is shortened, and the steering sensitivity is intelligently adjusted through the speed adaptive differential torque distribution model. The parameter transition strategy of the S-shaped function is adopted, the parameter mutation impact during mode switching is effectively eliminated, and the smoothness and ride comfort of the vehicle running are improved. Precise double-motor coordinated control is realized through high-frequency PWM driving and CAN bus communication, and the running reliability and safety of the whole target vehicle are ensured. BRIEF DESCRIPTION OF DRAWINGS

[0015] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor on the basis of these drawings.

[0016] The structures, proportions, sizes, etc. shown in the drawings of the present specification are only used to cooperate with the content disclosed in the present specification, to enable those skilled in the art to understand and read, and are not used to limit the defined conditions under which the present application can be implemented, so they do not have technical significance. Any modification of structure, change of proportion relationship or adjustment of size, without affecting the effects and purposes that the present application can produce, should still fall within the scope of the technical content disclosed by the present application.

[0017] Figure 1 is a flowchart of the motor driving direction adjustment method based on the attitude sensor provided by the embodiments of the present application; Figure 2 is a structural schematic block diagram of the motor driving direction adjustment system based on the attitude sensor provided by the embodiments of the present application. DETAILED DESCRIPTION

[0018] With reference to the accompanying drawings, the technical solutions in the embodiments of the present application will be described clearly and completely. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all the other embodiments obtained by those ordinarily skilled in the art without creative effort belong to the scope of the present application.

[0019] The flowcharts shown in the drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor are they necessarily executed in the described order. For example, some operations / steps can be further decomposed, combined or partially merged, so the actual execution order can be changed according to the actual situation.

[0020] It should also be understood that the terms used in the present application are only for the purpose of describing specific embodiments and are not intended to limit the present application. As used in the present application and the appended claims, unless otherwise clearly indicated by the context, the singular forms "a", "an" and "the" are intended to include the plural forms.

[0021] It should be further understood that the term "and / or" used in the present application and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes these combinations. Please refer to Figure 1 One embodiment of the motor driving direction adjustment method based on the posture sensor in the embodiments of the present application includes: Step 101, performing motion state analysis on the target vehicle to obtain a target running mode; Specifically, the three-axis acceleration components of the target vehicle are collected in real time, and the acceleration information in three directions is integrated into a unified total acceleration amplitude through vector amplitude calculation, which is used to reflect the overall acceleration intensity of the vehicle. The deviation between the total acceleration amplitude and the standard gravity acceleration is used as a reference to judge whether the vehicle is in a stable state or has a large motion disturbance, and a weight coefficient for attitude fusion is constructed based on this. The weight coefficient can dynamically adjust the influence of the accelerometer and the gyroscope in the attitude solution according to the actual motion state, so as to enhance the environmental adaptability and anti-disturbance ability of the system. The three-axis angular velocity components of the vehicle are input into the attitude solution module, and the gyroscope quaternion derived from the gyroscope data is obtained through the quaternion differential calculation process. The gyroscope quaternion reflects the short-term attitude change characteristics caused by the change of vehicle angular velocity. At the same time, the three-axis acceleration components are input into the gravity direction correction module, and the three-axis acceleration components are aligned with the gravity vector to eliminate the interference of non-gravity components, and the accelerometer-based attitude quaternion is constructed. The attitude quaternion mainly reflects the reference information of the long-term stable direction. Based on the weight coefficient, the gyroscope quaternion and the accelerometer quaternion are weighted and fused, so that the fast response of the gyroscope information and the long-term stability of the accelerometer information are complementary and fused to generate a fusion quaternion reflecting the current real attitude of the vehicle. The fused attitude quaternion is converted into a more intuitive Euler angle form, from which the pitch angle, roll angle and yaw angle and other attitude angle parameters are extracted. According to the instantaneous value, change rate and historical trend of the attitude angle, the current dynamic state of the vehicle is identified and evaluated to determine whether it is in different operating modes such as static balance, stable driving or rapid steering.

[0022] Step 102, calculating the zero vector distribution ratio and vector switching sequence according to the target operating mode; Specifically, according to the operation mode result, a space vector modulation strategy library is called, in which different modulation strategies are configured for different operation modes. When the target operation mode is determined to be a static balance mode, a seven-segment space vector modulation strategy with the smallest torque ripple is selected, which introduces two symmetrically distributed zero vectors before and after the modulation period to balance the flux disturbance. When the target operation mode is a dynamic cruise mode, a five-segment space vector modulation strategy is selected to simplify the switching frequency by canceling the last zero vector, thereby optimizing the driving efficiency. When the system identifies that the vehicle is in a sensitive steering mode, a three-segment modulation strategy with the optimal response speed is used, only the continuous effective voltage vector is reserved, and the dynamic response ability of the electromagnetic torque is maximized. After the modulation strategy is selected, the reference voltage vector data in the current voltage control loop is combined to analyze the reference voltage vector amplitude and vector angle in real time. Using the modulation period, voltage vector amplitude and DC bus voltage parameters, the duty time of each active voltage vector is calculated through the space vector decomposition relationship, and the time proportion of the zero vector in the whole modulation period is derived to obtain the zero vector allocation proportion. According to the selected modulation strategy type and the known zero vector allocation proportion, the vector switching sequence is constructed according to the arrangement logic of the voltage vector in the modulation period, which includes the arrangement order of the effective voltage vector, the insertion position and the action time length of the zero vector.

[0023] Step 103, generating a first motor torque instruction and a second motor torque instruction according to the attitude angle data of the target vehicle; Specifically, the attitude angle data is analyzed in real time, and two key parameters, pitch angle and roll angle, are extracted. The current motion speed of the vehicle is combined as an important supplement to the differential adjustment. In the longitudinal driving direction, the pitch angle reflects the trend and degree of the vehicle's forward and backward inclination. The pitch angle value and its change rate are used as input variables to construct a torque modulation model based on proportional, differential and integral adjustment. The driving torque command in the front and rear directions is output, reflecting the current vehicle's demand for acceleration or deceleration, and has a stability compensation function to avoid overshoot or delayed response in the inclined state. At the same time, to prevent control saturation caused by integral accumulation, an integral limiter mechanism is introduced to ensure the stability and safety of longitudinal control. In terms of lateral differential control, according to the left and right inclination state reflected by the roll angle change, the steering sensitivity is adjusted in combination with the actual driving speed of the vehicle. On this basis, the roll angle change rate is introduced as a dynamic response adjustment factor to construct a differential torque calculation model with speed adaptive characteristics. The differential torque calculation model dynamically adjusts the size of the differential torque according to the degree of turning, which can meet the high requirements for stable steering in low-speed state and adapt to the rapid response demand in high-speed driving process, improving the control sensitivity and safety boundary of the whole vehicle. The driving torque in the front and rear directions and the differential torque in the left and right directions are coupled and distributed. The total torque after synthesis is assigned to the left and right two motors in the form of one plus one minus. The first motor torque command is the sum of the driving torque and half the differential torque, and the second motor torque command is the driving torque minus half the differential torque, realizing the collaborative control of the dual-motor in different road conditions and attitudes.

[0024] Step 104, when the target operating mode is detected to switch, the zero vector is allocated proportionally, the vector switching sequence, the first motor torque command and the second motor torque command are smoothly transitioned, and the PWM control signal is output.

[0025] Specifically, at the moment when the running mode is detected to switch from one state to another, the current time point is extracted, and a S-shaped transition function with the characteristics of gentle start, fast middle and slow end is constructed in combination with the preset transition rate parameter. The S-shaped transition function can realize the natural transition of the control parameter from the old value to the new value, and avoid the slope mutation in the conventional linear interpolation. At the same time, the pre-switching stage of the preset duration is started. In the pre-switching stage, the system will not directly modify the control instruction, but preliminarily readjust the key control parameters to be changed, including the zero vector allocation ratio and the vector switching sequence. With the parameter difference between the voltage modulation characteristics under the current running mode and the target mode, a set of intermediate transition parameters are generated. After the preliminary readjustment is completed, the S-shaped transition function is introduced as a weight factor into the smoothing processing calculation process. By functionally weighting and fusing the intermediate transition parameters, the first motor torque instruction and the second motor torque instruction on the time axis, all the key control parameters are gradually transitioned to the final state required by the target mode, ensuring the continuity of the whole switching process in the physical quantity space, avoiding the excitation jump in the dynamic response process, and effectively eliminating the torque impact caused by the control parameter mutation at the motor output level. The mode conversion parameters after smoothing are input into the PWM control signal generation module, and the voltage vector action time, switching timing and duty cycle data are recalculated according to the updated vector modulation strategy and torque demand, and are converted into two-way PWM control signals corresponding to the left and right drive motors.

[0026] In a specific embodiment, the process of step 101 can specifically include the following steps: The three-axis acceleration components of the target vehicle are calculated to obtain the total acceleration amplitude, and a weight coefficient is calculated based on the deviation of the total acceleration amplitude from the gravitational acceleration; The three-axis angular velocity components of the target vehicle are input into a quaternion differential equation to obtain a gyroscope quaternion, and the three-axis acceleration components are corrected by a gravity vector to obtain an accelerometer quaternion; The gyroscope quaternion and the accelerometer quaternion are weighted and fused based on the weight coefficient to obtain a fused attitude quaternion; The fused attitude quaternion is converted into Euler angle data; Motion state analysis is performed based on the attitude angle data to obtain a target running mode.

[0027] Specifically, the three-axis acceleration components collected by the target vehicle are processed in real time. The acceleration data in X, Y and Z directions are input as vectors, and are uniformly converted into a total acceleration scalar value through vector amplitude calculation, to reflect the comprehensive acceleration size of the current vehicle. The total acceleration value should be close to the standard gravity acceleration value in the vehicle static state. The deviation between the total acceleration value and the gravity acceleration is used as a criterion for the quality of the attitude data. When the deviation is small, it indicates that the vehicle is in a stable state, and the collected acceleration is mainly the gravity component, with high reliability. Conversely, if the deviation increases, the vehicle is affected by linear acceleration, jolt vibration or external interference. On this basis, a dynamically adjusted weight coefficient is constructed. The three-axis angular velocity components are input into the attitude solution module, and the angular velocity is integrated based on the quaternion differential equation to construct a time-continuous gyroscope quaternion sequence. The gyroscope quaternion has a very high dynamic response performance in a short time scale, and can capture rapid rotation or sudden attitude change trends. However, it has a time accumulation error problem. Therefore, the acceleration component is also input into the gravity vector correction module. By identifying the difference between the current acceleration vector direction in space and the standard gravity direction, a set of accelerometer quaternions reflecting the stability of the attitude direction is constructed as the basis for suppressing the long-term drift of the gyroscope path. The above two quaternions represent attitude estimation paths with different characteristics. The gyroscope path responds quickly but is prone to drift, while the accelerometer path is stable but is easily affected by motion interference. Therefore, the weight coefficient is used as a fusion adjustment factor to synthesize the gyroscope quaternion and the accelerometer quaternion in a weighted manner, dynamically adjusting the weight proportion of each. In the stable state of the vehicle, the proportion of the accelerometer is increased to correct the gyroscope drift, and in the severe motion state of the vehicle, the proportion of the gyroscope is increased to enhance the dynamic tracking capability, forming a fused attitude quaternion. The fused quaternion is subjected to an Euler angle conversion process, and three attitude angle parameters with physical meaning, i.e. pitch angle, roll angle and yaw angle, are extracted, with sufficient resolution to ensure the perceptibility of small attitude changes. Based on the attitude angle data, the motion state is analyzed, and a comprehensive motion intensity evaluation function is constructed by analyzing the instantaneous change rate, change amplitude and relative stability of the pitch angle and roll angle, to measure whether the vehicle is in a static, stable moving or dynamic steering state. When the evaluation result shows that the attitude change intensity is very small and the stability is good, it is determined to be in a static balance mode. When the attitude angle changes at a moderate speed and has a certain continuity, it is determined to be in a dynamic cruising mode. When the attitude angle fluctuates sharply and the change amplitude and frequency increase, it is determined to be in an agile steering mode.

[0028] In a specific embodiment, the process of performing motion state analysis based on attitude angle data to obtain the target running mode can specifically include the following steps: Calculate the attitude change rate based on the attitude angle data, and calculate the motion intensity based on the attitude change rate; The confidence of the current motion state is calculated according to a deviation of the motion intensity from a preset threshold value, and whether the stable condition is met is determined based on the confidence; When the confidence meets the stable condition, the current speed of the target vehicle, the battery power and the road inclination are verified for safety constraints, and the target operation mode is obtained, and the stable condition is met, which is a static balance mode, a dynamic cruise mode or an agile steering mode.

[0029] Specifically, the pitch angle, roll angle and yaw angle collected in real time are continuously recorded at the attitude perception layer, and the rate of change thereof is extracted by point-by-point difference operation on the time sequence dimension, i.e., the pitch angle velocity, roll angle velocity and yaw angle velocity are obtained. The attitude change rates in the three directions are fused according to a preset weight distribution model, wherein the pitch angle velocity is given a higher weight as the main determining factor of the front-back stability of the vehicle, the roll angle velocity focuses on evaluating the lateral stability and tilting trend of the vehicle, and the yaw angle velocity is used to reflect the intensity of the turning or rotating state of the vehicle. The attitude motion intensity index is obtained by weighted calculation, which is used to comprehensively describe the overall attitude dynamic activity level of the vehicle. The real-time motion intensity value is subjected to difference operation with the target intensity threshold set according to historical experimental data or field road test results, to obtain the amplitude of the motion state deviating from the normal stable range, and a confidence function of the current motion state is constructed accordingly. The confidence function adopts a nonlinear decreasing structure, outputs a high confidence when the motion intensity is close to the threshold, and decreases when the motion intensity deviates from the threshold, especially in the case of severe attitude change, thereby enhancing the discrimination ability of stable state recognition. The higher the confidence, the closer the current attitude state to the typical stable operating condition, and whether the stable condition is met is determined accordingly. When the confidence exceeds the set threshold, it is determined that the current vehicle attitude change is stable, and the basic condition for recognizing the operating mode is met, otherwise the current operating mode remains unchanged, and a mode switching delay buffer mechanism is started to avoid frequent switching or control shock caused by misjudgment. On the premise that the attitude state has reached stability, the vehicle operating environment and state parameters are comprehensively checked through multiple safety constraint conditions. The actual running speed data of the current vehicle is read to verify whether it is within the allowed range, and the speed is controlled in the interval of 0 to 25 kilometers per hour to avoid inappropriate mode switching in high-speed state; the current remaining battery capacity is detected and compared with the minimum safe capacity threshold, and when the battery capacity is higher than the safe lower limit, for example, more than 20%, the switching to the cruise or steering mode with higher power demand is allowed; the current attitude angle data of the vehicle is compared with the road inclination information provided by the map or terrain perception module to confirm whether the terrain slope is less than the set safety upper limit, not more than 15 degrees, to prevent the vehicle from entering a high-risk operating state on a large slope. When the above attitude stability determination and three safety conditions are all met, the current operating mode of the vehicle is finally confirmed in combination with the numerical range of the motion intensity, if the motion intensity is very low and the attitude angle changes slowly, it is determined as the static equilibrium mode, which is suitable for parking, waiting and other states; if the motion intensity is in the medium range and the change trend is stable, it is determined as the dynamic cruise mode, indicating that the vehicle is in the normal uniform forward state; if the motion intensity is high and accompanied by severe attitude fluctuation, and all safety conditions are still met, it is identified as the agile steering mode, indicating that the vehicle is currently in a fast turning or complex maneuvering process.

[0030] In a specific embodiment, the process of performing step 102 can specifically include the following steps: According to the target operation mode, a corresponding space vector modulation strategy is selected, when the target operation mode is static balance mode, the space vector modulation strategy is seven-segment type, when the target operation mode is dynamic cruise mode, the space vector modulation strategy is five-segment type, when the target operation mode is agile steering mode, the space vector modulation strategy is three-segment type; Based on the space vector modulation strategy, the vector amplitude and the vector angle of the reference voltage are calculated to obtain the zero vector allocation proportion; According to the space vector modulation strategy and the zero vector allocation proportion, the vector sequence combination is performed to obtain the vector switching sequence.

[0031] Specifically, combined with the front-end posture perception and motion state recognition results, the running mode of the current target vehicle is obtained, including static balance mode, dynamic cruise mode or agile steering mode, each mode corresponds to different control targets and performance priorities. The mapping relationship between the running mode and the space vector modulation strategy is established in the control strategy selection stage. In the static balance mode, the control focus is to improve the smoothness of the electromagnetic torque output and maximize the suppression of torque ripple, in this mode, the seven-segment space vector pulse width modulation strategy is preferentially selected, which realizes flexible filling of the effective vector action time by inserting two symmetrically distributed zero vector segments in the complete modulation period, effectively alleviating the output current jump phenomenon and improving the low-speed stability; when the target running mode is dynamic cruise mode, the control target is shifted to efficiency improvement and power consumption optimization, the five-segment space vector modulation strategy is adopted, the switching action frequency is reduced by reducing one zero vector segment, the switching loss is reduced on the basis of ensuring waveform integrity, and the system energy efficiency is improved; when the vehicle is in agile steering mode, the motor is required to have the fastest response speed and the strongest torque change ability, therefore the zero vector segment is completely abandoned, only the continuous effective voltage vector is reserved, the three-segment modulation strategy is adopted, the gapless effective vector switching path is formed, thereby realizing fast direction control and high-frequency dynamic response. After determining the modulation strategy, the voltage vector action time calculation is performed combined with the amplitude and angle information of the reference voltage vector, the target voltage vector is projected and decomposed on the basis of the six basic voltage vectors, and the action time of each is calculated according to the current modulation period and bus voltage conditions. In the seven-segment and five-segment strategies, the total action time of the zero vector is calculated based on the surplus of the voltage vector action time, and it is reasonably distributed between the two zero vector segments to form a vector action time set that can be directly input into the PWM modulation module, and the proportion value of the modulation period occupied by the zero vector is derived. In the three-segment strategy, since the zero vector does not participate in the modulation process at all, the zero vector distribution proportion is defined as zero, and all modulation periods are occupied by effective vectors to realize the maximum output dynamic performance. The vector sequence combination is performed according to the space vector modulation strategy and the zero vector distribution proportion. According to the selected modulation strategy and the current zero vector configuration mode, the vector switching sequence is constructed, which is used to control the switching path of the voltage space vector in the modulation period. In the seven-segment strategy, the vector sequence adopts the symmetric structure of "zero vector - first effective vector - second effective vector - first effective vector - zero vector", which ensures the symmetry of the current waveform and minimizes the harmonics; in the five-segment strategy, the post-zero vector is omitted, so that the sequence structure becomes "zero vector - first effective vector - second effective vector - first effective vector", so as to simplify the inverter switching process and improve the efficiency; in the three-segment strategy, only the continuous switching structure of the three effective vectors is reserved, without any interruption, so as to complete the voltage vector direction rotation at the fastest speed and drive the motor to realize the transient steering response.

[0032] In a specific embodiment, the process of performing step 103 based on the space vector modulation strategy to calculate the vector amplitude and vector angle of the reference voltage to obtain the zero vector allocation ratio can specifically include the following steps: respectively, the vector amplitude and vector angle of the reference voltage are calculated by the sine function to obtain the first vector action time and the second vector action time; Based on the time difference between the first vector action time and the second vector action time and the sampling period, the total zero vector time is calculated to obtain the total zero vector time; According to the number of segments of the space vector modulation strategy, the total zero vector time is allocated by the golden section ratio to obtain the pre-zero vector time and the post-zero vector time, and the zero vector allocation ratio is calculated based on the pre-zero vector time and the post-zero vector time.

[0033] Specifically, the vector amplitude and space angle of the reference voltage vector are calculated by the sine function, the reference vector is decomposed between the two basic voltage vectors closest to it, the action time of the first effective vector and the second effective vector in the current modulation period is determined, the calculation process depends on the vector topology structure and vector angle configuration of the six sectors, the corresponding adjacent vector number is determined according to the region of the vector angle, and the reference vector amplitude is mapped to the time component of the two basic vectors by using the trigonometric function relationship, to obtain the first vector action time and the second vector action time. The difference between the first vector action time and the second vector action time and the entire PWM sampling period is calculated, that is, the sum of the first vector action time and the second vector action time is subtracted from the modulation period, to obtain the time period in the current period which is not occupied by the effective vector, that is, the zero vector available time, that is, the total zero vector time. In order to realize the optimal torque fluctuation suppression and current harmonic minimization, a zero vector allocation strategy based on the mathematical golden section principle is introduced, the total zero vector time is divided into pre-zero vector time and post-zero vector time in a ratio close to 0.618 and 0.382, and the shorter zero vector time is placed at the beginning of the modulation period, and the longer part is placed at the end of the period. When the system is switched to the five-segment modulation strategy in the dynamic cruise mode, the only existing zero vector action time is allocated according to the same principle, the post-zero vector is omitted in the dynamic cruise mode, and all the zero vector time is placed at the beginning of the period; while in the agile steering mode, the zero vector time is zero, and the calculation process is automatically skipped. According to the relative length of the pre-zero vector time and the post-zero vector time, the zero vector allocation ratio is calculated, which is defined as the percentage of the pre-zero vector time in the total zero vector time, as a parameter input of the modulation strategy optimizer to participate in the dynamic strategy selection and disturbance suppression strategy correction.

[0034] In a specific embodiment, the process of performing step 103 can specifically include the following steps: The front and rear driving torque is calculated based on the pitch angle in the attitude angle data, and a front and rear direction driving torque instruction is obtained; The differential torque is calculated based on the roll angle in the attitude angle data and the current speed of the target vehicle, and a left and right differential torque is obtained; The double-motor torque distribution is performed according to the front and rear direction driving torque instruction and the left and right differential torque, and a first motor torque instruction and a second motor torque instruction are obtained.

[0035] Specifically, two key parameters, pitch angle and roll angle, are extracted from the attitude solution, and combined with the current running speed of the vehicle to construct a complete attitude-torque mapping path. In the front-back direction drive control, the pitch angle is a direct representation of the vehicle's forward or backward tilting state, reflecting whether the current target vehicle is accelerating, decelerating or in static balance, so an enhanced torque adjustment model is constructed based on the pitch angle. The model considers the instantaneous deviation of the pitch angle, and introduces proportional, derivative and integral adjustment mechanisms in combination with the change trend and duration of the instantaneous deviation. The proportional term directly reflects the influence of the current attitude angle deviation on the target output torque, the derivative term is used to perceive the attitude change rate to provide responsive compensation during dynamic acceleration or deceleration, and the integral term is used to eliminate the accumulation of steady-state error caused by long-term attitude deviation, thus constructing a set of longitudinal drive torque instructions that can adapt to different terrain changes and load disturbances. The numerical range is limited and constrained according to the mass and inertia characteristics of the vehicle to prevent sudden changes in the drive system caused by excessive instructions. At the same time, a differential torque generation mechanism is constructed for the lateral differential control path, with the roll angle and the current vehicle speed as the core inputs. The roll angle directly reflects the lateral tilting state of the vehicle, and the current speed is used to modify the strength and sensitivity of the required torque during steering. When the vehicle is traveling at low speed, the change in roll angle mainly reflects the driver's balance adjustment behavior, so the output of the differential torque needs to be kept low to avoid interfering with the control intention. At high speed, a slight change in roll angle will correspond to a sharp directional deflection requirement, so a speed-based gain adjustment function is introduced when calculating the differential torque to dynamically improve the differential response capability at high speed. The rate of change of the roll angle is introduced as a supplementary variable into the differential torque calculation model, which adjusts the slope of the output torque by perceiving the sharpness of the steering action, so that the vehicle has greater differential adjustment capability during sharp turns, and maintains a stable output during slow turns or slight tilting, ensuring the stability and safety of the driving experience during steering. According to the front-back direction drive torque instructions and the left-right differential torque, the longitudinal driving force and lateral differential adjustment are reasonably projected into the left and right drive motors to achieve collaborative control. In the torque distribution logic, the front-back direction drive torque instructions are used as the basic driving force of the two motors, and the left-right differential torque is applied to the two drive sides in a symmetrical manner, so that the left motor torque is equal to the front drive torque plus half the differential torque, and the right motor torque is equal to the front drive torque minus half the differential torque, thereby ensuring that the vehicle's longitudinal propulsion demand is maintained while forming an effective steering torque difference, driving the vehicle to achieve smooth and precise directional control, generating the first motor torque instruction and the second motor torque instruction.

[0036] In a specific embodiment, the process of performing step 104 can specifically include the following steps: When it is detected that the target operating mode is switched, an S-shaped transition function is constructed based on the current time and a transition rate parameter, and a pre-switching phase of a preset time length is started; The zero vector allocation proportion and the vector switching sequence are pre-adjusted in the pre-switching phase to obtain intermediate transition parameters; The intermediate transition parameters, the first motor torque instruction and the second motor torque instruction are smoothed based on the S-shaped transition function to obtain mode conversion parameters; The PWM control signal for driving the target vehicle is generated based on the mode conversion parameters.

[0037] Specifically, when the running mode of the current target vehicle is detected to change, a gradual switching control mechanism based on time continuity and function smoothness is started to ensure that the control parameters do not change abruptly during the transition from the old mode to the new mode, thereby avoiding abnormal phenomena such as motor output torque jitter, current pulse overshoot or attitude fluctuation deterioration. The time stamp of the current detected mode switching is recorded, and the transition rate parameter in the control configuration is called, which is obtained by actual measurement or optimization model, reflecting the acceptable parameter change speed and transition time range of the control system. Based on the current time and the transition rate, a time-symmetric, curvature-continuous and derivative-smooth S-shaped transition function is constructed. The S-shaped transition function has the mathematical property of changing slowly at the starting and ending stages and accelerating at the intermediate stage, which is suitable for describing the whole process of the gradual change of physical quantities from the initial state to the target state, and is suitable for soft switching operation of key parameters such as voltage modulation strategy and torque output command in motor control system. A preset duration of pre-switching stage is started to perform parameter structure analysis and intermediate transition state generation. In this stage, the system will not directly adjust the output control signal, but will analyze and slowly change the zero vector allocation proportion and vector switching sequence parameters in the current running mode, gradually approaching the control parameters corresponding to the target mode, but avoiding one-time jump to the new parameter value. For example, when the static balance mode is switched to the dynamic cruise mode, the zero vector time is transitioned from the symmetric seven-segment structure to the simplified five-segment structure, and the vector switching sequence is changed from the symmetric sequence containing front and rear zero vectors to the asymmetric structure removing the last zero vector. Therefore, gradual mapping operation is performed on these two parameters in the pre-switching stage to generate a set of intermediate transition parameters. When the pre-switching stage is completed and enters the formal transition execution stage, the S-shaped function is used as the weighting adjustment basis for time domain smoothing of the intermediate transition parameters, the first motor torque command and the second motor torque command in sequence. The function value of the S-shaped function corresponding to the current time is used as the fusion factor for the continuous weighted fusion between the old parameter and the target parameter, so that each control parameter gradually transitions to the new value according to the proportion of the S-shaped curve, effectively avoiding phenomena such as PWM duty cycle jump, current loop oscillation or motor vibration caused by torque command mutation or modulation parameter jump, thereby maintaining the dynamic continuity of the control system at the physical execution level. Especially in the process of executing attitude adjustment, speed switching or steering change, the smoothing mechanism can improve the ride comfort, reduce the power consumption fluctuation and prolong the life of the driver and motor. The updated torque command of the first motor and the second motor, the vector switching sequence and the zero vector allocation proportion are input into the space vector PWM control module, and the corresponding PWM control signal is generated at a fixed carrier frequency of 20 kHz.

[0038] In a specific embodiment, the execution step can specifically include the following steps: calculating the S-shaped transition function based on the time difference between the current time and the switching start time to obtain an S-shaped transition factor; linearly interpolating the intermediate transition parameter based on the S-shaped transition factor to obtain a real-time transition zero vector distribution ratio and a real-time transition vector switching sequence; linearly interpolating the first motor torque instruction and the second motor torque instruction to obtain a transition torque instruction; monitoring the attitude angle standard deviation in the execution of the real-time transition zero vector distribution ratio, the real-time transition vector switching sequence and the transition torque instruction, and confirming the completion of the transition when the attitude angle standard deviation meets the preset stability threshold condition to obtain the mode conversion parameter.

[0039] Specifically, the actual time marked by the current system clock is obtained, and the actual time is subtracted from the time when the mode switching officially starts to obtain a time offset of the current time point relative to the starting point of the switching. The time difference is input into an S-shaped function expression as an independent variable to calculate a corresponding transition function value, which is the current S-shaped transition factor and has a value range limited to 0 to 1 and presents a non-linear growth trend of fast in the middle and slow at both ends, thereby ensuring that the parameter changes in the transition starting and ending stages are more stable and effectively avoiding torque fluctuations or current distortion caused by an excessively steep parameter slope. The S-shaped transition factor is introduced into linear interpolation operation logic as an interpolation factor to perform real-time linear interpolation between modulation parameters corresponding to the original running mode (i.e., the starting zero vector distribution ratio and the starting vector switching sequence) and modulation parameters corresponding to the target running mode (i.e., the target zero vector distribution ratio and the target vector switching sequence). The numerical position of the current factor between 0 and 1 is used to determine the intermediate parameter value to be used at the current time, and real-time transition zero vector distribution ratios and real-time transition vector switching sequences are calculated. At the same time, the torque command values currently used by the first motor and the second motor are subjected to linear interpolation processing of the same dimension, and the torque control output generated in the original running mode and the torque output required in the target mode are used as the two endpoints of the interpolation, and a transition torque command is generated in real time under the action of the S-shaped transition factor, so that the two motors change coordinately during the switching process and continuously output a continuous and derivable torque signal in the entire transition interval. The attitude angle change trend of the target vehicle is continuously monitored during the transition execution process, and the standard deviation of the pitch angle and the roll angle is calculated in a sampling window to obtain an instantaneous fluctuation amplitude index of the attitude change. The standard deviation directly reflects whether the vehicle is in a dynamic instability or control disturbance state during the transition process. The calculated attitude angle standard deviation is compared with a preset stable threshold value. If the standard deviation value is always lower than the stable threshold value (such as 1.5 degrees) and remains for several consecutive sampling periods, it is confirmed that the current transition process has been completed stably, and there is no high-frequency attitude shock or control offset phenomenon. Accordingly, it is determined that the transition stage is terminated, and the real-time transition zero vector distribution ratio, the real-time transition vector switching sequence, and the transition torque command are converged as the formal control parameters in the new mode, thereby completing the closed-loop confirmation of the mode switching.

[0040] In a specific embodiment, the execution step of generating a PWM control signal for driving the target vehicle based on the mode conversion parameter can specifically include the following steps: calculating PWM timing parameters of the conduction time and the off time of each switching device based on the mode conversion parameter; performing a triangular wave comparison based on the PWM timing parameters and a preset carrier frequency to obtain a first motor PWM waveform and a second motor PWM waveform; performing task scheduling and timing synchronization on the first motor PWM waveform and the second motor PWM waveform to obtain a synchronous PWM control instruction; The synchronous PWM control instruction is transmitted to the double-motor driver of the target vehicle through the CAN bus to obtain the PWM control signal for driving the target vehicle to realize posture control and direction adjustment.

[0041] Specifically, the mode conversion parameters are mapped to the on and off control signals acting on the specific power switching devices through the PWM timing parameter calculation module. According to the current space vector modulation strategy structure, the effective voltage vector number is extracted, and combined with the zero vector insertion rule set by the target operating mode, the on time and off time of each switching device of the three-phase inverter bridge corresponding to each voltage vector acting time information contained in the mode conversion parameters are calculated to form a set of PWM timing parameters, which includes the starting time, ending time and duration of each voltage vector in a PWM cycle, and the phase displacement relationship between the three phases and the dead zone compensation processing requirements are considered to ensure that the conduction process avoids short circuit state and maximally suppresses electromagnetic interference and harmonic output. Based on the PWM timing parameters, a synchronous reference triangle wave is generated combined with the preset carrier frequency. The reference triangle wave linearly increases and decreases at a constant frequency to form a symmetrical sawtooth wave structure in the cycle, which is used to compare with the modulation level of the target voltage vector. When the modulation value of any phase is higher than the amplitude of the triangle wave at the current time, the phase outputs high level to drive the upper bridge arm to conduct; otherwise, it outputs low level to drive the lower bridge arm to conduct. Independent PWM comparison channels are established for the first motor and the second motor respectively, and the corresponding voltage modulation value curves are generated according to the acting time of their respective target modulation vectors, which are compared with the triangle wave in real time to obtain the first motor PWM waveform and the second motor PWM waveform respectively. To realize the synchronous control of the double-motor PWM waveform, a unified scheduling table is constructed in the scheduling module, and according to the starting time, action segment length and control priority of each PWM channel, the task-level scheduling strategy is executed to ensure that the PWM rising edge, falling edge and zero vector switching boundary of the first motor and the second motor are time-aligned, and at the same time, the timestamp mechanism is used to perform dynamic correction processing in each carrier cycle to adjust the offset between the two PWM channels in real time, and the waveform boundary is fine-tuned through the interpolation mechanism to obtain two sets of time-synchronized and modulation-logic-consistent PWM control instructions. The two sets of PWM control instructions processed by the time synchronization are packaged and encapsulated as CAN protocol frames, and transmitted to the double-motor driver of the target vehicle through the CAN bus interface according to the specified data structure and communication rate. A 1 Mbps high-speed CAN bus is used for data transmission, and each frame contains the conduction time slice, vector number and modulation state identification of all bridge arms of the two motors in the current PWM cycle, and is attached with control CRC and frame sequence identification to ensure the data integrity and the verifiability of the frame sequence. After receiving the synchronous PWM control instructions, the double-motor driver analyzes the PWM time period configuration corresponding to each bridge arm and directly applies it to the high-voltage side IGBT or MOSFET switching device in the internal drive module to generate the same modulation voltage waveform as the controller end, realizing high-precision drive control of the two motors.

[0042] The motor driving direction adjustment method based on the attitude sensor in the embodiment of the application is described above, and the motor driving direction adjustment system based on the attitude sensor in the embodiment of the application is described below, please refer to Figure 2 The motor driving direction adjustment system based on the attitude sensor in the embodiment of the application includes one embodiment of: The motion state analysis module 201 is configured to analyze the motion state of the target vehicle to obtain a target running mode. The calculation module 202 is configured to calculate a zero vector distribution ratio and a vector switching sequence according to the target running mode. The generation module 203 is configured to generate a first motor torque instruction and a second motor torque instruction according to the attitude angle data of the target vehicle. The output module 204 is configured to perform smooth transition processing on the zero vector distribution ratio, the vector switching sequence, the first motor torque instruction and the second motor torque instruction when detecting that the target running mode switches, and output a PWM control signal.

[0043] Through the cooperation of the above-mentioned various components, the dynamic weight quaternion complementary filtering algorithm is adopted, the fusion weight can be adjusted in real time according to the deviation degree of the total acceleration amplitude and the gravitational acceleration, the influence of linear acceleration interference on attitude solution is effectively suppressed, and the accuracy and stability of attitude angle measurement are improved. It can accurately predict the control intention of the rider, effectively avoid mode misjudgment and frequent switching, and ensure the reliability and continuity of the running mode recognition. A special space vector modulation strategy library is designed for different running modes, the torque ripple is minimized at static balance, the switching loss is optimized at dynamic cruising, and the response speed is improved at agile steering. A direct mapping relationship between the attitude angle and the motor torque instruction is established, the control response time is shortened, and the steering sensitivity is intelligently adjusted through a speed-adaptive differential torque distribution model. The parameter transition strategy of the S function is adopted, which effectively eliminates the parameter mutation impact at mode switching, and improves the smoothness and ride comfort of the vehicle. Precise double-motor coordinated control is realized through high-frequency PWM driving and CAN bus communication, and the running reliability and safety of the entire target vehicle are ensured.

[0044] 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 described here.

[0045] 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 an electronic 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.

[0046] The above-described embodiments are merely used to illustrate the technical solutions of the present application, rather than limit the same; even though the present application has been described in detail with reference to the foregoing embodiments, those ordinarily 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 of the technical features; and these modifications or replacements do not cause the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for adjusting the direction of a motor drive based on an attitude sensor, characterized in that, include: The motion state of the target vehicle is analyzed to obtain the target operating mode; Calculate the zero vector allocation ratio and vector switching sequence based on the target operating mode; The first motor torque command and the second motor torque command are generated based on the attitude angle data of the target vehicle. When a switch in the target operating mode is detected, a smooth transition is performed on the zero vector allocation ratio, the vector switching sequence, the first motor torque command, and the second motor torque command, and a PWM control signal is output.

2. The motor drive direction adjustment method based on an attitude sensor according to claim 1, characterized in that, The process of analyzing the motion state of the target vehicle to obtain the target operating mode includes: The vector amplitude of the three-axis acceleration components of the target vehicle is calculated to obtain the total acceleration amplitude, and the weighting coefficient is calculated based on the deviation between the total acceleration amplitude and the gravitational acceleration. The three-axis angular velocity components of the target vehicle are input into the quaternion differential equation to calculate the gyroscope attitude and obtain the gyroscope quaternion. At the same time, the three-axis acceleration components are corrected by gravity vector to obtain the accelerometer quaternion. The gyroscope quaternion and the accelerometer quaternion are weighted and fused based on the weighting coefficients to obtain the fused attitude quaternion. Perform Euler angle transformation on the fused attitude quaternion to obtain attitude angle data; Motion state analysis is performed based on the attitude angle data to obtain the target running mode.

3. The motor drive direction adjustment method based on an attitude sensor according to claim 2, characterized in that, The motion state analysis based on the attitude angle data to obtain the target running mode includes: The attitude change rate is calculated based on the attitude angle data, and the motion intensity is calculated based on the attitude change rate. The confidence level of the current motion state is calculated based on the deviation between the motion intensity and the preset threshold, and the stability condition is determined based on the confidence level. When the confidence level meets the stability condition, the current speed, battery level and road inclination of the target vehicle are verified by safety constraints to obtain the target operating mode. The stability condition is met as static balance mode, dynamic cruise mode or agile steering mode.

4. The motor drive direction adjustment method based on an attitude sensor according to claim 1, characterized in that, The step of calculating the zero vector allocation ratio and vector switching sequence according to the target operating mode includes: The corresponding space vector modulation strategy is selected according to the target operating mode. When the target operating mode is static balance mode, the space vector modulation strategy is seven-segment; when the target operating mode is dynamic cruise mode, the space vector modulation strategy is five-segment; and when the target operating mode is agile steering mode, the space vector modulation strategy is three-segment. Based on the space vector modulation strategy, the voltage vector action time is calculated for the vector amplitude and vector angle of the reference voltage to obtain the zero vector allocation ratio; Vector sequences are combined according to the space vector modulation strategy and the zero vector allocation ratio to obtain a vector switching sequence.

5. The motor drive direction adjustment method based on an attitude sensor according to claim 4, characterized in that, The step of calculating the voltage vector action time based on the space vector modulation strategy for the reference voltage vector amplitude and vector angle to obtain the zero vector allocation ratio includes: The vector amplitude and vector angle of the reference voltage are calculated using sine functions to obtain the first vector action time and the second vector action time. The total zero vector time is calculated based on the time difference between the first vector action time and the second vector action time and the sampling period; The total zero vector time is allocated according to the segment number characteristics of the space vector modulation strategy using a golden ratio to obtain the pre-zero vector time and the post-zero vector time, and the zero vector allocation ratio is calculated based on the pre-zero vector time and the post-zero vector time.

6. The motor drive direction adjustment method based on an attitude sensor according to claim 1, characterized in that, The step of generating the first motor torque command and the second motor torque command based on the attitude angle data of the target vehicle includes: Based on the pitch angle in the attitude angle data, the forward and backward drive torque is calculated to obtain the forward and backward drive torque command. The differential torque is calculated based on the roll angle in the attitude angle data and the current speed of the target vehicle to obtain the left and right differential torques. Based on the forward and backward driving torque command and the left and right differential torque, the torque of the two motors is distributed to obtain the first motor torque command and the second motor torque command.

7. The motor drive direction adjustment method based on an attitude sensor according to claim 1, characterized in that, When a switch in the target operating mode is detected, a smooth transition is performed on the zero vector allocation ratio, the vector switching sequence, the first motor torque command, and the second motor torque command, and a PWM control signal is output, including: When a switch in the target operating mode is detected, an S-shaped transition function is constructed based on the current time and transition rate parameters, and a pre-switching phase of a preset duration is initiated. During the pre-switching phase, the zero vector allocation ratio and the vector switching sequence are pre-adjusted to obtain intermediate transition parameters; Based on the S-shaped transition function, the intermediate transition parameters, the first motor torque command, and the second motor torque command are smoothed to obtain the mode conversion parameters; A PWM control signal for driving the target vehicle is generated based on the mode conversion parameters.

8. The motor drive direction adjustment method based on an attitude sensor according to claim 7, characterized in that, The process of smoothing the intermediate transition parameters, the first motor torque command, and the second motor torque command based on the S-shaped transition function to obtain mode conversion parameters includes: The S-shaped transition function is calculated based on the time difference between the current time and the start time of the switch, and the S-shaped transition factor is obtained. Based on the S-shaped transition factor, the intermediate transition parameters are linearly interpolated to obtain the real-time transition zero vector allocation ratio and the real-time transition vector switching sequence. Linear interpolation is performed on the first motor torque command and the second motor torque command to obtain the transition torque command; The attitude angle standard deviation is monitored during the execution of the real-time transition zero vector allocation ratio, the real-time transition vector switching sequence, and the transition torque command. When the attitude angle standard deviation meets the preset stability threshold condition, the transition is confirmed to be complete, and the mode conversion parameters are obtained.

9. The motor drive direction adjustment method based on an attitude sensor according to claim 8, characterized in that, The generation of the PWM control signal to drive the target vehicle based on the mode conversion parameters includes: The PWM timing parameters for the turn-on and turn-off times of each switching device are calculated based on the mode conversion parameters. Based on the PWM timing parameters and the preset carrier frequency, a triangular wave comparison is performed to obtain the PWM waveform of the first motor and the PWM waveform of the second motor. Task scheduling and timing synchronization are performed on the PWM waveforms of the first motor and the second motor to obtain synchronous PWM control commands; The synchronous PWM control command is transmitted to the dual motor driver of the target vehicle via the CAN bus to obtain the PWM control signal that drives the target vehicle to achieve attitude control and direction adjustment.

10. A motor drive direction adjustment system based on an attitude sensor, characterized in that, For performing the motor drive direction adjustment method based on an attitude sensor as described in any one of claims 1-9, the motor drive direction adjustment system based on the attitude sensor comprises: The motion state analysis module is used to analyze the motion state of the target vehicle and obtain the target operating mode. The calculation module is used to calculate the zero vector allocation ratio and vector switching sequence according to the target operating mode; The generation module is used to generate a first motor torque command and a second motor torque command based on the attitude angle data of the target vehicle. The output module is used to perform smooth transition processing on the zero vector allocation ratio, the vector switching sequence, the first motor torque command and the second motor torque command when the target operating mode is detected to be switching, and output a PWM control signal.

Citation Information

Patent Citations

  • Double-motor electric scooter control method and system

    CN110641291A

  • Implementation method of vehicle-mounted six-axis gyroscope

    CN120063252A

  • Electric wheelchair armrest linkage control method and system

    CN120360790A

  • Somatosensory driving control method and system of scooter

    CN120481693A

  • Attitude estimation apparatus and transportation machine

    US20180284150A1