Stroke calibration method, motor controller and stroke calibration system

By accurately measuring the stroke of the brake motor output shaft, the problem of inaccurate stroke calibration in the prior art is solved, and high-precision stroke calibration and output shaft motion control are achieved.

CN120212839APending Publication Date: 2025-06-27SHENZHEN H&T AUTOMOTIVE ELECTRONICS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510269553.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-07
Publication Date
2025-06-27

AI Technical Summary

Technical Problem

In the prior art, the brake motor stroke calibration is inaccurate, which affects the vehicle control logic and feedback, and is artificially operated inefficient and errors are prone to occur.

Method used

By obtaining the current angle of the output shaft, controlling the output shaft to rotate to a specific blocking position, determining the first blocking angle and the second blocking angle, and accurately measuring the stroke of the output shaft in combination with the maximum preset angle of the angle sensor.

Benefits of technology

It realizes precise control of the motion position of the output shaft, improves stroke calibration accuracy, and reduces the error and inefficiency of manual operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120212839A_ABST
    Figure CN120212839A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to the technical field of motor stroke calibration, and discloses a stroke calibration method, a motor controller and a stroke calibration system.The method is applied to an automobile, the automobile comprises a speed reducing mechanism and an angle sensor, the speed reducing mechanism comprises an output shaft, and the angle sensor is used for determining the angle of the output shaft; the method comprises the following steps: acquiring a current angle of an output shaft, and controlling the output shaft to rotate from a first position to a first locked-rotor position in a first direction based on the first position corresponding to the current angle of the output shaft so as to acquire a first locked-rotor angle corresponding to the first locked-rotor position; and controlling the output shaft to rotate from the first locked-rotor position to the second locked-rotor position in the second direction to obtain a second locked-rotor angle corresponding to the second locked-rotor position, and determining the stroke of the output shaft according to the first locked-rotor angle and the second locked-rotor angle in combination with the maximum preset angle of the angle sensor, so that the stroke of the output shaft can be accurately measured to improve the calibration precision.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the technical field of motor stroke calibration, and in particular, to a stroke calibration method, a motor controller, and a stroke calibration system. Background Art

[0002] Currently, in domestic vehicles, when the P gear is engaged for parking, an Electronic Parking Brake (EPB) system is usually adopted. This system realizes the parking function by locking the brake pads with a caliper. Due to the small friction of the caliper, there is a risk of vehicle creep, and the Vehicle Control Unit (VCU) cannot obtain the position of the caliper, which affects the entire vehicle control logic and feedback.

[0003] In the prior art, the position of the brake motor is usually adjusted multiple times manually to determine the stroke of the brake motor. However, manual operation cannot provide real-time feedback on the current position of the brake motor, resulting in inaccurate calibration of the brake motor stroke, and further causing the VCU to be unable to make correct logical judgments. Summary of the Invention

[0004] The embodiments of the present application provide a stroke calibration method, a motor controller, and a stroke calibration system, which can accurately measure the stroke of the output shaft to improve the calibration accuracy.

[0005] In a first aspect, the embodiments of the present application provide a stroke calibration method applied to an automobile. The automobile includes a reduction mechanism and an angle sensor. The reduction mechanism includes an output shaft, and the angle sensor is used to determine the angle of the output shaft;

[0006] The method includes:

[0007] Obtain the current angle of the output shaft;

[0008] Based on the first position corresponding to the current angle of the output shaft, control the output shaft to rotate from the first position to the first blocked position in a first direction to obtain the first blocked angle corresponding to the first blocked position;

[0009] Control the output shaft to rotate from the first blocked position to the second blocked position in a second direction to obtain the second blocked angle corresponding to the second blocked position;

[0010] Determine the stroke of the output shaft according to the first blocked angle, the second blocked angle, and the maximum preset angle of the angle sensor.

[0011] In some embodiments, before obtaining the current angle of the output shaft, the method further includes:

[0012] Send an angle reading instruction to the angle sensor. If the angle data fed back by the angle sensor is obtained and the angle data verification is successful, then based on the angle data, determine the current angle of the output shaft;

[0013] If the angle data fed back by the angle sensor is obtained and the angle data verification fails, then determine whether the angle sensor is assembled properly. If the angle sensor is not assembled properly, then determine that the angle sensor is in a faulty state;

[0014] Or,

[0015] If the angle data fed back by the angle sensor is not obtained, then determine whether the angle sensor is assembled properly. If the angle sensor is not assembled properly, then determine that the angle sensor is in a faulty state.

[0016] In some embodiments, determining whether the angle sensor is assembled properly includes:

[0017] Obtain the frequency of the pulse width modulation wave;

[0018] Obtain the duty cycle of the angle sensor;

[0019] If the frequency of the pulse width modulation wave is within the preset frequency range, and the duty cycle is within the preset duty cycle range, and the processing time is within the preset processing time, then determine that the angle sensor is assembled properly, where the processing time is the time from obtaining the frequency of the pulse width modulation wave to determining that the duty cycle is within the preset duty cycle range;

[0020] If the frequency of the pulse width modulation wave is not within the preset frequency range, or the duty cycle is not within the preset duty cycle range, or the processing time is not within the preset processing time, then determine that the angle sensor is not assembled properly.

[0021] In some embodiments, the method further includes:

[0022] If the angle sensor is assembled properly, then determine the current angle of the output shaft based on the duty cycle, where the current angle of the output shaft is (duty cycle / preset value) * maximum preset angle, and the preset value is the maximum preset duty cycle.

[0023] In some embodiments, determining the stroke of the output shaft according to the first stall angle, the second stall angle, and in combination with the maximum preset angle of the angle sensor includes:

[0024] When the first stall angle is greater than the second stall angle, then the stroke of the output shaft = maximum preset angle - first stall angle + second stall angle;

[0025] When the first stall angle is less than or equal to the second stall angle, then the stroke of the output shaft = second stall angle - first stall angle.

[0026] In some embodiments, the method further includes:

[0027] Calculating the reported angle, specifically including:

[0028] When the first stall angle is greater than the second stall angle and the current angle of the output shaft is greater than the first stall angle, the reported angle = the current angle of the output shaft - the first stall angle;

[0029] When the first stall angle is greater than the second stall angle and the current angle of the output shaft is less than the first stall angle, the reported angle = the maximum preset angle - the first stall angle + the current angle of the output shaft;

[0030] When the first stall angle is less than or equal to the second stall angle, the reported angle = the current angle of the output shaft - the first stall angle.

[0031] In some embodiments, the method further includes:

[0032] When the first stall angle is greater than the second stall angle and the current angle of the output shaft is within the first preset angle range, the current reported angle is set to the minimum preset angle, where the first preset angle range is (the first stall angle - the angle threshold, the first stall angle);

[0033] When the first stall angle is greater than the second stall angle and the current angle of the output shaft is within the second preset angle range, the current reported angle is set to the maximum preset angle, where the second preset angle range is (the second stall angle, the second stall angle + the angle threshold).

[0034] In some embodiments, the vehicle further includes a drive motor and a vehicle controller, and the method further includes:

[0035] Obtaining the current value of the drive motor;

[0036] Obtaining the maximum current limit value of the vehicle controller;

[0037] Based on the current value of the drive motor and the maximum current limit value, determining the output signal of the vehicle controller;

[0038] Based on the output signal of the vehicle controller, adjusting the output current of the drive motor.

[0039] In some embodiments, determining the output signal of the vehicle controller based on the current value of the drive motor and the maximum current limit value includes:

[0040] μ(t) = K p *e(t) + K i *∫e(t)dt

[0041] where μ(t) is the output signal, K pis the proportional gain, K i is the integral gain, e(t) = Iset(t) - Iout(t), where Iset(t) is the maximum current limit value, Iout(t) is the current value of the driving motor, and t is the time.

[0042] In a second aspect, an embodiment of the present application provides a motor controller, including:

[0043] at least one processor, and

[0044] a memory communicatively connected to the at least one processor, wherein,

[0045] the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the stroke calibration method as in the first aspect.

[0046] In a third aspect, an embodiment of the present application provides a stroke calibration system. The system includes a vehicle, and the vehicle includes a driving motor, a reduction mechanism, an angle sensor, a motor controller as in the second aspect, and a vehicle controller. The reduction mechanism includes an output shaft, and the angle sensor is used to determine the angle of the output shaft;

[0047] The motor controller is connected to the vehicle controller and is configured to obtain the current angle of the output shaft, determine the first stall angle and the second stall angle of the output shaft, and determine the stroke and the reported angle of the output shaft according to the first stall angle, the second stall angle, and in combination with the maximum preset angle of the angle sensor;

[0048] The vehicle controller is connected to the motor controller and is configured to adjust the output current of the driving motor based on the reported angle.

[0049] The beneficial effects of the embodiments of the present application: Different from the prior art, a stroke calibration method provided by the embodiments of the present application is applied to a vehicle. The vehicle includes a reduction mechanism and an angle sensor. The reduction mechanism includes an output shaft, and the angle sensor is used to determine the angle of the output shaft. The method includes: obtaining the current angle of the output shaft, controlling the output shaft to rotate from the first position to the first stall position in the first direction based on the first position corresponding to the current angle of the output shaft to obtain the first stall angle corresponding to the first stall position, and controlling the output shaft to rotate from the first stall position to the second stall position in the second direction to obtain the second stall angle corresponding to the second stall position; determining the stroke of the output shaft according to the first stall angle, the second stall angle, and in combination with the maximum preset angle of the angle sensor.

[0050] By controlling the rotation direction of the output shaft based on the current angle of the output shaft so that the output shaft reaches the stall position, the first stall angle and the second stall angle are determined, and based on the first stall angle, the second stall angle, and the maximum preset angle of the angle sensor, the stroke of the output shaft is determined, which can accurately control the movement position of the output shaft and avoid system failures caused by equipment errors. Description of the Drawings

[0051] One or more embodiments are exemplarily illustrated by the pictures in the corresponding drawings. These exemplary illustrations do not limit the embodiments. Elements with the same reference numerals in the drawings are represented as similar elements. Unless otherwise stated, the drawings in the figures do not constitute a proportional limitation.

[0052] Figure 1 is a schematic structural diagram of a stroke calibration system provided by an embodiment of the present application;

[0053] Figure 2 is a schematic connection diagram of a motor controller and a vehicle controller provided by an embodiment of the present application;

[0054] Figure 3 is a schematic flowchart of a stroke calibration method provided by an embodiment of the present application;

[0055] Figure 4 is a schematic flowchart of a method for determining whether the communication and assembly of an angle sensor are normal provided by an embodiment of the present application;

[0056] Figure 5 is Figure 4 a refined flowchart of step S405 in

[0057] Figure 6 is a schematic flowchart of a method for determining the first stall angle and the second stall angle provided by an embodiment of the present application;

[0058] Figure 7 is Figure 3 a refined flowchart of step S304 in

[0059] Figure 8 is an exemplary schematic diagram of determining the stroke of the output shaft provided by an embodiment of the present application;

[0060] Figure 9 is another exemplary schematic diagram of determining the stroke of the output shaft provided by an embodiment of the present application;

[0061] Figure 10 is a schematic flowchart of a method for calculating and reporting an angle provided by an embodiment of the present application;

[0062] Figure 11It is a schematic diagram of another process for calculating and reporting an angle provided by an embodiment of the present application;

[0063] Figure 12 It is a schematic example diagram for calculating and reporting an angle provided by an embodiment of the present application;

[0064] Figure 13 It is a schematic diagram of a process for adjusting the output current of a drive motor provided by an embodiment of the present application;

[0065] Figure 14 It is a schematic structural diagram of a motor controller provided by an embodiment of the present application.

[0066] Explanation of the reference numerals in the drawings:

[0067] Label Name Label Name 1000 Stroke calibration system 103 Deceleration mechanism 100 First controller 131 Output shaft 101 Motor controller 104 Angle sensor 111 Processor 200 Parking mechanism 112 Memory 300 Vehicle controller 102 Drive motor Detailed implementation manners

[0068] The present application will be described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present application, but do not limit the present application in any form. It should be noted that those of ordinary skill in the art can make several modifications and improvements without departing from the concept of the present application. These all fall within the protection scope of the present application.

[0069] In order to make the purpose, technical solution and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0070] It should be noted that if there is no conflict, the various features in the embodiments of the present application can be combined with each other, and all are within the protection scope of the present application. In addition, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order from the module division in the device or the flowchart. In addition, the terms "first", "second", "third", etc. used herein do not limit the data and execution order, but only distinguish the same items or similar items with basically the same function and effect.

[0071] Unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as commonly understood by those skilled in the technical field to which the present application belongs. The terms used in this specification in the description of the present application are only for the purpose of describing specific implementation manners and are not used to limit the present application. The term "and / or" used in this specification includes any and all combinations of one or more of the related listed items.

[0072] In addition, the technical features involved in each embodiment of the present application described below can be combined with each other as long as they do not conflict with each other.

[0073] Before introducing the embodiments of the present application, a simple introduction to the stroke calibration method known to the inventors of the present application is given first, so as to facilitate the subsequent understanding of the embodiments of the present application.

[0074] Currently, for the stroke calibration of the brake motor, the brake motor is controlled to rotate at a fixed angle by operating a button, and a counter is used to record the number of operations of the operation button, so as to obtain the braking stroke of the brake motor. The reset button is used to reset the brake motor to the initial state, and the inspection button is used to control the brake motor to rotate to the brake stroke measurement angle at one time, and the pedal brake pedal is stepped on to check whether the braking is in place. This method requires multiple manual operations to determine the stroke, with low efficiency and prone to errors, resulting in inaccurate stroke calibration.

[0075] In view of the above problems, the present application provides a stroke calibration method. By controlling the rotation direction of the output shaft based on the current angle of the output shaft, the output shaft is made to reach the stall position to determine the first stall angle and the second stall angle, and based on the first stall angle, the second stall angle and the maximum preset angle of the angle sensor, the stroke of the output shaft is determined, which can accurately control the movement position of the output shaft.

[0076] The technical solution of the present application will be specifically described below with reference to the accompanying drawings of the specification.

[0077] Please refer to Figure 1 , Figure 1 which is a schematic structural diagram of a stroke calibration system provided by an embodiment of the present application.

[0078] As Figure 1 shown, the stroke calibration system 1000 includes a first controller 100, a parking mechanism 200, and a vehicle controller 300. The first controller 100 includes a motor controller 101, a drive motor 102, a reduction mechanism 103, and an angle sensor 104. The reduction mechanism 103 includes an output shaft 131. Among them, the first controller 100 can be a P gear controller, and the P gear controller is a device in an automobile used to control the P gear (parking gear) locking mechanism to achieve the parking function.

[0079] The motor control unit 101 (MCU) is connected to the vehicle control unit 300, the drive motor 102, and the angle sensor 104. The motor control unit 101 is used to obtain the current angle of the output shaft 131, determine the first stall angle and the second stall angle of the output shaft 131, and determine the stroke and the reported angle of the output shaft 131 based on the first stall angle, the second stall angle, and the maximum preset angle of the angle sensor 104. Herein, the first stall angle and the second stall angle refer to the angles at which the rotor stops rotating due to mechanical reasons or excessive load during the operation of the motor. The motor control unit 101 includes, but is not limited to, an integrated motor control unit, a DC permanent magnet brushless motor control unit, etc.

[0080] The drive motor 102 is connected to the motor control unit 101 and the reduction mechanism 103. The drive motor 102 is controlled by the motor control unit 101 and controls the rotation of the output shaft of the reduction mechanism 103. The drive motor 102 includes, but is not limited to, an induction motor, a permanent magnet synchronous motor, a permanent magnet brushless DC motor, a switched reluctance motor, etc.

[0081] The reduction mechanism 103 is used to convert the high-speed and low-torque power output by the power source into low-speed and high-torque power to meet the driving requirements of the vehicle, and to change the direction of power output to ensure that the power can be transmitted to the wheels of the vehicle in a predetermined direction. The reduction mechanism 103 includes, but is not limited to, devices for reducing speed such as a gear reducer, a worm reducer, a cycloidal pinwheel reducer, and a planetary reducer.

[0082] The angle sensor 104 is connected to the motor control unit 101 and the reduction mechanism 103, and is used to obtain the angle of the output shaft 131 of the reduction mechanism 103. The angle sensor 104 includes, but is not limited to, a Hall effect angle sensor, a magnetoresistive effect angle sensor, etc.

[0083] The parking mechanism 200 is used to lock the wheels of the vehicle to prevent the vehicle from skidding. The parking mechanism 200 includes, but is not limited to, a ratchet and pawl type parking mechanism, a rack and pinion type parking mechanism, an electromagnetic type parking mechanism, a motor-driven type parking mechanism, etc.

[0084] The vehicle control unit 300 (VCU) is connected to the motor control unit 101. The vehicle control unit 300 is used to determine the output current required by the drive motor 102 based on the reported angle and send a control command to the motor control unit 101 to adjust the output current of the drive motor 102. Herein, the control command includes a target current value, etc.

[0085] In the embodiments of the present application, each component in the stroke calibration system 1000 communicates through a Controller Area Network (CAN) bus. The CAN bus includes a high-level data line (CAN High, CAN_H) and a low-level data line (CAN Low, CAN_L). The CAN bus uses a differential signal transmission method, that is, the voltage difference between CAN_H and CAN_L is used to represent digital signals. When the voltage difference between CAN_H and CAN_L is positive or negative, it represents a dominant state (logic 0). When the voltages of CAN_H and CAN_L are equal (usually 2.5V), it represents a recessive state (logic 1). In the dominant state, the level of CAN_H is higher and is used to transmit high-level signals, while the level of CAN_L is lower and is used to transmit low-level signals.

[0086] In the embodiments of the present application, through the standard CAN communication interface, fast data transmission between each component in the stroke calibration system 1000 can be achieved. At the same time, it can be compatible with external vehicle control systems, increasing the scalability of the stroke calibration system.

[0087] In the embodiments of the present application, through the mutual cooperation of each component in the stroke calibration system 1000, the stroke of the output shaft is accurately determined to achieve the control of the output shaft, avoiding inaccurate calibration caused by manual operation and improving the calibration efficiency.

[0088] Please refer to Figure 2 , Figure 2 which is a schematic connection diagram of the motor controller and the vehicle controller provided in the embodiments of the present application.

[0089] As Figure 2 shown, the first controller 100 includes a motor controller 101, a drive motor 102, a reduction mechanism 103, and an angle sensor 104. The first controller 100 is connected to the parking mechanism 200 through the reduction mechanism 103. The first controller 100 is connected to the vehicle controller 300 through the CAN bus interface on the motor controller 101. The CAN bus interface includes CAN_H and CAN_L.

[0090] The motor controller 101 is connected to the drive motor 102, the angle sensor 104, and the vehicle controller 300. It is used to obtain the current angle of the output shaft of the reduction mechanism 103, determine the first stall angle and the second stall angle of the output shaft, and determine the stroke and the reported angle of the output shaft according to the first stall angle, the second stall angle, and the maximum preset angle of the angle sensor 104, and send the reported angle to the vehicle controller 300.

[0091] The drive motor 102 is connected to the motor controller 101 and the reduction mechanism 103. The drive motor 102 is controlled by the motor controller 101 and is used to provide power for the reduction mechanism 103. Specifically, the drive motor 102 converts electrical energy into mechanical energy through the electromagnetic principle.

[0092] The reduction mechanism 103 is connected to the drive motor 102, the angle sensor 104, and the parking mechanism 200. The reduction mechanism 103 is used to convert the high-speed and low-torque power output by the power source into low-speed and high-torque power to meet the driving requirements of the vehicle, and to change the direction of power output to ensure that the power can be transmitted to the vehicle wheels in a predetermined direction.

[0093] The angle sensor 104 is connected to the motor controller 101 and the reduction mechanism 103. The angle sensor 104 is used to obtain the angle of the output shaft of the reduction mechanism 103.

[0094] The vehicle controller 300 is connected to the motor controller 100. The vehicle controller 300 is used to determine the output current required by the drive motor 102 based on the reported angle and send a control command to the motor controller 101 to adjust the output current of the drive motor 102.

[0095] In the embodiment of the present application, the motor controller 101 further includes a VCC interface (VoltCurrentCondenser) and a GND interface (Ground). The VCC interface is the access point of the positive power supply. The VCC interface is responsible for receiving the voltage from the power line and transmitting it to other components in the circuit. The GND interface is the negative or zero potential point of the circuit and is used to connect the ground wire of the circuit.

[0096] Embodiment 1

[0097] Please refer to Figure 3 , Figure 3 which is a schematic flow chart of a stroke calibration method provided by an embodiment of the present application.

[0098] Among them, this stroke calibration method is applied to a vehicle, and the vehicle includes a motor controller. Specifically, the execution subject of this stroke calibration method is one or at least two processors of the motor controller.

[0099] As Figure 3 shown, this stroke calibration method includes:

[0100] Step S301: Obtain the current angle of the output shaft.

[0101] In an embodiment of the present application, the stroke calibration method is applied to an automobile, which includes a reduction mechanism and an angle sensor. The reduction mechanism includes an output shaft. The angle sensor is used to sense the rotation of the output shaft and convert it into an electrical signal (such as voltage, current or digital signal) to obtain the angle of the output shaft.

[0102] Specifically, the current angle of the output shaft is obtained through the angle sensor.

[0103] In an embodiment of the present application, the angle sensor includes a magnetic encoder chip. The magnetic encoder chip is a chip integrating a magnetic sensor and a digital signal processing circuit. The magnetic encoder chip is used to capture changes in rotational and linear positions. The magnetic encoder chip realizes position detection based on the principle of magnetic field induction. The internal magnetic sensor of it can sense changes in the magnetic field. The magnetic sensor includes a Hall effect sensor or a magnetoresistive sensor, etc.

[0104] In an embodiment of the present application, the magnetic encoder chip senses changes in the magnetic field strength and direction related to the angle through the built-in magnetic sensor, converts the changes in the magnetic field strength and direction into electrical signals, and the built-in signal processing circuit of the magnetic encoder chip performs operations such as analog-to-digital conversion, filtering, amplification, and digital signal processing on the electrical signals, and finally outputs angle information, that is, outputs the current angle of the output shaft.

[0105] In an embodiment of the present application, the range of the angle value measured by the magnetic encoder chip is [0, 65535]. Among them, 65535 is the maximum angle value that the magnetic encoder chip can measure. 65535 is the maximum value of a 16-bit unsigned integer, that is, 65535 is 2 to the 16th power minus 1, that is, (2 16 - 1), and the angle value obtained through the magnetic encoder chip is finally converted into an angle, and the angle range is [0, 360 0 ].

[0106] In an embodiment of the present application, before obtaining the current angle of the output shaft, it is also necessary to detect whether the communication of the angle sensor is normal and whether the assembly of the angle sensor is normal. For the specific process, please refer to Figure 4 .

[0107] Please refer to Figure 4 , Figure 4 which is a schematic flow chart for determining whether the communication and assembly of the angle sensor are normal provided by an embodiment of the present application.

[0108] As Figure 4 shown, determining whether the communication and assembly of the angle sensor are normal includes:

[0109] Step S401: Send an angle reading instruction to the angle sensor.

[0110] Specifically, connect the motor controller to the power supply and send an angle reading instruction to the angle sensor.

[0111] Step S402: Determine whether the angular data fed back by the angular sensor is obtained.

[0112] Specifically, determine whether the angular data fed back by the angular sensor is obtained. If the angular data fed back by the angular sensor is obtained, then jump to step S403. If the angular data fed back by the angular sensor is not obtained, then jump to step S405. Among them, the angular data includes the current angular value of the output shaft.

[0113] Step S403: Determine whether the angular data is successfully verified.

[0114] Specifically, after the angular data fed back by the angular sensor is obtained, the angular data is verified to determine whether the angular data is successfully verified. If the angular data is successfully verified, then jump to step S404. If the angular data verification fails, then jump to step S405.

[0115] In the embodiment of the present application, the angular data can be verified by Cyclic Redundancy Check (CRC). CRC is a method for detecting errors in data transmission or storage. CRC generates a fixed-length check code through polynomial division. This check code is appended to the data and sent or stored together. The receiving party (such as the motor controller) uses the same algorithm to recalculate the check code. If the calculated check code is the same as the received check code, the data is considered correct, that is, the data verification is successful. If the calculated check code is different from the received check code, the data is considered incorrect, that is, the data verification fails.

[0116] In the embodiment of the present application, when the angular data fed back by the angular sensor is obtained and the angular data verification is successful, it means that the motor controller and the angular sensor communicate successfully through the Serial Peripheral Interface (SPI), and the current motor controller is in the SPI working mode. Among them, the Serial Peripheral Interface (SPI) is a high-speed, full-duplex, synchronous communication bus. SPI includes four SPI signal lines, namely Serial Clock (SCLK), Master Out Slave In (MOSI), Master In Slave Out (MISO), and Chip Select (CS).

[0117] In an embodiment of the present application, if the current motor controller is not in the SPI working mode, it means that the SPI communication between the motor controller and the angle sensor fails. Then, an angle reading instruction is sent to the angle sensor again, and step S402 is executed again to determine whether the SPI communication between the motor controller and the angle sensor is successful. When step S402 is executed a preset number of times, the current process ends, where the preset number is set according to system requirements, for example, set to three times.

[0118] In an embodiment of the present application, by setting a multiple - attempt mechanism (that is, after the communication with the angle sensor fails, the communication is repeated until the number of repetitions reaches three times, and then it ends), it is ensured that the system will not cause an overall failure due to a single failure, enhancing the fault tolerance, robustness, and stability of the system.

[0119] Step S404: Determine the current angle of the output shaft based on the angle data.

[0120] Specifically, when the angle data fed back by the angle sensor is obtained and the angle data is successfully verified, the current angle of the output shaft is determined based on the angle data. Among them, the angle data includes the angle value output by the angle sensor, and the current angle of the output shaft is equal to (angle value output by the angle sensor / 2 16 ) * 360 0 , and the angle value output by the angle sensor is in the range of [0, 65535].

[0121] Step S405: Judge whether the angle sensor is assembled normally.

[0122] Specifically, when the angle data fed back by the angle sensor is obtained and the angle data verification fails, it is judged whether the angle sensor is assembled normally. If the angle sensor is assembled normally, jump to step S406; if the angle sensor is not assembled normally, jump to step S407. For the specific steps of judging whether the angle sensor is assembled normally, please refer to Figure 5 .

[0123] Please refer to Figure 5 , Figure 5 Yes Figure 4 is the detailed process schematic diagram of step S405 in

[0124] As Figure 5 shown, this step S405 includes:

[0125] Step S451: Obtain the frequency of the pulse - width modulation wave.

[0126] In an embodiment of the present application, when the communication between the motor controller and the angle sensor fails through SPI, the angle sensor will actively send a Pulse Width Modulation (PWM) wave through the Pulse Width Modulation (PWM) output pin (PWM_out pin) to feedback the angle value of the output shaft. The PWM wave is a pulse signal composed of a series of high levels and low levels.

[0127] Specifically, the frequency of the Pulse Width Modulation wave is determined by measuring a complete cycle of the Pulse Width Modulation wave, where the complete cycle refers to the time from a high level to a low level and then back to a high level.

[0128] Step S452: Obtain the duty cycle of the angle sensor.

[0129] Among them, the duty cycle is the percentage of the duration of the high level in the entire cycle.

[0130] Specifically, obtain the high-level time in the PWM cycle to determine the duty cycle of the angle sensor. Duty cycle = (High-level time / PWM cycle) * 100%.

[0131] Step S453: Determine whether the frequency of the Pulse Width Modulation wave is within the preset frequency range.

[0132] Specifically, determine whether the frequency of the Pulse Width Modulation wave is within the preset frequency range. If the frequency of the Pulse Width Modulation wave is within the preset frequency range, jump to step S454. If the frequency of the Pulse Width Modulation wave is not within the preset frequency range, jump to step S457. Among them, the preset frequency range is [20K - 10%, 20K + 10%].

[0133] Step S454: Determine whether the duty cycle is within the preset duty cycle range.

[0134] Among them, the preset duty cycle range is (0 - 100%].

[0135] Specifically, determine whether the duty cycle is within the preset duty cycle range, that is, determine whether the duty cycle is within (0 - 100%]. If the duty cycle is within the preset duty cycle range, jump to step S455. If the duty cycle is not within the preset duty cycle range, jump to step S457.

[0136] In an embodiment of the present application, that is, when the duty cycle is 0, the duty cycle is not within the preset duty cycle range.

[0137] Step S455: Determine whether the processing time is within the preset processing time.

[0138] Among them, the processing time is the time from obtaining the frequency of the pulse width modulation wave to determining that the duty cycle is within the preset duty cycle range, that is, the processing time from step S451 to step S454.

[0139] Specifically, it is determined whether the processing time is within the preset processing time. If the processing time is within the preset processing time, jump to step S456; if the processing time is not within the preset processing time, jump to step S457. Among them, the preset processing time is set according to system requirements.

[0140] Step S456: Determine that the angle sensor is assembled normally.

[0141] Specifically, when the frequency of the pulse width modulation wave is within the preset frequency range, the duty cycle is within the preset duty cycle range, and the processing time is within the preset processing time, it is determined that the angle sensor is assembled normally.

[0142] Step S457: Determine that the angle sensor is assembled abnormally.

[0143] Specifically, when the frequency of the pulse width modulation wave is within the preset frequency range, the duty cycle is within the preset duty cycle range, and the processing time is not within the preset processing time, it is determined that the angle sensor is assembled abnormally.

[0144] Or, when the frequency of the pulse width modulation wave is within the preset frequency range and the duty cycle is not within the preset duty cycle range, it is determined that the angle sensor is assembled normally.

[0145] Or, when the frequency of the pulse width modulation wave is not within the preset frequency range, it is determined that the angle sensor is assembled normally.

[0146] Step S406: Determine the current angle of the output shaft based on the duty cycle.

[0147] Specifically, when the angle sensor is assembled normally, the current angle of the output shaft is determined based on the duty cycle. The current angle of the output shaft is (duty cycle / preset value) * maximum preset angle, where the preset value is the maximum preset duty cycle, that is, the preset value is 100, and the maximum preset angle is 360 0 。

[0148] Step S407: Determine that the angle sensor is in a fault state.

[0149] Specifically, when the angle sensor is assembled abnormally, it is determined that the angle sensor is in a fault state, and the fault state of the angle sensor is reported through the CAN bus, and the process of obtaining the current angle of the output shaft ends.

[0150] Step S302: Based on the first position corresponding to the current angle of the output shaft, control the output shaft to rotate from the first position to the first blocked rotation position in the first direction, so as to obtain the first blocked rotation angle corresponding to the first blocked rotation position.

[0151] Specifically, after obtaining the current angle of the output shaft, based on the first position corresponding to the current angle of the output shaft, control the output shaft to rotate from the first position to the first blocked rotation position in the first direction, so as to obtain the first blocked rotation angle corresponding to the first blocked rotation position.

[0152] It can be understood that the output shaft usually rotates in a specific direction. For example, the initial rotation direction of the output shaft is the clockwise direction.

[0153] Among them, the first direction refers to the direction opposite to the specific direction of rotation of the output shaft, and the first blocked rotation position refers to the position where the output shaft starts to rotate in the first direction until it can no longer rotate.

[0154] In the embodiment of the present application, the vehicle further includes a drive motor and a vehicle controller. The vehicle controller is connected to the motor controller. The drive motor is controlled by the motor controller, and the rotation of the output shaft is also controlled by the drive motor. When the vehicle controller sends a calibration message to the motor controller, the calibration message includes the target voltage, rotation direction, etc. The motor controller adjusts the voltage of the drive motor according to the calibration message to control the speed and steering of the drive motor. For example, the speed of the drive motor is controlled at 50% of the maximum voltage, and the output shaft is controlled to rotate to the blocked rotation position through a reduction mechanism.

[0155] In the embodiment of the present application, the voltage of the drive motor during operation is within a preset voltage range. For example, the voltage range is 9 - 16V. When the voltage of the drive motor during operation is not within the voltage range, a voltage fault will be reported. For example, a low voltage fault is reported when it is lower than 8.5V, it returns to normal when it is higher than 9V and less than 16V, a high voltage fault is reported when it is higher than 16.5V, and it returns to normal when it is less than 16V and higher than 9V. When a voltage fault occurs, the operation of the drive motor is stopped. Therefore, when controlling the operation of the drive motor, the voltage of the drive motor needs to be adjusted to ensure that the voltage of the drive motor is within the voltage range.

[0156] In the embodiment of the present application, after determining the first blocked rotation position, control the drive motor to stop running, and the angle sensor obtains the first blocked rotation angle corresponding to the first blocked rotation position, and use the first blocked rotation angle as the minimum angle.

[0157] Step S303: Control the output shaft to rotate from the first blocked rotation position to the second blocked rotation position in the second direction, so as to obtain the second blocked rotation angle corresponding to the second blocked rotation position.

[0158] Specifically, after determining the first blocked rotation position, control the output shaft to rotate from the first blocked rotation position in the second direction to the second blocked rotation position, control the driving motor to stop running, and obtain the second blocked rotation angle corresponding to the second blocked rotation position through the angle sensor.

[0159] Wherein, the second direction refers to the same direction as the specific direction of rotation of the output shaft, and the second blocked rotation position refers to the position where the output shaft starts to rotate in the second direction until it can no longer rotate.

[0160] In the embodiment of the present application, the second blocked rotation angle is used as the maximum angle.

[0161] In the embodiment of the present application, by determining the first blocked rotation angle and the second blocked rotation angle, the mechanical limit and position information of the driving motor are determined to ensure subsequent precise control.

[0162] Please refer to Figure 6 , Figure 6 which is a schematic flowchart of a process for determining the first blocked rotation angle and the second blocked rotation angle provided by the embodiment of the present application.

[0163] As Figure 6 shown, the process for determining the first blocked rotation angle and the second blocked rotation angle includes:

[0164] Step S601: Reverse to the blocked rotation position.

[0165] Specifically, based on the position corresponding to the current angle of the output shaft, control the output shaft to reverse to the blocked rotation position, that is, control the output shaft to rotate in the direction opposite to the specific direction of the output shaft to the blocked rotation position.

[0166] Step S602: Stop the driving motor.

[0167] Specifically, when the output shaft reverses to the blocked rotation position, stop the operation of the driving motor.

[0168] Step S603: Record the current position as the first blocked rotation position.

[0169] Specifically, the current position is the blocked rotation position reached when the output shaft reverses, and the current position is used as the first blocked rotation position.

[0170] Step S604: Rotate forward to the blocked rotation position.

[0171] Specifically, control the output shaft to rotate forward from the first blocked rotation position to the blocked rotation position, that is, control the output shaft to rotate in the same direction as the specific direction of the output shaft to the blocked rotation position.

[0172] Step S605: Stop the electric drive motor.

[0173] Specifically, when the output shaft rotates forward to the blocked rotation position, stop the operation of the driving motor.

[0174] Step S606: Record the current position as the second stall position.

[0175] Specifically, the current position is the stall position reached when the output shaft rotates forward, and this current position is taken as the second stall position.

[0176] In the embodiment of the present application, by determining the first stall position and the second stall position, the first stall angle corresponding to the first stall position is obtained, and the second stall angle corresponding to the second stall position is obtained, so as to determine the maximum angle and the minimum angle of rotation of the output shaft.

[0177] Step S304: Determine the stroke of the output shaft according to the first stall angle, the second stall angle, and in combination with the maximum preset angle of the angle sensor.

[0178] Specifically, after obtaining the first stall angle and the second stall angle, according to the first stall angle, the second stall angle, and in combination with the maximum preset angle of the angle sensor, the stroke of the output shaft is determined, where the maximum preset angle is 360 0 , for the specific steps of determining the stroke of the output shaft, please refer to Figure 7 .

[0179] In the implementation of the present application, by controlling the output shaft to rotate reversely and forwardly to obtain angle information, it is possible to avoid errors caused by improper manual adjustment and improve the operation accuracy of the system.

[0180] Please refer to Figure 7 , Figure 7 which Figure 3 is the detailed flow schematic diagram of step S304 in

[0181] As Figure 7 shown, this step S304 includes:

[0182] Step S341: Determine whether the first stall angle is greater than the second stall angle.

[0183] Specifically, determine whether the first stall angle is greater than the second stall angle. When the first stall angle is greater than the second stall angle, jump to step S342; when the first stall angle is less than or equal to the second stall angle, jump to step S343.

[0184] In the embodiment of the present application, a magnetic encoder zero point (Magnetic Zero Point) is set in the angle sensor. The magnetic encoder zero point refers to a fixed reference position defined in a magnetic encoder or a magnetic sensor, and the magnetic encoder zero point is usually used to represent the origin or reference point of a measurement or control system.

[0185] In the embodiment of the present application, during the process of measuring the stroke of the output shaft, since the installation angle of the angle sensor is randomly unfixed, the calculation methods when the stroke of the output shaft passes through the magnetic encoder zero point and does not pass through the magnetic encoder zero point are different.

[0186] In the embodiment of the present application, when the first stall angle is greater than the second stall angle, it indicates that the stroke of the output shaft passes through the magnetic encoder zero point; when the first stall angle is less than or equal to the second stall angle, it indicates that the stroke of the output shaft does not pass through the magnetic encoder zero point.

[0187] Step S342: Stroke of the output shaft = maximum preset angle - first stall angle + second stall angle.

[0188] Specifically, when the first stall angle is greater than the second stall angle, the stroke of the output shaft = maximum preset angle - first stall angle + second stall angle.

[0189] Please refer to Figure 8 , Figure 8 which is an exemplary schematic diagram for determining the stroke of the output shaft provided by the embodiment of the present application.

[0190] As Figure 8 shown, the range of the angle value output by the angle sensor is [0, 65535], Z is the magnetic encoder zero point, the angle corresponding to point A is the first stall angle, the angle corresponding to point B is the second stall angle, D is the stroke of the output shaft, the first stall angle is 54612, the second stall angle is 10922, and the fact that the first stall angle is greater than the second stall angle indicates that the stroke of the output shaft does not pass through the magnetic encoder zero point, so D = 65535 - 54612 + 10922.

[0191] Step S343: Stroke of the output shaft = second stall angle - first stall angle.

[0192] Specifically, when the first stall angle is less than or equal to the second stall angle, the stroke of the output shaft = second stall angle - first stall angle.

[0193] Please refer to Figure 9 , Figure 9 which is another exemplary schematic diagram for determining the stroke of the output shaft provided by the embodiment of the present application.

[0194] As Figure 9 shown, the range of the angle value output by the angle sensor is [0, 65535], Z is the magnetic encoder zero point, the angle corresponding to point A is the first stall angle, the angle corresponding to point B is the second stall angle, D is the stroke of the output shaft, the first stall angle is 10922, the second stall angle is 21845, and the fact that the first stall angle is less than the second stall angle indicates that the stroke of the output shaft does not pass through the magnetic encoder zero point, so D = 21845 - 10922.

[0195] In the embodiments of the present application, through the self-learning and intelligent calibration processes, the stroke calibration of the output shaft is automatically completed, reducing manual intervention, thereby reducing the possibility of human errors, and being able to reduce the errors in the system structure assembly, ensuring that the system can accurately control the movement position of the output shaft, and improving the accuracy and reliability of the system in actual applications.

[0196] In the embodiments of the present application, after determining the stroke of the output shaft, it is also necessary to calculate and report the angle. The reported angle provides an accurate feedback on the current position of the output shaft, so as to calculate the target positions of the output shaft at different time points, and dynamically adjust the movement of the output shaft, thereby achieving smooth and accurate control and reducing errors. For the specific process of calculating the reported angle, please refer to Figure 10 。

[0197] Please refer to Figure 10 , Figure 10 which is a schematic flow diagram of calculating the reported angle provided by the embodiments of the present application.

[0198] As Figure 10 shown, the calculation of the reported angle includes:

[0199] Step S1001: Determine whether the first stall angle is greater than the second stall angle.

[0200] Specifically, to determine whether the first stall angle is greater than the second stall angle, if the first stall angle is greater than the second stall angle, then jump to step S1002; if the first stall angle is less than or equal to the second stall angle, then jump to step S1005.

[0201] Step S1002: Determine whether the current angle of the output shaft is greater than the first stall angle.

[0202] Specifically, when the first stall angle is greater than the second stall angle, determine whether the current angle of the output shaft is greater than the first stall angle. If the current angle of the output shaft is greater than the first stall angle, then jump to step S1003; if the current angle of the output shaft is less than or equal to the first stall angle, then jump to step S1004.

[0203] Step S1003: Reported angle = Current angle of the output shaft - First stall angle.

[0204] Specifically, when the first stall angle is greater than the second stall angle and the current angle of the output shaft is greater than the first stall angle, then the reported angle = Current angle of the output shaft - First stall angle.

[0205] Step S1004: Reported angle = Maximum preset angle - First stall angle + Current angle of the output shaft.

[0206] Specifically, when the first stall angle is greater than the second stall angle and the current angle of the output shaft is less than the first stall angle, the reported angle = the maximum preset angle - the first stall angle + the current angle of the output shaft.

[0207] Step S1005: The reported angle = the current angle of the output shaft - the first stall angle.

[0208] Specifically, when the first stall angle is less than or equal to the second stall angle, the reported angle = the current angle of the output shaft - the first stall angle.

[0209] In the embodiments of the present application, during the actual operation of the system, when calculating the reported angle, it is also necessary to consider the ability of the system's structure to adapt to changes and adjustment states.

[0210] Please refer to Figure 11 , Figure 11 which is another schematic flowchart for calculating the reported angle provided by the embodiments of the present application.

[0211] As Figure 11 shown, the calculation of the reported angle includes:

[0212] Step S1101: Determine whether the first stall angle is greater than the second stall angle.

[0213] Specifically, to determine whether the first stall angle is greater than the second stall angle, if the first stall angle is greater than the second stall angle, then jump to step S1102; if the first stall angle is less than or equal to the second stall angle, then jump to step S1104.

[0214] Step S1102: Determine whether the current angle of the output shaft is within the first preset angle range.

[0215] Specifically, when the first stall angle is greater than the second stall angle, determine whether the current angle of the output shaft is within the first preset angle range. If the current angle of the output shaft is within the first preset angle range, then jump to step S1103; if the current angle of the output shaft is not within the first preset angle range, then jump to step S1105, where the first preset angle range is (the first stall angle - the angle threshold, the first stall angle), and the angle threshold is set according to specific needs, for example, set to 30 0 .

[0216] Step S1103: Set the current reported angle to the minimum preset angle.

[0217] Specifically, when the first stall angle is greater than the second stall angle and the current angle of the output shaft is within the first preset angle range, set the current reported angle to the minimum preset angle.

[0218] Step S1104: Reported angle = Second stall angle - First stall angle + Current angle of the output shaft.

[0219] Specifically, when the first stall angle is less than or equal to the second stall angle, the reported angle = Second stall angle - First stall angle + Current angle of the output shaft.

[0220] Step S1105: Determine whether the current angle of the output shaft is within the second preset angle range.

[0221] Specifically, when the first stall angle is greater than the second stall angle and the current angle of the output shaft is not within the first preset angle range, determine whether the current angle of the output shaft is within the second preset angle range. If the current angle of the output shaft is within the second preset angle range, jump to step S1106; if the current angle of the output shaft is not within the second preset angle range, jump to step S1107, where the second preset angle range is (Second stall angle, Second stall angle + Angle threshold).

[0222] In the embodiments of the present application, the first preset angle range and the second preset angle range are set on the premise that the first stall angle is greater than the second stall angle, that is, there is no intersection between the first preset angle range and the second preset angle range, and (First stall angle - Angle threshold) is greater than (Second stall angle + Angle threshold).

[0223] It should be noted that there is no sequence relationship between step S1102 and step S1105.

[0224] Step S1106: Set the current reported angle to the maximum preset angle.

[0225] Specifically, when the first stall angle is greater than the second stall angle, the current angle of the output shaft is not within the first preset angle range, and the current angle of the output shaft is within the second preset angle range, then set the current reported angle to the maximum preset angle.

[0226] In the embodiments of the present application, by determining that the current angle of the output shaft is within the first preset angle range or the second preset angle range, the reported angle is automatically adjusted to correct the displacement of the output shaft and ensure the accuracy of the position data.

[0227] Step S1107: Determine whether the current angle of the output shaft is greater than the first stall angle.

[0228] Specifically, when the first stall angle is greater than the second stall angle, and the current angle of the output shaft is not within the first preset angle range and not within the second preset angle range, determine whether the current angle of the output shaft is greater than the first stall angle. If the current angle of the output shaft is greater than the first stall angle, jump to step S1108; if the current angle of the output shaft is less than the first stall angle, jump to step S1109.

[0229] Step S1108: Reported angle = Current angle of the output shaft - First stall angle.

[0230] Specifically, when the first stall angle is greater than the second stall angle, and the current angle of the output shaft is not within the first preset angle range and not within the second preset angle range, and the current angle of the output shaft is greater than the first stall angle, then the reported angle = Current angle of the output shaft - First stall angle.

[0231] Step S1109: Reported angle = Maximum preset angle - First stall angle + Current angle of the output shaft.

[0232] Specifically, when the first stall angle is greater than the second stall angle, and the current angle of the output shaft is not within the first preset angle range and not within the second preset angle range, and the current angle of the output shaft is less than or equal to the first stall angle, then the reported angle = Maximum preset angle - First stall angle + Current angle of the output shaft.

[0233] Please refer to Figure 12 , Figure 12 which is a schematic diagram showing an example of calculating the reported angle provided by an embodiment of the present application.

[0234] As Figure 12 shown, the range of the angle value output by the angle sensor is [0, 65535], Z is the magnetic encoder zero point, the angle corresponding to point A is the first stall angle, the angle corresponding to point B is the second stall angle, the angle corresponding to point C is the current angle of the output shaft, D is the stroke of the output shaft, R is the reported angle, the first stall angle is 10922, the second stall angle is 21845, the current angle of the output shaft is 15922, and the first stall angle being less than or equal to the second stall angle indicates that the stroke of the output shaft does not pass through the magnetic encoder zero point, so D = 21845 - 10922, and R = 15922 - 10922.

[0235] In the embodiments of the present application, by accurately calculating the stroke of the output shaft and the reported angle, the system can precisely control the movement and feedback of the P - gear locking mechanism of the vehicle, avoiding mechanical failures caused by improper control.

[0236] Please refer to Figure 13 , Figure 13It is a schematic flow chart for adjusting the output current of a driving motor provided by an embodiment of the present application.

[0237] As Figure 13 shown, the adjustment of the output current of the driving motor includes:

[0238] Step S1301: Obtain the current value of the driving motor.

[0239] In the embodiment of the present application, the vehicle also includes an Analog to Digital Converter (ADC). An ADC is an electronic component that converts an analog signal into a digital signal, and the ADC is used to convert an input analog signal into an output digital signal.

[0240] Specifically, set the signal frequency and duty cycle of the PWM, configure the PWM interrupt, so that the PWM signal generates an interrupt request at the middle moment of the high level. At the PWM interrupt moment, trigger the ADC to sample to record the analog signal at the current moment, convert the analog signal into a digital signal, and convert the digital signal into the current value of the driving motor to obtain the current value of the driving motor.

[0241] In the embodiment of the present application, the formula for converting the digital signal into the current value of the driving motor is:

[0242]

[0243] where I is the current value of the driving motor, G I is the conversion gain, D is the digital signal, N is the resolution of the ADC, V adc is the analog voltage signal, V ref is the reference voltage of the ADC.

[0244] Step S1302: Obtain the maximum current limit value of the vehicle controller.

[0245] Among them, the maximum current limit value is the maximum current value that the vehicle controller can stably output. The maximum current limit value is used to protect components such as the driving motor and the motor controller to prevent each component of the vehicle from being damaged due to excessive current.

[0246] It should be noted that the specific value of the maximum current limit value depends on the type of the vehicle, the power requirement, the motor specification, and the capacity and voltage level of the battery system.

[0247] Step S1303: Determine the output signal of the vehicle controller based on the current value of the driving motor and the maximum current limit value.

[0248] In the embodiment of the present application, the output signal of the vehicle controller is controlled by a Proportion Integration Differentiation (PID) controller, which consists of a proportional unit (P), an integration unit (I), and a differentiation unit (D).

[0249] Specifically, based on the current value of the drive motor and the maximum current limit value, the output signal of the vehicle controller is determined. The formula corresponding to the output signal of the vehicle controller is:

[0250] μ(t) = K p *e(t) + K i *∫e(t)dt

[0251] where μ(t) is the output signal, K p is the proportional gain, K i is the integral gain, e(t) = Iset(t) - Iout(t), Iset(t) is the maximum current limit value, Iout(t) is the current value of the drive motor, and t is time.

[0252] Among them, the smaller K p , the slower the system response. The larger K p , the faster the system response. However, if K p is too large, it will cause large overshoot and oscillation in the system, resulting in poor stability performance of the system. Therefore, K p should not be selected too large.

[0253] In the embodiment of the present application, the values of K p and K i need to be adjusted according to the characteristics of the drive motor. For example, the characteristics of the drive motor include load characteristics, inertia, dynamic performance, control accuracy requirements, etc.

[0254] For example, initialize the value of K p to 0, and gradually increase K p , observe whether the response speed of the system gradually increases and whether overshoot or oscillation occurs, until K p is adjusted to a reasonable value.

[0255] For example, initialize the value of K i to 0. If there is a static error in the system or the system response is poor when the load changes, then gradually increase K i , until K i is adjusted to a reasonable value.

[0256] In the embodiment of the present application, the output signal of the vehicle controller is a voltage or current signal, which is used to control the operation of the drive motor.

[0257] In the embodiment of the present application, the maximum output signal μ(t) is set max , when μ(t) is greater than μ(t) max , then μ(t) is set to μ(t) max , where μ(t) max is equal to the maximum preset duty cycle.

[0258] Step S1304: Adjust the output current of the drive motor based on the output signal of the vehicle controller.

[0259] Specifically, the output signal of the vehicle controller is a voltage or current signal. Based on the output signal of the vehicle controller, the current of the drive motor is adjusted to the output signal of the vehicle to adjust the output signal of the drive motor.

[0260] In the embodiment of the present application, the vehicle includes a parking mechanism. By restricting the maximum output signal of the vehicle controller, the maximum torque of the parking mechanism is restricted to avoid excessive load when the parking mechanism contacts the gear, and to ensure that the output current value or voltage value is the preset current value or voltage value to protect the drive motor.

[0261] In the embodiment of the present application, by restricting the maximum current, it is possible to avoid system failures caused by current surges due to overload of the drive motor, thereby improving the safety of the system.

[0262] In the embodiment of the present application, by controlling the rotation direction of the output shaft based on the current angle of the output shaft, the output shaft is made to reach the stall position to determine the first stall angle and the second stall angle, and based on the first stall angle, the second stall angle, and the maximum preset angle of the angle sensor, the stroke of the output shaft is determined, the movement position of the output shaft can be accurately controlled, thereby the stroke of the output shaft can be accurately measured, and further the calibration accuracy is improved, thereby avoiding system failures caused by equipment errors, and improving the accuracy and reliability of the system in practical applications.

[0263] Embodiment 2

[0264] Please refer to Figure 14 , Figure 14 which is a schematic structural diagram of a motor controller provided by an embodiment of the present application.

[0265] As Figure 14 shown, the motor controller 101 includes one or more processors 111 and a memory 112. Among them, Figure 14 one processor 111 is taken as an example herein.

[0266] The processor 111 and the memory 112 can be connected by a bus or other means, Figure 14 and connection by a bus is taken as an example herein.

[0267] A processor 111 for providing computing and control capabilities to control the motor controller 101 to perform corresponding tasks. For example, it controls the motor controller 101 to perform the stroke calibration method in any of the above method embodiments. This method is applied to an automobile, which includes a reduction mechanism and an angle sensor. The reduction mechanism includes an output shaft, and the angle sensor is used to determine the angle of the output shaft. The method includes:

[0268] Obtaining the current angle of the output shaft, based on the first position corresponding to the current angle of the output shaft, controlling the output shaft to rotate from the first position in a first direction to a first blocked rotation position to obtain a first blocked rotation angle corresponding to the first blocked rotation position, and controlling the output shaft to rotate from the first blocked rotation position in a second direction to a second blocked rotation position to obtain a second blocked rotation angle corresponding to the second blocked rotation position; determining the stroke of the output shaft according to the first blocked rotation angle, the second blocked rotation angle, and in combination with the maximum preset angle of the angle sensor.

[0269] By determining the first blocked rotation angle and the second blocked rotation angle based on the current angle of the output shaft, and in combination with the maximum preset angle of the angle sensor to determine the stroke of the output shaft, the stroke of the output shaft can be accurately determined.

[0270] The processor 111 can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), a hardware chip, or any combination thereof; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The above PLD can be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0271] The memory 112, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as the program instructions / modules corresponding to the travel calibration method in the embodiments of the present application. By running the non-transitory software programs, instructions, and modules stored in the memory 112, the processor 111 can implement the travel calibration method in any of the following method embodiments. Specifically, the memory 112 may include a volatile memory (VM), such as a random access memory (RAM); the memory 112 may also include a non-volatile memory (NVM), such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid-state drive (SSD), or other non-transitory solid-state storage devices; the memory 112 may further include a combination of the above types of memories.

[0272] The memory 112 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage devices. In some embodiments, the memory 112 optionally includes a memory remotely disposed relative to the processor 111, and these remote memories can be connected to the processor 111 through a network. Examples of the above networks include but are not limited to the Internet, an enterprise intranet, a local area network, a mobile communication network, and combinations thereof.

[0273] One or more modules are stored in the memory 112 and, when executed by one or more processors 111, implement the travel calibration method in any of the above method embodiments. For example, execute the Figure 3 various steps shown above.

[0274] In the embodiments of the present application, the motor controller 101 may further have components such as a wired or wireless network interface and an input / output interface for input / output. The motor controller 101 may further include other components for implementing the functions of the device, which will not be elaborated here.

[0275] The motor controller in the embodiments of the present application exists in various forms and executes the Figure 3 various steps shown above.

[0276] The embodiments of the present application further provide a non-volatile computer-readable storage medium, such as a memory including program codes, and the above program codes can be executed by a processor to complete the travel calibration method in the above embodiments. For example, the non-volatile computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CDROM), magnetic tape, floppy disk, and optical data storage device, etc.

[0277] The embodiments of the present application further provide a computer program product, which includes one or more program codes, and the program codes are stored in a non-volatile computer-readable storage medium. The processor of the motor controller reads the program codes from the non-volatile computer-readable storage medium, and the processor executes the program codes to complete the method steps of the travel calibration method provided in the above embodiments.

[0278] Those of ordinary skill in the art can understand that all or part of the steps to implement the above embodiments can be completed by hardware, or can be completed by hardware related to program codes through a program. The program can be stored in a non-volatile computer-readable storage medium, and the above-mentioned storage medium can be a read-only memory, a magnetic disk, or an optical disc, etc.

[0279] Through the description of the above embodiments, those of ordinary skill in the art can clearly understand that each embodiment can be implemented by means of software plus a general hardware platform, and of course, it can also be implemented by hardware. Those of ordinary skill in the art can understand that all or part of the processes in the method of implementing the above embodiments can be completed by a computer program instructing relevant hardware. The program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above methods. Among them, the storage medium can be a magnetic disk, an optical disc, a read-only memory (ROM), or a random access memory (RAM), etc.

[0280] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; under the idea of the present application, the technical features in the above embodiments or different embodiments can also be combined, and the steps can be implemented in any order, and there are many other changes in different aspects of the present application as described above. For the sake of brevity, they are not provided in detail; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A stroke calibration method, characterized in that: Applied to an automobile, the automobile comprises a reduction mechanism and an angle sensor, the reduction mechanism comprises an output shaft, and the angle sensor is used to determine the angle of the output shaft; The method comprises: Get the current angle of the output shaft; Based on a first position corresponding to a current angle of the output shaft, controlling the output shaft to rotate from the first position in a first direction to a first locked position to obtain a first locked angle corresponding to the first locked position; Controlling the output shaft to rotate from the first locked position to the second locked position in a second direction to obtain a second locked angle corresponding to the second locked position; The stroke of the output shaft is determined according to the first stall angle, the second stall angle, and a maximum preset angle of the angle sensor.

2. The method according to claim 1, characterized in that: Before obtaining the current angle of the output shaft, the method further includes: Sending an angle reading instruction to the angle sensor, and if angle data fed back by the angle sensor is obtained and the angle data verification is successful, determining the current angle of the output shaft based on the angle data; If the angle data fed back by the angle sensor is obtained and the angle data verification fails, it is determined whether the angle sensor is assembled normally; if the angle sensor is assembled abnormally, it is determined that the angle sensor is in a fault state; or, If the angle data fed back by the angle sensor is not obtained, it is determined whether the angle sensor is assembled normally. If the angle sensor is not assembled normally, it is determined that the angle sensor is in a fault state.

3. The method according to claim 2, characterized in that Determining whether the angle sensor is assembled normally includes: Get the frequency of the pulse width modulation wave; Obtaining a duty cycle of the angle sensor; If the frequency of the pulse width modulation wave is within a preset frequency range, the duty cycle is within a preset duty cycle range, and the processing time is within a preset processing time, it is determined that the angle sensor is assembled normally, wherein the processing time is the time from obtaining the frequency of the pulse width modulation wave to determining that the duty cycle is within the preset duty cycle range; If the frequency of the pulse width modulation wave is not within the preset frequency range, or the duty cycle is not within the preset duty cycle range, or the processing time is not within the preset processing time, it is determined that the angle sensor is not assembled properly.

4. The method according to claim 3, characterized in that The method further comprises: If the angle sensor is assembled normally, the current angle of the output shaft is determined based on the duty cycle, wherein the current angle of the output shaft is (duty cycle / preset value)*maximum preset angle, and the preset value is the maximum preset duty cycle.

5. The method according to claim 2, characterized in that: Determining the stroke of the output shaft according to the first stall angle and the second stall angle in combination with the maximum preset angle of the angle sensor includes: When the first stall angle is greater than the second stall angle, the stroke of the output shaft = maximum preset angle - first stall angle + second stall angle; When the first stall angle is less than or equal to the second stall angle, the stroke of the output shaft=the second stall angle-the first stall angle.

6. The method according to claim 5, characterized in that The method further comprises: Calculate the reporting angle, including: When the first stall angle is greater than the second stall angle, and the current angle of the output shaft is greater than the first stall angle, the reported angle = the current angle of the output shaft - the first stall angle; When the first stall angle is greater than the second stall angle, and the current angle of the output shaft is less than the first stall angle, the reported angle = maximum preset angle - first stall angle + current angle of the output shaft; When the first stall angle is less than or equal to the second stall angle, the reported angle=the current angle of the output shaft-the first stall angle.

7. The method according to claim 6, characterized in that The method further comprises: When the first stall angle is greater than the second stall angle, and the current angle of the output shaft is within a first preset angle range, the current reporting angle is set to a minimum preset angle, wherein the first preset angle range is (first stall angle-angle threshold, first stall angle); When the first stall angle is greater than the second stall angle and the current angle of the output shaft is within a second preset angle range, the current reporting angle is set to a maximum preset angle, wherein the second preset angle range is (second stall angle, second stall angle + angle threshold).

8. The method according to claim 1, characterized in that The automobile further includes a drive motor and a vehicle controller, and the method further includes: Get the current value of the driving motor; Obtaining the maximum current limit value of the vehicle controller; Determining an output signal of the vehicle controller based on the current value of the drive motor and the maximum current limit value; Based on the output signal of the vehicle controller, the output current of the drive motor is adjusted.

9. The method according to claim 8, characterized in that The step of determining the output signal of the vehicle controller based on the current value of the drive motor and the maximum current limit value includes: μ(t)=K p *e(t)+K i *∫e(t)dt Where, μ(t) is the output signal, K p is the proportional gain, K i is the integral gain, e(t)=Iset(t)-Iout(t), Iset(t) is the maximum current limit value, Iout(t) is the current value of the drive motor, and t is the time.

10. A motor controller, characterized in that: include: at least one processor, and a memory communicatively coupled to the at least one processor, wherein: The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the stroke calibration method as described in any one of claims 1 to 9.

11. A stroke calibration system, characterized in that: The system includes a vehicle, the vehicle includes a drive motor, a speed reduction mechanism, an angle sensor, a motor controller as claimed in claim 10, and a vehicle controller, the speed reduction mechanism includes an output shaft, and the angle sensor is used to determine the angle of the output shaft; The motor controller is connected to the vehicle controller and is used to obtain the current angle of the output shaft and determine the first blocking angle and the second blocking angle of the output shaft, and determine the stroke and the reporting angle of the output shaft according to the first blocking angle and the second blocking angle in combination with the maximum preset angle of the angle sensor; The vehicle controller is connected to the motor controller and is used to adjust the output current of the drive motor based on the reported angle.