Method and system for adjusting the driving direction of a motor based on a posture sensor
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- 深圳市信诚未来科技有限公司
- Filing Date
- 2025-09-19
- Publication Date
- 2026-08-07
AI Technical Summary
[0002]传统的车辆控制系统无法根据车辆运动状态的变化动态调整陀螺仪和加速度计的融合比例,导致在存在线性加速度干扰时姿态解算精度下降,影响控制决策准确性
输出模块,用于当检测到所述目标运行模式发生切换时,对所述零矢量分配比例、所述矢量切换序列、所述第一电机转矩指令和所述第二电机转矩指令进行平滑过渡处理,输出PWM控制信号。
Smart Images

Figure CN121004901B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of motor drive technology, and in particular to a method and system for adjusting the direction of motor drive based on an attitude sensor. Background Technology
[0002] Traditional vehicle control systems cannot dynamically adjust the fusion ratio of gyroscopes and accelerometers according to changes in the vehicle's motion state. This leads to decreased attitude calculation accuracy in the presence of linear acceleration interference, affecting the accuracy of control decisions. Furthermore, traditional pattern recognition methods lack the ability to predict the rider's control intentions, relying solely on simple threshold judgments based on the current attitude state. This can easily result in frequent switching near pattern boundaries, failing to accurately distinguish between the rider's true intentions and external environmental interference, thus leading to low accuracy in motor drive direction adjustment. Summary of the Invention
[0003] This invention provides a method and system for adjusting the direction of motor drive based on an attitude sensor. This invention can accurately predict the rider's control intention, effectively avoid mode misjudgment and frequent switching, ensure the reliability and continuity of operating mode recognition, effectively eliminate the impact of parameter sudden changes during mode switching, and improve the smoothness of vehicle operation and riding comfort.
[0004] The first aspect of the present invention provides a method for adjusting the direction of motor drive based on an attitude sensor, the method comprising: 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.
[0005] In conjunction with the first aspect, in a first implementation of the first aspect of the present invention, the step of performing motion state analysis on 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.
[0006] In conjunction with the first aspect, in a second implementation of the first aspect of the present invention, the step of performing motion state analysis based on the attitude angle data to obtain the target operating 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.
[0007] In conjunction with the first aspect, in a third implementation of the first aspect of the present invention, 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.
[0008] In conjunction with the first aspect, in a fourth implementation of the first aspect of the present invention, the step of calculating the voltage vector action time based on the vector amplitude and vector angle of the reference voltage according to the space vector modulation strategy 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.
[0009] In conjunction with the first aspect, in a fifth implementation of the first aspect of the present invention, 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.
[0010] In conjunction with the first aspect, in a sixth implementation of the first aspect of the present invention, the step of performing 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 a switch in the target operating mode is detected, and outputting a PWM control signal, includes: 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.
[0011] In conjunction with the first aspect, in the seventh implementation of the first aspect of the present invention, the smoothing process of the intermediate transition parameters, the first motor torque command, and the second motor torque command based on the S-shaped transition function to obtain the mode transition 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.
[0012] In conjunction with the first aspect, in an eighth implementation of the first aspect of the present invention, the step of generating a 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.
[0013] A second aspect of the present invention provides a motor drive direction adjustment system based on an attitude sensor, the motor drive direction adjustment system based on an attitude sensor comprising: 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.
[0014] Compared with existing technologies, this invention has the following advantages: It employs a dynamic weighted quaternion complementary filtering algorithm, which can adjust the fusion weights in real time according to the deviation between the total acceleration amplitude and gravitational acceleration, effectively suppressing the influence of linear acceleration interference on attitude calculation and improving the accuracy and stability of attitude angle measurement. It can accurately predict the rider's control intentions, effectively avoiding mode misjudgment and frequent switching, ensuring the reliability and continuity of operating mode recognition. A dedicated space vector modulation strategy library is designed for different operating modes, minimizing torque ripple during static equilibrium, optimizing switching losses during dynamic cruising, and improving response speed during agile steering. A direct mapping relationship is established between attitude angle and motor torque command, shortening control response time, while intelligent adjustment of steering sensitivity is achieved through a speed-adaptive differential torque distribution model. An S-shaped function parameter transition strategy is adopted to effectively eliminate parameter abrupt shocks during mode switching, improving vehicle smoothness and ride comfort. Precise dual-motor coordinated control is achieved through high-frequency PWM drive and CAN bus communication, ensuring the overall reliability and safety of the target vehicle. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0016] The structures, proportions, sizes, etc., shown in the accompanying drawings of this specification are only for the purpose of assisting those skilled in the art in understanding and reading the content disclosed in the specification, and are not intended to limit the conditions under which the present invention can be implemented. Therefore, they have no substantial technical significance. Any modifications to the structure, changes in the proportions, or adjustments to the size, without affecting the effects and objectives that the present invention can produce, should still fall within the scope of the technical content disclosed in the present invention.
[0017] Figure 1 This is a schematic flowchart of the motor drive direction adjustment method based on an attitude sensor provided in an embodiment of the present invention; Figure 2 This is a schematic block diagram of the structure of a motor drive direction adjustment system based on an attitude sensor provided in an embodiment of the present invention. Detailed Implementation
[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0019] The flowchart shown in the attached diagram is for illustrative purposes only and does not necessarily include all content and operations / steps, nor does it necessarily have to be performed in the order described. For example, some operations / steps can be broken down, combined, or partially merged, so the actual execution order may change depending on the actual situation.
[0020] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0021] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination of one or more of the associated listed items, and all possible combinations, and includes such combinations. See also Figure 1 One embodiment of the motor drive direction adjustment method based on an attitude sensor in this invention includes: Step 101: Analyze the motion state of the target vehicle to obtain the target operating mode; Specifically, the system collects the three-axis acceleration components of the target vehicle in real time and integrates the acceleration information in the three directions into a unified total acceleration amplitude through vector amplitude calculation. This total acceleration amplitude reflects the overall acceleration intensity experienced by the vehicle. The deviation between the total acceleration amplitude and the standard gravitational acceleration is used as a reference to assess whether the vehicle is in a stable state or experiencing significant motion disturbances. Based on this, a weighting coefficient for attitude fusion is constructed. This weighting coefficient dynamically adjusts the influence of the accelerometer and gyroscope in attitude calculation according to the actual motion conditions, thereby enhancing the system's environmental adaptability and anti-disturbance capability. The vehicle's three-axis angular velocity components are input into the attitude calculation module. A quaternion differential calculation process is used to obtain gyroscope quaternions derived solely from gyroscope data. These gyroscope quaternions reflect the short-term attitude change characteristics caused by changes in vehicle angular velocity. Simultaneously, the three-axis acceleration components are input into the gravity direction correction module. By aligning the three-axis acceleration components with the gravity vector to eliminate interference from non-gravity components, an attitude quaternion based on the accelerometer is constructed. The attitude quaternion mainly reflects reference information for long-term stable direction. The gyroscope quaternion and the accelerometer quaternion are weighted and fused based on weighting coefficients, enabling complementary fusion of fast-response gyroscope information and long-term stable accelerometer information to generate a fused quaternion reflecting the vehicle's current true attitude. The fused attitude quaternion is converted into a more intuitive Euler angle form, from which attitude angle parameters such as pitch, roll, and yaw are extracted. Based on the instantaneous values, rates of change, and historical trends of the attitude angles, the vehicle's current dynamic state 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: Calculate the zero vector allocation ratio and vector switching sequence according to the target operating mode; Specifically, based on the operating mode results, the space vector modulation strategy library is invoked. Within this library, matching modulation strategies are configured for different operating modes. When the target operating mode is determined to be a static balance mode, a seven-segment space vector modulation strategy with minimal torque ripple is preferentially selected. This strategy introduces two symmetrically distributed zero vectors at the beginning and end of the modulation cycle to balance flux disturbances. When the target operating mode is a dynamic cruise mode, a five-segment space vector modulation strategy is selected, which simplifies switching frequency by eliminating the final zero vector, thereby optimizing drive efficiency. When the system identifies the vehicle as being in agile steering mode, a three-segment modulation strategy with optimal response speed is adopted, retaining only continuous effective voltage vectors to maximize the dynamic response capability of the electromagnetic torque. After the modulation strategy is selected, the reference voltage vector data in the current voltage control loop is used to analyze the vector amplitude and angle of the reference voltage in real time. Using the modulation cycle, voltage vector amplitude, and DC bus voltage parameters, the duty time of each active voltage vector is calculated through space vector decomposition relationships. Based on this, the time proportion that the zero vector should occupy in the entire modulation cycle is derived, resulting in the zero vector allocation ratio. Based on the selected modulation strategy type and the known zero vector allocation ratio, a vector switching sequence is constructed according to the arrangement logic of the voltage vector in the modulation period, including the arrangement order of the effective voltage vector, the zero vector insertion position, and the duration of action.
[0023] Step 103: Generate the first motor torque command and the second motor torque command based on the attitude angle data of the target vehicle; Specifically, the attitude angle data is analyzed in real time to extract two key parameters: pitch angle and roll angle. These are then combined with the vehicle's current speed as important supplementary parameters for differential adjustment. In the longitudinal driving direction, the pitch angle reflects the trend and degree of the vehicle's forward and backward tilt. Using the pitch angle value and its rate of change as input variables, a torque modulation model based on proportional, derivative, and integral control is constructed. This model outputs driving torque commands in the forward and backward directions, reflecting the vehicle's current acceleration or deceleration needs and providing stability compensation to avoid overshoot or delayed response under tilt conditions. Simultaneously, to prevent control saturation due to integral term accumulation, an integral limiting mechanism is introduced to ensure the stability and safety of longitudinal control. In terms of lateral differential control, the steering sensitivity is adjusted based on the left and right roll states reflected by the roll angle change and the actual vehicle speed. Furthermore, the roll angle change rate is introduced as a dynamic response adjustment factor to construct a speed-adaptive differential torque calculation model. This model dynamically adjusts the differential torque based on the degree of cornering, meeting the high requirements for stable steering at low speeds and adapting to the rapid response needs at high speeds, thus improving the vehicle's handling sensitivity and safety margins. The driving torque in the front-rear direction and the differential torque in the left-right direction are coupled and distributed. The combined total torque is assigned to the left and right motors using a one-addition-one-subtraction method. The torque command for the first motor is the sum of the driving torque and half of the differential torque, while the torque command for the second motor is the driving torque minus half of the differential torque. This achieves coordinated control of the two motors under different road conditions and attitudes.
[0024] Step 104: When a target operating mode switch is detected, perform smooth transition processing on the zero vector allocation ratio, vector switching sequence, first motor torque command and second motor torque command, and output PWM control signal.
[0025] Specifically, at the instant the operating mode switches from one state to another, the current time point is extracted, and an S-shaped transition function with a smooth start, rapid middle section, and slow end is constructed by combining it with preset transition rate parameters. The S-shaped transition function enables a natural transition of control parameters from old to new values, avoiding the abrupt slope changes that occur in conventional linear interpolation. Simultaneously, a pre-switching phase of preset duration is initiated. During this phase, the system does not directly modify control commands but performs preliminary pre-adjustments on key control parameters that are about to change—including the zero-vector allocation ratio and vector switching sequence. Using the voltage modulation characteristics of the current operating mode and the parameter difference between the target mode and the target mode, a set of intermediate transition parameters is generated. After pre-adjustment, the S-shaped transition function is introduced as a weighting factor into the smoothing calculation process. By performing a weighted fusion of the intermediate transition parameters, the first motor torque command, and the second motor torque command on the time axis, all key control parameters are gradually transitioned to the final state required by the target mode. This ensures the continuity of the entire switching process in the physical quantity space, avoids excitation jumps during dynamic response, and effectively eliminates torque shocks caused by abrupt changes in control parameters at the motor output level. The smoothed mode conversion parameters are input into the PWM control signal generation module. Based on the updated vector modulation strategy and torque requirements, the voltage vector action time, switching timing and duty cycle data are recalculated and converted into two PWM control signals corresponding to the left and right drive motors.
[0026] In one specific embodiment, the process of performing step 101 may specifically include the following steps: 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 coefficient to obtain the fused attitude quaternion. The fused attitude quaternion is transformed by Euler angles to obtain attitude angle data; Motion state analysis is performed based on attitude angle data to obtain the target's operating mode.
[0027] Specifically, the triaxial acceleration components collected from the target vehicle are processed in real time. The acceleration data in the X, Y, and Z directions are taken as vector inputs and converted into a total acceleration scalar value through vector amplitude calculation. This value reflects the magnitude of the overall acceleration experienced by the vehicle. The total acceleration value should be close to the standard gravitational acceleration value when the vehicle is stationary. The deviation between the total acceleration value and the gravitational acceleration is used as a criterion for attitude data quality. When the deviation is small, it indicates that the vehicle's motion is stable and the collected acceleration is mainly based on the gravitational component, with high reliability. Conversely, if the deviation increases, it is affected by linear acceleration, bumps and vibrations, or external interference. Based on this, a dynamically adjusted weighting coefficient is constructed. The three-axis angular velocity components are input into the attitude calculation module. Based on the integration of the angular velocity using the quaternion differential equation, a gyroscope quaternion sequence that changes continuously with time is constructed. The gyroscope quaternion has extremely high dynamic response performance in a short time scale, capturing the trend of rapid rotation or sudden attitude changes. However, it has the problem of time accumulation error. Therefore, the acceleration components are 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 long-term drift of the gyroscope path. The two quaternions mentioned above represent attitude estimation paths with different characteristics. The gyroscope path has a fast response but is prone to drift, while the accelerometer path is stable but susceptible to motion disturbances. Therefore, a weighting coefficient is used as a fusion adjustment factor, and the gyroscope and accelerometer quaternions are synthesized using a weighted method. The respective weights are dynamically adjusted: the proportion of the accelerometer is increased when the vehicle is stable to correct gyroscope drift, and the proportion of the gyroscope is increased when the vehicle is moving violently to enhance dynamic tracking capabilities, thus forming a fused attitude quaternion. An Euler angle transformation process is performed on the fused quaternion to extract three physically meaningful attitude angle parameters: pitch, roll, and yaw, while retaining sufficient resolution to ensure the perceptibility of minute attitude changes. Motion state analysis is performed based on attitude angle data. A comprehensive motion intensity evaluation function is constructed by analyzing the instantaneous rate of change, amplitude of change, and relative stability of pitch and roll angles. This function is used to measure whether the vehicle is in a stationary, smooth, or dynamic steering state. When the evaluation results show that the attitude change intensity is minimal and the stability is good, it is determined to be in static balance mode. When the attitude angle change rate is moderate and has a certain continuity, it is determined to be in dynamic cruise mode. When the attitude angle fluctuates sharply and the amplitude and frequency of change increase, it is determined to be in agile steering mode.
[0028] In one specific embodiment, the process of performing motion state analysis based on attitude angle data to obtain the target operating mode can specifically include the following steps: 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 mode that meets the stability condition is static balance mode, dynamic cruise mode or agile steering mode.
[0029] Specifically, the attitude perception layer continuously records the pitch, roll, and yaw angles acquired in real time. The rate of change of these angles is extracted through point-by-point differencing of the time-series data, yielding the pitch, roll, and yaw angular velocities, respectively. A pre-defined weighting model fuses these three attitude change rates. Pitch rate, as a primary determinant of vehicle front-to-rear stability, receives a high weight. Roll rate focuses on assessing lateral stability and tilt tendency, while yaw rate reflects the intensity of steering or rotation. A weighted calculation yields an attitude motion intensity index, comprehensively describing the overall dynamic activity of the vehicle's attitude. The real-time motion intensity value is then compared with a target intensity threshold set based on historical experimental data or real-world road test results to determine the magnitude of deviation from the normal stable range. Based on this, a confidence function for the current motion state is constructed. This confidence function employs a non-linear decreasing structure, outputting high confidence when the motion intensity approaches the threshold and decreasing as it moves away from the threshold, especially during drastic attitude changes, thus enhancing the ability to identify stable states. A higher confidence level indicates that the current attitude state is closer to typical stable operating conditions, which is used to determine whether the stability condition is met. When the confidence level exceeds a set threshold, the current vehicle attitude change is considered stable, meeting the basic conditions for operating mode recognition. Otherwise, the current operating mode remains unchanged, and a mode switching delay buffer mechanism is activated to avoid frequent switching or control oscillations caused by misjudgment. Under the premise that the attitude state has reached stability, the vehicle's operating environment and state parameters are comprehensively verified through multiple safety constraints. The actual operating speed data of the current vehicle is read to verify whether it is within the allowable range, and the speed is controlled in the range of 0 to 25 kilometers per hour to avoid inappropriate mode switching at high speeds. The current remaining battery power is detected and compared with the minimum safe battery power threshold. Only when the battery power is higher than the safety lower limit, such as above 20%, is switching to the cruise or steering mode with higher power requirements allowed. The current vehicle attitude angle data is compared with the road slope information provided by the map or terrain perception module to confirm whether the terrain slope is less than the set safety upper limit, not exceeding 15 degrees, to prevent the vehicle from entering a high-risk operating state on steep roads. When the above attitude stability judgment and the three safety conditions are all met, the current vehicle operation mode is finally confirmed by combining the numerical range of motion intensity. If the motion intensity is extremely low and the attitude angle changes slowly, it is determined to be a static balance mode, which is suitable for parking, waiting and other states. If the motion intensity is in a medium range and the trend of change is stable, it is identified as a dynamic cruise mode, indicating that the vehicle is in a normal constant speed forward state. If the motion intensity is high and accompanied by violent attitude fluctuations, and all safety conditions are still met, it is identified as an agile steering mode, indicating that the vehicle is currently in a fast turn or complex maneuver.
[0030] In one specific embodiment, the process of performing step 102 may specifically include the following steps: 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 by measuring the vector amplitude and vector angle of the reference voltage to obtain the zero vector allocation ratio; Vector switching sequences are obtained by combining vector sequences based on the space vector modulation strategy and the zero vector allocation ratio.
[0031] Specifically, by combining the front-end attitude perception and motion state recognition results, the current operating mode of the target vehicle is obtained, including static balance mode, dynamic cruise mode, or agile steering mode. Each mode corresponds to different control objectives and performance priorities. A mapping relationship between the operating mode and the space vector modulation strategy is established during the control strategy selection phase. In static balance mode, the control focus is on improving the smoothness of electromagnetic torque output and suppressing torque ripple to the maximum extent. In this mode, a seven-segment space vector pulse width modulation strategy is preferred. This strategy achieves flexible filling of the effective vector action time by inserting two symmetrically distributed zero vector segments in the complete modulation cycle, effectively alleviating the output current jump phenomenon and improving low-speed stability. When the target operating mode is dynamic cruise mode, the control target is to improve steering efficiency and optimize power consumption. A five-segment space vector modulation strategy is adopted. By reducing one zero vector segment, the number of switching actions is reduced, reducing switching losses while ensuring waveform integrity and improving system energy efficiency. When the vehicle is in agile steering mode, the motor is required to have the fastest response speed and the strongest torque change capability. Therefore, the zero vector segment is completely abandoned, and only the continuous effective voltage vector is retained. A three-segment modulation strategy is adopted to form a gapless effective vector switching path, thereby achieving fast direction control and high-frequency dynamic response. After determining the modulation strategy, the voltage vector action time is calculated by combining the amplitude and angle information of the reference voltage vector. The target voltage vector is projected and decomposed onto the six basic voltage vector bases in space, and the action time of each vector is calculated according to the current modulation period and bus voltage conditions. In the seven-segment and five-segment strategies, due to the need for zero vector insertion, the total action time of the zero vector is calculated based on the margin of the voltage vector action time, and it is reasonably allocated between the two zero vector segments to form a vector action time set that can be directly input to the PWM modulation module. Simultaneously, the proportion of the modulation period occupied by the zero vector is derived from this. In the three-segment strategy, since the zero vector does not participate in the modulation process at all, the zero vector allocation ratio is defined as zero, and all modulation periods are occupied by effective vectors to achieve maximum output dynamic performance. Vector sequence combination is performed according to the space vector modulation strategy and the zero vector allocation ratio. Based on the selected modulation strategy and the current zero vector configuration, a vector switching sequence is constructed to control the switching path of the voltage space vector within the modulation period. In the seven-segment strategy, the vector sequence adopts a symmetrical structure of "zero vector - first effective vector - second effective vector - first effective vector - zero vector" to ensure the symmetry of the current waveform and minimize harmonics. In the five-segment strategy, the post-zero vector is omitted, making the sequence structure "zero vector - first effective vector - second effective vector - first effective vector" to simplify the inverter switching process and improve efficiency. In the three-segment strategy, only the continuous switching structure of the three effective vectors is retained without any interruption, thereby completing the voltage vector direction rotation at the fastest speed and driving the motor to achieve transient steering response.
[0032] In one specific embodiment, the process of performing voltage vector action time calculation based on the vector amplitude and vector angle of the reference voltage using a space vector modulation strategy to obtain the zero vector allocation ratio can specifically include the following steps: 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, the second vector action time, and the sampling period. Based on the segment number characteristics of the space vector modulation strategy, the total zero vector time is allocated according to the golden ratio to obtain the pre-zero vector time and post-zero vector time, and the zero vector allocation ratio is calculated based on the pre-zero vector time and post-zero vector time.
[0033] Specifically, the amplitude and spatial angle of the reference voltage vector are calculated using a sine function. By decomposing the reference vector into its two nearest basic voltage vectors, the duration of the first and second effective vectors within the current modulation period is determined. The calculation process depends on the vector topology and vector angle configuration of the six sectors in space. The adjacent vector number must be determined based on the region where the vector angle is located, and trigonometric functions are used to map the reference vector amplitude to the time components of the two basic vectors, yielding the durations of the first and second vectors. The difference between the durations of the first and second vectors is calculated with respect to the entire PWM sampling period. This difference, calculated by subtracting the sum of the durations of the first and second vectors from the modulation period, gives the remaining unoccupied time within the current period, which is the zero-vector available time, or the total zero-vector time. To achieve optimal torque ripple suppression and current harmonic minimization, a zero-vector allocation strategy based on the golden ratio is introduced. The total zero-vector time is divided into a pre-zero-vector time and a post-zero-vector time in a ratio of approximately 0.618 and 0.382, with the shorter zero-vector time placed at the beginning of the modulation period and the longer portion at the end. When the system switches to a five-segment modulation strategy in dynamic cruise mode, the same principle is applied to allocate the unique zero-vector action time. In dynamic cruise mode, the post-zero-vector time is omitted, and all zero-vector time is placed directly at the beginning of the period; while in agile steering mode, the zero-vector time is zero, and this calculation process is automatically skipped. The zero-vector allocation ratio is calculated based on the relative lengths of the pre-zero-vector time and the post-zero-vector time. The ratio is defined as the percentage of the pre-zero-vector time to the total zero-vector time and serves as a parameter input for the modulation strategy optimizer, participating in dynamic strategy selection and disturbance suppression strategy correction.
[0034] In one specific embodiment, the process of performing step 103 may specifically include the following steps: The forward and backward drive torque is calculated based on the pitch angle in the attitude angle data 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 torque command of the first motor and the torque command of the second motor.
[0035] Specifically, the pitch angle and roll angle, two key parameters, are extracted from the attitude calculation results, and a complete attitude-torque mapping path is constructed in conjunction with the vehicle's current operating speed. In the forward and backward drive control, the pitch angle, as a direct representation of the vehicle's forward and backward tilt state, reflects whether the target vehicle is currently accelerating, decelerating, or in a state of static equilibrium. Therefore, an enhanced torque regulation model is constructed based on the pitch angle. The model considers the instantaneous deviation of the pitch angle and introduces a three-term regulation mechanism (proportional, derivative, and integral) based on the changing trend and duration of the instantaneous deviation. The proportional term directly reflects the influence intensity of the current attitude angle deviation on the target output torque, the derivative term is used to sense the rate of attitude change to provide responsive compensation during dynamic acceleration and deceleration, and the integral term is used to eliminate the accumulation of steady-state error caused by long-term attitude deviation. A set of longitudinal drive torque commands that can adapt to different terrain changes and load disturbances is constructed. The numerical range is constrained according to the vehicle's mass and inertial characteristics to prevent sudden changes in the drive system due to excessively large commands. Simultaneously, a differential torque generation mechanism is constructed for the lateral differential control path, with roll angle and current vehicle speed as the core inputs. The roll angle directly reflects the vehicle's lateral tilt, while the current speed is used to adjust the strength and sensitivity of the torque required for steering. When the vehicle is traveling at low speeds, changes in roll angle primarily reflect the driver's balance adjustment behavior; therefore, the output of differential torque needs to be kept low to avoid interfering with control intentions. At high speeds, slight changes in roll angle correspond to significant directional deflection demands; therefore, a speed-based gain adjustment function is introduced when calculating differential torque to dynamically improve differential response capabilities under high-speed conditions. The rate of change of roll angle is introduced as a supplementary variable into the differential torque calculation model. By sensing the abruptness of steering actions, the slope of the output torque is adjusted, enabling the vehicle to achieve greater differential adjustment capability during sharp turns and maintain stable output during gentle turns or slight tilts, ensuring stability and safety of the driving experience during steering. Based on the forward and backward drive torque commands and the left and right differential torque, dual-motor torque distribution is performed, rationally projecting longitudinal drive force and lateral differential adjustment onto the left and right drive motors to achieve coordinated control. In the torque distribution logic, the forward and backward drive torque commands are used as the basic driving force for the two motors. Based on this, the left and right differential torques are applied symmetrically to the two drive sides, so that the left motor torque is equal to the forward drive torque plus half of the differential torque, and the right motor torque is equal to the forward drive torque minus half of the differential torque. This ensures that while maintaining the longitudinal propulsion requirements of the vehicle, an effective steering torque difference is formed, driving the vehicle to achieve smooth and precise directional control, and generating the first motor torque command and the second motor torque command.
[0036] In one specific embodiment, the process of performing step 104 may specifically include the following steps: 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 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. The PWM control signal for driving the target vehicle is generated based on the mode conversion parameters.
[0037] Specifically, when a change in the operating mode of the target vehicle is detected, a gradual switching control mechanism based on time continuity and function smoothness is initiated. This ensures that control parameters do not undergo abrupt changes 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 deterioration of attitude fluctuations. The timestamp of the detected mode switch is recorded, and the transition rate parameter in the control configuration is invoked. The transition rate parameter is obtained through experimental debugging or model optimization, reflecting the acceptable parameter change rate and transition time range of the control system. Based on the current moment 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 characteristic of slow change in the initial and final stages and accelerated change in the intermediate stage. It is suitable for describing the entire process of a gradual change of physical quantities from the initial state to the target state and is suitable for soft switching operations of key parameters such as voltage modulation strategies and torque output commands in motor control systems. A pre-switching phase of preset duration is initiated to perform parameter structure analysis and intermediate transition state generation. During this phase, the system does not directly adjust the output control signal. Instead, it analyzes and slowly processes the zero-vector allocation ratio and vector switching sequence parameters under the current operating mode, gradually approaching the control parameters corresponding to the target mode, while avoiding a one-time jump to the new parameter values. For example, when switching from static balance mode to dynamic cruise mode, the zero-vector time transitions from a symmetrical seven-segment structure to a simplified five-segment structure, and the vector switching sequence changes from a symmetrical sequence containing the preceding and following zero vectors to an asymmetrical structure removing the final zero vector. Therefore, during the pre-switching phase, a gradual mapping operation is performed on these two parameters to generate a set of intermediate transition parameters. After the pre-switching phase is completed and the formal transition execution phase begins, the intermediate transition parameters, the first motor torque command, and the second motor torque command are sequentially smoothed in the time domain using an S-shaped function as the weighted adjustment basis. The function value of the S-curve at the current moment is used as a fusion factor and applied to the continuous weighted fusion between the old parameters and the target parameters. This ensures that each control parameter gradually transitions to the new value according to the proportion of the S-curve, effectively avoiding phenomena such as PWM duty cycle jumps, current loop oscillations, or motor vibrations caused by sudden torque command changes or modulation parameter jumps. This maintains the dynamic continuity of the control system at the physical execution level. Especially during attitude adjustments, speed switching, or steering changes, the smoothing mechanism improves ride comfort, reduces power consumption fluctuations, and extends the lifespan of the driver and motor. The corrected vector switching sequence, zero vector allocation ratio, and updated torque commands from the first and second motors are input into the space vector PWM control module, and a corresponding PWM control signal is generated at a fixed 20kHz carrier frequency.
[0038] In one specific embodiment, 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 the mode conversion parameters can specifically include the following steps: The S-shaped transition function is calculated based on the time difference between the current time and the start time of the handover, 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 real-time transition zero vector allocation ratio, real-time transition vector switching sequence and 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.
[0039] Specifically, the actual time calibrated by the current system clock is obtained, and the difference between the actual time and the official start time of the mode switch is calculated to obtain the time offset of the current time point relative to the switching start point. The time difference is used as an independent variable to input into the S-shaped function expression to calculate the corresponding transition function value. The transition function value is the current S-shaped transition factor, whose value range is limited to 0 to 1, and it exhibits a non-linear growth trend of fast in the middle and slow at both ends, ensuring smoother parameter changes at the beginning and end of the transition and effectively avoiding torque fluctuations or current distortions caused by excessively steep parameter slopes. The S-shaped transition factor is introduced as an interpolation factor into the linear interpolation operation logic to perform real-time linear interpolation between the modulation parameters corresponding to the original operating mode (i.e., the initial zero vector allocation ratio and the initial vector switching sequence) and the modulation parameters corresponding to the target operating mode (i.e., the target zero vector allocation ratio and the target vector switching sequence). The intermediate parameter value to be used at the current time is determined by the numerical position of the current factor between 0 and 1, and the real-time transition zero vector allocation ratio and the real-time transition vector switching sequence are calculated respectively. Simultaneously, linear interpolation of the torque command values currently used by the first and second motors is performed in the same dimension. The torque control output generated in the original operating mode and the torque output required in the target mode are used as the two endpoints of the interpolation. Under the action of the S-shaped transition factor, a transition torque command is generated in real time, so that the two motors maintain coordinated changes during the switching process and continuously output a continuously differentiable torque signal throughout the entire transition range. During the transition execution, the attitude angle change trend of the target vehicle is continuously monitored, and the standard deviation of pitch angle and roll angle is calculated in the form of a sampling window to obtain the instantaneous fluctuation amplitude index of attitude change. The standard deviation directly reflects whether the vehicle is in a state of dynamic instability or control disturbance during the transition. The calculated attitude angle standard deviation is compared with the preset stability threshold. If the standard deviation value is always lower than the stability threshold (e.g., 1.5 degrees) and remains below it for several consecutive sampling periods, it is confirmed that the current transition process has been completed stably without high-frequency attitude oscillation or control offset. Based on this, the transition phase is determined to be terminated, and the real-time transition zero vector allocation ratio, real-time transition vector switching sequence, and transition torque command are converged into the formal control parameters of the new mode, completing the closed-loop confirmation of mode switching.
[0040] In one specific embodiment, the process of generating a PWM control signal for driving the target vehicle based on mode transition parameters may specifically include the following steps: 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 waveforms of the first motor and 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.
[0041] Specifically, the PWM timing parameter calculation module maps the mode conversion parameters into on / off control signals acting on specific power switching devices. Based on the current space vector modulation strategy structure, the effective voltage vector number is extracted. Combined with the zero-vector insertion rule set for the target operating mode, and according to the action time information of each voltage vector contained in the mode conversion parameters, the on / off time corresponding to each switching device in the three-phase inverter bridge is calculated, forming a PWM timing parameter set. This set includes the start time, end time, and duration of each voltage vector in a PWM cycle, considering the phase displacement relationship between the three phases and dead-time compensation requirements to ensure that short-circuit conditions are avoided during conduction and to suppress electromagnetic interference and harmonic output to the greatest extent. Based on the PWM timing parameters and a preset carrier frequency, a synchronous reference triangular wave is generated. The reference triangular wave linearly increases and decreases at a constant frequency, forming a symmetrical sawtooth wave structure within the cycle, used for comparison with the modulation level of the target voltage vector. When the modulation setpoint of any phase is higher than the current triangular wave amplitude, that phase outputs a high logic level, driving the upper bridge arm to conduct; conversely, it outputs a low level, driving the lower bridge arm to conduct. Independent PWM comparison channels are established for the first and second motors, and corresponding voltage modulation setpoint curves are generated based on their respective target modulation vector action times. These curves are compared in real-time with the triangular wave to obtain the PWM waveforms of the first and second motors, respectively. To achieve synchronous control of the dual-motor PWM waveforms, a unified scheduling table is constructed in the scheduling module. Based on the start time, action segment length, and control priority of each PWM channel, a task-level scheduling strategy is executed to ensure that the rising edges, falling edges, and zero vector switching boundaries of the PWM signals of the first and second motors remain time-aligned. Simultaneously, a timestamp mechanism is used to perform dynamic correction processing within each carrier cycle, adjusting the offset between the two PWM channels in real-time. An interpolation mechanism is used to fine-tune the waveform boundaries, resulting in two sets of PWM control commands with synchronized timing and consistent modulation logic. Two sets of time-synchronized PWM control commands are packaged into CAN protocol frames and transmitted to the dual-motor driver of the target vehicle via the CAN bus interface according to the specified data structure and communication rate. A 1Mbps high-speed CAN bus is used for data transmission. Each frame contains the conduction time slices, vector numbers, and modulation status identifiers of all arms of both motors within the current PWM cycle, along with a control CRC and frame sequence identifier to ensure data integrity and verifiable frame order. Upon receiving the synchronized PWM control commands, the dual-motor driver parses the PWM time period configuration corresponding to each arm and directly applies it to the high-voltage side IGBT or MOSFET switching devices inside the drive module, generating a modulation voltage waveform consistent with that of the controller, thus achieving high-precision drive control of both motors.
[0042] The above describes the motor drive direction adjustment method based on an attitude sensor in the embodiments of the present invention. The following describes the motor drive direction adjustment system based on an attitude sensor in the embodiments of the present invention. Please refer to [link / reference]. Figure 2 One embodiment of the motor drive direction adjustment system based on an attitude sensor in this invention includes: The motion state analysis module 201 is used to analyze the motion state of the target vehicle and obtain the target operating mode. Calculation module 202 is used to calculate the zero vector allocation ratio and vector switching sequence according to the target operating mode; The generation module 203 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 204 is used to perform smooth transition processing on the zero vector allocation ratio, vector switching sequence, first motor torque command and second motor torque command when a target operating mode switch is detected, and output a PWM control signal.
[0043] Through the collaborative efforts of the aforementioned components, a dynamic weighted quaternion complementary filtering algorithm is employed to adjust the fusion weights in real time based on the deviation between the total acceleration amplitude and gravitational acceleration. This effectively suppresses the impact of linear acceleration interference on attitude calculation, improving the accuracy and stability of attitude angle measurement. It accurately predicts the rider's control intentions, effectively avoiding mode misjudgment and frequent switching, ensuring the reliability and continuity of operating mode recognition. A dedicated space vector modulation strategy library is designed for different operating modes, minimizing torque ripple during static equilibrium, optimizing switching losses during dynamic cruising, and improving response speed during agile steering. A direct mapping relationship is established between attitude angle and motor torque commands, shortening control response time. Simultaneously, an intelligent adjustment of steering sensitivity is achieved through a speed-adaptive differential torque distribution model. An S-shaped function parameter transition strategy effectively eliminates parameter abrupt shocks during mode switching, improving vehicle smoothness and ride comfort. Precise dual-motor coordinated control is achieved through high-frequency PWM drive and CAN bus communication, ensuring the overall reliability and safety of the target vehicle.
[0044] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0045] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an electronic device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0046] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for 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; Specifically, this includes: selecting a corresponding space vector modulation strategy based on the target operating mode; a seven-segment space vector modulation strategy when the target operating mode is static balance mode, a five-segment space vector modulation strategy when the target operating mode is dynamic cruise mode, and a three-segment space vector modulation strategy when the target operating mode is agile steering mode; calculating the vector amplitude and vector angle of the reference voltage using sine functions to obtain the first vector action time and the second vector action time; calculating the total zero vector time based on the time difference between the first vector action time and the second vector action time and the sampling period to obtain the total zero vector time; allocating the total zero vector time according to the segment 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 calculating the zero vector allocation ratio based on the pre-zero vector time and the post-zero vector time; and combining vector sequences according to the space vector modulation strategy and the zero vector allocation ratio to obtain a vector switching sequence. 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 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.
5. 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.
6. The motor drive direction adjustment method based on an attitude sensor according to claim 5, 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.
7. The motor drive direction adjustment method based on an attitude sensor according to claim 6, 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.
8. 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-7, 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