WO2018145647A1 - Calibration method for magnetic encoder and system - Google Patents

Calibration method for magnetic encoder and system Download PDF

Info

Publication number
WO2018145647A1
WO2018145647A1 PCT/CN2018/075863 CN2018075863W WO2018145647A1 WO 2018145647 A1 WO2018145647 A1 WO 2018145647A1 CN 2018075863 W CN2018075863 W CN 2018075863W WO 2018145647 A1 WO2018145647 A1 WO 2018145647A1
Authority
WO
WIPO (PCT)
Prior art keywords
motor
encoder
data
mechanical angle
driving signal
Prior art date
Application number
PCT/CN2018/075863
Other languages
French (fr)
Chinese (zh)
Inventor
胡华智
胡海生
Original Assignee
亿航智能设备(广州)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Family has litigation
First worldwide family litigation filed litigation Critical https://patents.darts-ip.com/?family=58860512&utm_source=google_patent&utm_medium=platform_link&utm_campaign=public_patent_search&patent=WO2018145647(A1) "Global patent litigation dataset” by Darts-ip is licensed under a Creative Commons Attribution 4.0 International License.
Application filed by 亿航智能设备(广州)有限公司 filed Critical 亿航智能设备(广州)有限公司
Publication of WO2018145647A1 publication Critical patent/WO2018145647A1/en

Links

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01DMEASURING NOT SPECIALLY ADAPTED FOR A SPECIFIC VARIABLE; ARRANGEMENTS FOR MEASURING TWO OR MORE VARIABLES NOT COVERED IN A SINGLE OTHER SUBCLASS; TARIFF METERING APPARATUS; MEASURING OR TESTING NOT OTHERWISE PROVIDED FOR
    • G01D18/00Testing or calibrating apparatus or arrangements provided for in groups G01D1/00 - G01D15/00

Definitions

  • the present invention relates to the field of motor control technologies, and in particular, to a magnetic encoder calibration method and system.
  • An encoder is a device that converts electrical signals or data into a form that can be used for communication, transmission, and storage.
  • the encoder can be further classified into a photoelectric encoder and a magnetic encoder according to its own properties.
  • the magnetic encoder is a new type of angle or displacement measuring device. The principle is to measure the angle or displacement value of the changed magnetic material by magnetoresistive or Hall element. The change of the angle or displacement of the magnetic material will cause a certain resistance or voltage. The change is amplified by the amplifying circuit, and the pulse signal or analog signal is outputted by the single-chip microcomputer to achieve the purpose of measurement. Due to the influence of many non-ideal factors, the output of the magnetic encoder often has errors. The adjustment will inevitably result in a large demodulation error, which needs to be calibrated first.
  • the existing calibration method generally adopts a model-based off-line calibration method with low efficiency and low accuracy.
  • the main object of the present invention is to provide a magnetic encoder calibration method and system, which can improve the calibration efficiency and accuracy of the magnetic encoder.
  • a magnetic encoder calibration method provided by the present invention includes:
  • the encoder data is linearly calibrated using linear interpolation to obtain linearized mechanical angle data.
  • the collecting the encoder data of each step point comprises:
  • the driving signal is sequentially outputted to the motor, so that the motor rotates one revolution according to a mechanical angle, and encoder data of each step point in the process of rotating the motor is acquired.
  • the driving signal includes an initial position driving signal, and an initial position driving signal is output to the motor through the ESC, the motor is rotated to an initial position, and the mechanical angle data at the time is collected, and according to the mechanical angle data. Get the electrical angle offset.
  • the linearly calibrating the encoder data by linear interpolation to obtain linearized mechanical angle data further includes:
  • Performing calibration verification on the encoder data determining whether the encoder data of each step point is incremented, and whether the difference between the encoder data of the adjacent step points is within a preset threshold, and if so, verifying success.
  • the ESC board includes a yaw electric adjustment board, a horizontal rotation adjustment board, and a pitch electric adjustment board, respectively, for controlling the yaw motor, the roll motor, and the motor, and each of the motors is provided with an encoder. .
  • a magnetic encoder calibration system includes a host computer and a servo motor system, and the servo motor system includes an electric adjustment board and a motor, wherein
  • the ESC is configured to drive the motor to rotate in a preset electrical angle; acquire encoder data of each step point; linearly calibrate the encoder data by linear interpolation to obtain linearization Mechanical angle data;
  • the upper computer is configured to interact with an electrical regulation board.
  • the collecting the encoder data of each step point comprises:
  • the driving signal is sequentially outputted to the motor, so that the motor rotates one revolution according to a mechanical angle, and encoder data of each step point in the process of rotating the motor is acquired.
  • the driving signal includes an initial position driving signal, and an initial position driving signal is output to the motor through the ESC, the motor is rotated to an initial position, and the mechanical angle data at the time is collected, and according to the mechanical angle data. Get the electrical angle offset.
  • the upper computer is further configured to:
  • Performing calibration verification on the encoder data determining whether the encoder data of each step point is incremented, and whether the difference between the encoder data of the adjacent step points is within a preset threshold, and if so, verifying success.
  • the ESC board includes a yaw electric adjustment board, a horizontal rotation adjustment board, and a pitch electric adjustment board, respectively, for controlling the yaw motor, the roll motor, and the motor, and each of the motors is provided with an encoder. .
  • a method and system for calibrating a magnetic encoder according to the present invention includes: driving a motor through a preset plate at a preset electrical angle; acquiring encoder data of each step point; using linear interpolation The encoder data is linearly calibrated to obtain linearized mechanical angle data, which can improve the calibration efficiency and accuracy of the magnetic encoder.
  • FIG. 1 is a flowchart of a magnetic encoder calibration method according to Embodiment 1 of the present invention.
  • FIG. 2 is a block diagram showing an exemplary structure of a magnetic encoder calibration system according to Embodiment 2 of the present invention.
  • a magnetic encoder calibration method includes:
  • the calibration method can be automatically performed, and each motor and the ESC can be separately calibrated to improve the calibration efficiency and accuracy of the magnetic encoder.
  • the ESC is connected to the host computer through a Controller Area Network (CAN) bus.
  • CAN Controller Area Network
  • the upper computer is configured to send an electrical angle calibration command, a verification command, and the like to the ESC, and receive a success signal, a failure signal, and other interaction signals returned by the ESC.
  • the ESC includes a yaw yaw, a roll ESC roll, and a pitch ESC pitch for controlling a yaw motor, a roll motor, and a motor, respectively.
  • the method is used in the production line step.
  • the ESC and the motor are completely installed, the PTZ is not completely assembled, and the motor rotation motion is not limited by the position of the PTZ to the motor, and the motor can rotate freely.
  • the yaw, roll, and pitch ESCs are connected via the CAN bus and connected to the PC host computer with the USBCAN switch.
  • the preset electrical angle is an electrical angle value set by the system according to calibration accuracy or user requirements, such as 60°, 90°, or 120°, etc., which is convenient for calculation, and the electrical angle is 60.
  • the motor can be rotated 60° every step, and it can be rotated one turn according to the electrical angle.
  • the angle 360°/p occupied by each pair of poles on the inner circle of the stator refers to the actual spatial geometric angle, which is called the mechanical angle; the number of poles at the quadrupole and above (p ⁇ 4)
  • the motor usually defines the mechanical angle of a pair of poles as 360 degrees of electrical angle, because the induced potential change in the winding is 360° for one cycle; for the two-pole motor, the electrical angle of the stator inner circle and the mechanical angle The angles are equal to 360°; for the p-pole motor, the electrical angle of the stator inner circle is 360°*p, but the mechanical angle is still 360°, so the two have the following relationship:
  • the number of pole pairs of the stator is four pairs, and the relationship between the electrical angle and the mechanical angle is four times.
  • the number of pole pairs of the stator may also be other numbers, which can be calibrated by the method.
  • step S20 includes:
  • the driving signal is sequentially outputted to the motor, so that the motor rotates one revolution according to a mechanical angle, and encoder data of each step point in the process of rotating the motor is acquired.
  • the driving signal includes an initial position driving signal, and an initial position driving signal is output to the motor through the ESC, and the motor is rotated to an initial position, and the mechanical angle data at this time is collected, and according to the mechanical The angle data obtains the electrical angle zero offset.
  • the host computer sends an electrical angle calibration command through the CAN bus, and after receiving the calibration command, the ESC closes the servo control loop, including the angle loop, the speed loop, the current loop, and the space vector pulse width modulation (Space).
  • Vector Pulse Width Modulation) SVPWM unit switching from SVPWM mode to pulse width modulation (Pulse Width) Modulation) PWM mode, the ESC sends a motor (0, T, T) signal to the motor to an electrical angle of -180°, where the (0, T, T) signal is the initial position drive signal, (0, The T, T) signal indicates that one of the three-phase motors is not energized (indicated by 0), the other two phases are energized (indicated by T), and the motor is locked by the degree of change in the encoder data, if the motor is locked Dead, indicating that the motor has reached the stepping point according to the driving signal, record the mechanical angle data given by the encoder at this time, until the motor completes
  • the following (0, T, T), (0, 0, T), (T, 0, T), (T, 0, 0), (T, T) are sequentially output to the motor.
  • the drive motor is stepped in the positive direction of the electrical angle, and each step further determines whether the motor has reached the step point through the encoder data until the motor has reached the step point, and then outputs
  • One step PWM signal continues to drive the motor forward, the step angle is 60°, and the encoder data at the stepping point is recorded in turn until the motor rotates the mechanical angle one turn and is written into RAM and FALSH for linearization.
  • the processing is used, and finally the end signal is returned to the upper machine.
  • the data collected by the encoder is mechanical angle data.
  • the electrical angle is rotated by 60°, according to the conversion relationship between the electrical angle and the mechanical angle, the mechanical angle of the motor is rotated by 15°.
  • the method is to calibrate by collecting the encoder data of each step point in the process of rotating the motor according to the mechanical angle. Therefore, it is necessary to rotate the motor 4 times according to the electrical angle, and a total of 24 mechanical angle data are collected, due to numerous These mechanical angle data are nonlinear in the influence of non-ideal factors, which requires linearization of these mechanical angle data.
  • the preset electrical angle is 90°
  • the number of driving signals is four, and the specific algorithm is prior art, and details are not described herein.
  • the linearization calibration uses a linear interpolation method, using the actual electrical angle as a reference point, linearly interpolating the original mechanical angle of the encoder, outputting the linearized mechanical angle data, and linearizing the mechanical angle. Multiply the pole log p into an electrical angle unit and subtract the electrical angle to obtain the electrical angle. Finally, the output is used by the SVPWM module.
  • the linearized mechanical angle minus the mechanical angle zero-bias output mechanical angle gives the servo loop position servo control or output to the attitude loop for attitude decoupling control.
  • the method before the step S30, the method further includes:
  • the ESC Performing calibration verification on the encoder data, determining whether the encoder data of each step point is incremented, and whether the difference between the encoder data of the adjacent step points is within a preset threshold, and if so, verifying Successfully, the ESC returns a success signal to the upper computer. If the condition is not met, the failure signal is returned.
  • the purpose of the calibration verification step is to eliminate the calibration failure. When the calibration process has external force to hinder the motor movement, or due to the motor itself, for example. One of the three phase lines is open, which will cause the calibration to fail.
  • a magnetic encoder calibration system includes a host computer 10 and a servo motor system, and the servo motor system includes an electric adjustment board 20 and a motor 30, wherein
  • the ESC is configured to drive the motor to rotate in a preset electrical angle; acquire encoder data of each step point; linearly calibrate the encoder data by linear interpolation to obtain linearization Mechanical angle data;
  • the upper computer is configured to interact with an electrical regulation board.
  • the calibration method can be automatically performed, and each motor and the ESC can be separately calibrated to improve the calibration efficiency and accuracy of the magnetic encoder.
  • the ESC is connected to the host computer through a Controller Area Network (CAN) bus.
  • CAN Controller Area Network
  • the upper computer is configured to send an electrical angle calibration command, a verification command, and the like to the ESC, and receive a success signal, a failure signal, and other interaction signals returned by the ESC.
  • the ESC includes a yaw yaw, a roll ESC roll, and a pitch ESC pitch for controlling a yaw motor, a roll motor, and a motor, respectively.
  • the method is used in the production line step.
  • the ESC and the motor are completely installed, the PTZ is not completely assembled, and the motor rotation motion is not limited by the position of the PTZ to the motor, and the motor can rotate freely.
  • the yaw, roll, and pitch ESCs are connected via the CAN bus and connected to the PC host computer with the USBCAN switch.
  • the preset electrical angle is an electrical angle value set by the system according to calibration accuracy or user requirements, such as 60°, 90°, or 120°, etc., which is convenient for calculation, and the electrical angle is 60.
  • the motor can be rotated 60° every step, and it can be rotated one turn according to the electrical angle.
  • the angle 360°/p occupied by each pair of poles on the inner circle of the stator refers to the actual spatial geometric angle, which is called the mechanical angle; the number of poles at the quadrupole and above (p ⁇ 4)
  • the motor usually defines the mechanical angle of a pair of poles as 360 degrees of electrical angle, because the induced potential change in the winding is 360° for one cycle; for the two-pole motor, the electrical angle of the stator inner circle and the mechanical angle The angles are equal to 360°; for the p-pole motor, the electrical angle of the stator inner circle is 360°*p, but the mechanical angle is still 360°, so the two have the following relationship:
  • the number of pole pairs of the stator is four pairs, and the relationship between the electrical angle and the mechanical angle is four times.
  • the number of pole pairs of the stator may also be other numbers, which can be calibrated by the method.
  • the collecting encoder data of each step point includes:
  • the driving signal is sequentially outputted to the motor, so that the motor rotates one revolution according to a mechanical angle, and encoder data of each step point in the process of rotating the motor is acquired.
  • the driving signal includes an initial position driving signal, and an initial position driving signal is output to the motor through the ESC, and the motor is rotated to an initial position, and the mechanical angle data at this time is collected, and according to the mechanical The angle data obtains the electrical angle zero offset.
  • the host computer sends an electrical angle calibration command through the CAN bus, and after receiving the calibration command, the motor board turns off the servo control loop, including the angle loop, the speed loop, the current loop, and the space vector pulse width modulation (Space Vector Pulse Width Modulation) SVPWM unit, switching from SVPWM mode to pulse width modulation (Pulse Width) Modulation) PWM mode, the ESC sends a motor (0, T, T) signal to the motor to an electrical angle of -180°, where the (0, T, T) signal is the initial position drive signal, (0, The T, T) signal indicates that one of the three-phase motors is not energized (indicated by 0), the other two phases are energized (indicated by T), and the motor is locked by the degree of change in the encoder data, if the motor is locked Dead, indicating that the motor has reached the stepping point according to the driving signal, record the mechanical angle data given by the encoder at this time, until the motor completes the
  • the following (0, T, T), (0, 0, T), (T, 0, T), (T, 0, 0), (T, T) are sequentially output to the motor.
  • the drive motor is stepped in the positive direction of the electrical angle, and each step further determines whether the motor has reached the step point through the encoder data until the motor has reached the step point, and then outputs
  • One step PWM signal continues to drive the motor forward, the step angle is 60°, and the encoder data at the stepping point is recorded in turn until the motor rotates the mechanical angle one turn and is written into RAM and FALSH for linearization.
  • the processing is used, and finally the end signal is returned to the upper machine.
  • the data collected by the encoder is mechanical angle data.
  • the electrical angle is rotated by 60°, according to the conversion relationship between the electrical angle and the mechanical angle, the mechanical angle of the motor is rotated by 15°.
  • the method is to calibrate by collecting the encoder data of each step point in the process of rotating the motor according to the mechanical angle. Therefore, it is necessary to rotate the motor 4 times according to the electrical angle, and a total of 24 mechanical angle data are collected, due to numerous These mechanical angle data are nonlinear in the influence of non-ideal factors, which requires linearization of these mechanical angle data.
  • the preset electrical angle is 90°
  • the number of driving signals is four, and the specific algorithm is prior art, and details are not described herein.
  • the linearization calibration uses a linear interpolation method, using the actual electrical angle as a reference point, linearly interpolating the original mechanical angle of the encoder, outputting the linearized mechanical angle data, and linearizing the mechanical angle. Multiply the pole log p into an electrical angle unit and subtract the electrical angle to obtain the electrical angle. Finally, the output is used by the SVPWM module.
  • the linearized mechanical angle minus the mechanical angle zero-bias output mechanical angle gives the servo loop position servo control or output to the attitude loop for attitude decoupling control.
  • the upper computer is further configured to:
  • the motor board Performing calibration verification on the encoder data, determining whether the encoder data of each step point is incremented, and whether the difference between the encoder data of the adjacent step points is within a preset threshold, and if so, verifying Successfully, the motor board returns a success signal to the upper machine. If the condition is not met, the failure signal is returned.
  • the purpose of the calibration verification step is to eliminate the calibration failure. When the calibration process has external force to hinder the motor movement, or due to the motor itself, such as three A phase line break in the phase line will cause the calibration to fail.
  • the foregoing embodiment method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be through hardware, but in many cases, the former is better.
  • Implementation Based on such understanding, the technical solution of the present invention, which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk,
  • the optical disc includes a number of instructions for causing a terminal device (which may be a cell phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the methods described in various embodiments of the present invention.
  • the magnetic encoder calibration method and system provided by the invention are driven by a motor to drive the motor to rotate at a preset electrical angle; the encoder data of each step point is collected; and the encoder data is linearly interpolated. Linear calibration is performed to obtain linearized mechanical angle data, which can improve the calibration efficiency and accuracy of the magnetic encoder. Therefore, it has industrial applicability.

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Transmission And Conversion Of Sensor Element Output (AREA)
  • Control Of Stepping Motors (AREA)

Abstract

A calibration method for a magnetic encoder and a system, which relate to the technical field of motor control, the method comprising: driving a motor (30) by means of an electric adjusting board (20) to rotate step-wise by using a preset electric angle; acquiring encoder data of each step point; performing linearization calibration on the encoder data by using a linear interpolation method to obtain linearized data of a mechanical angle, which may improve the calibration efficiency and accuracy of the magnetic encoder.

Description

一种磁编码器校准方法及系统Magnetic encoder calibration method and system 技术领域Technical field
本发明涉及电机控制技术领域,尤其涉及一种磁编码器校准方法及系统。The present invention relates to the field of motor control technologies, and in particular, to a magnetic encoder calibration method and system.
背景技术Background technique
编码器(Encoder)是将电信号或数据转换成为可用以通讯、传输和存储的信号形式的设备,编码器按照本身属性又可以分为光电编码器和磁编码器。磁编码器是一种新型的角度或者位移测量装置,其原理是采用磁阻或者霍尔元件对变化的磁性材料的角度或者位移值进行测量,磁性材料角度或者位移的变化会引起一定电阻或者电压的变化,通过放大电路对变化量进行放大,通过单片机处理后输出脉冲信号或者模拟量信号,达到测量的目的,由于众多非理想因素的影响,磁编码器的输出往往存在误差,若直接进行解调,必将造成较大的解调误差,需先对其进行校准,现有的校准方法一般采用基于模型的离线校准方法,效率较低,准确性不高。An encoder is a device that converts electrical signals or data into a form that can be used for communication, transmission, and storage. The encoder can be further classified into a photoelectric encoder and a magnetic encoder according to its own properties. The magnetic encoder is a new type of angle or displacement measuring device. The principle is to measure the angle or displacement value of the changed magnetic material by magnetoresistive or Hall element. The change of the angle or displacement of the magnetic material will cause a certain resistance or voltage. The change is amplified by the amplifying circuit, and the pulse signal or analog signal is outputted by the single-chip microcomputer to achieve the purpose of measurement. Due to the influence of many non-ideal factors, the output of the magnetic encoder often has errors. The adjustment will inevitably result in a large demodulation error, which needs to be calibrated first. The existing calibration method generally adopts a model-based off-line calibration method with low efficiency and low accuracy.
技术问题technical problem
本发明的主要目的在于提出一种磁编码器校准方法及系统,能够提高磁编码器的校准效率和准确性。The main object of the present invention is to provide a magnetic encoder calibration method and system, which can improve the calibration efficiency and accuracy of the magnetic encoder.
技术解决方案Technical solution
为实现上述目的,本发明提供的一种磁编码器校准方法,包括:To achieve the above object, a magnetic encoder calibration method provided by the present invention includes:
通过电调板驱动电机以预设的电角度步进旋转;Driving the motor through the ESC to rotate at a preset electrical angle;
采集每个步进点的编码器数据;Collect encoder data for each step point;
采用线性插值法对所述编码器数据进行线性化校准,得到线性化的机械角度数据。The encoder data is linearly calibrated using linear interpolation to obtain linearized mechanical angle data.
可选地,所述采集每个步进点的编码器数据包括:Optionally, the collecting the encoder data of each step point comprises:
根据所述预设的电角度计算所述电机的驱动信号;Calculating a driving signal of the motor according to the preset electrical angle;
依次向所述电机输出所述驱动信号,使所述电机按照机械角度旋转一圈,采集所述电机旋转一圈过程中每个步进点的编码器数据。The driving signal is sequentially outputted to the motor, so that the motor rotates one revolution according to a mechanical angle, and encoder data of each step point in the process of rotating the motor is acquired.
可选地,所述驱动信号包括初始位置驱动信号,通过电调板向电机输出初始位置驱动信号,使所述电机转动到初始位置,采集此时的机械角度数据,并根据所述机械角度数据获取电角度零偏。Optionally, the driving signal includes an initial position driving signal, and an initial position driving signal is output to the motor through the ESC, the motor is rotated to an initial position, and the mechanical angle data at the time is collected, and according to the mechanical angle data. Get the electrical angle offset.
可选地,所述采用线性插值法对所述编码器数据进行线性化校准,得到线性化的机械角度数据之前还包括:Optionally, the linearly calibrating the encoder data by linear interpolation to obtain linearized mechanical angle data further includes:
对所述编码器数据进行校准验证,判断所述每个步进点的编码器数据是否递增,且相邻步进点的编码器数据的差值是否在预设的阈值内,若是,则验证成功。Performing calibration verification on the encoder data, determining whether the encoder data of each step point is incremented, and whether the difference between the encoder data of the adjacent step points is within a preset threshold, and if so, verifying success.
可选地,所述电调板包括偏航电调板、横滚电调板和俯仰电调板,分别用于控制偏航电机、横滚电机和电机,每个电机上设置有一个编码器。Optionally, the ESC board includes a yaw electric adjustment board, a horizontal rotation adjustment board, and a pitch electric adjustment board, respectively, for controlling the yaw motor, the roll motor, and the motor, and each of the motors is provided with an encoder. .
作为本发明的另一方面,提供的一种磁编码器校准系统,包括上位机和伺服电机系统,所述伺服电机系统包括电调板和电机,其中,As another aspect of the present invention, a magnetic encoder calibration system includes a host computer and a servo motor system, and the servo motor system includes an electric adjustment board and a motor, wherein
所述电调板,用于驱动电机以预设的电角度步进旋转;采集每个步进点的编码器数据;采用线性插值法对所述编码器数据进行线性化校准,得到线性化的机械角度数据;The ESC is configured to drive the motor to rotate in a preset electrical angle; acquire encoder data of each step point; linearly calibrate the encoder data by linear interpolation to obtain linearization Mechanical angle data;
所述上位机,用于与电调板进行交互。The upper computer is configured to interact with an electrical regulation board.
可选地,所述采集每个步进点的编码器数据包括:Optionally, the collecting the encoder data of each step point comprises:
根据所述预设的电角度计算所述电机的驱动信号;Calculating a driving signal of the motor according to the preset electrical angle;
依次向所述电机输出所述驱动信号,使所述电机按照机械角度旋转一圈,采集所述电机旋转一圈过程中每个步进点的编码器数据。The driving signal is sequentially outputted to the motor, so that the motor rotates one revolution according to a mechanical angle, and encoder data of each step point in the process of rotating the motor is acquired.
可选地,所述驱动信号包括初始位置驱动信号,通过电调板向电机输出初始位置驱动信号,使所述电机转动到初始位置,采集此时的机械角度数据,并根据所述机械角度数据获取电角度零偏。Optionally, the driving signal includes an initial position driving signal, and an initial position driving signal is output to the motor through the ESC, the motor is rotated to an initial position, and the mechanical angle data at the time is collected, and according to the mechanical angle data. Get the electrical angle offset.
可选地,所述上位机还用于:Optionally, the upper computer is further configured to:
对所述编码器数据进行校准验证,判断所述每个步进点的编码器数据是否递增,且相邻步进点的编码器数据的差值是否在预设的阈值内,若是,则验证成功。Performing calibration verification on the encoder data, determining whether the encoder data of each step point is incremented, and whether the difference between the encoder data of the adjacent step points is within a preset threshold, and if so, verifying success.
可选地,所述电调板包括偏航电调板、横滚电调板和俯仰电调板,分别用于控制偏航电机、横滚电机和电机,每个电机上设置有一个编码器。Optionally, the ESC board includes a yaw electric adjustment board, a horizontal rotation adjustment board, and a pitch electric adjustment board, respectively, for controlling the yaw motor, the roll motor, and the motor, and each of the motors is provided with an encoder. .
有益效果Beneficial effect
本发明提出的一种磁编码器校准方法及系统,该方法包括:通过电调板驱动电机以预设的电角度步进旋转;采集每个步进点的编码器数据;采用线性插值法对所述编码器数据进行线性化校准,得到线性化的机械角度数据,能够提高磁编码器的校准效率和准确性。A method and system for calibrating a magnetic encoder according to the present invention includes: driving a motor through a preset plate at a preset electrical angle; acquiring encoder data of each step point; using linear interpolation The encoder data is linearly calibrated to obtain linearized mechanical angle data, which can improve the calibration efficiency and accuracy of the magnetic encoder.
附图说明DRAWINGS
图1为本发明实施例一提供的一种磁编码器校准方法流程图;1 is a flowchart of a magnetic encoder calibration method according to Embodiment 1 of the present invention;
图2为本发明实施例二提供的一种磁编码器校准系统示范性结构框图。FIG. 2 is a block diagram showing an exemplary structure of a magnetic encoder calibration system according to Embodiment 2 of the present invention.
本发明目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The implementation, functional features, and advantages of the present invention will be further described in conjunction with the embodiments.
本发明的实施方式Embodiments of the invention
应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。It is understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
在后续的描述中,使用用于表示元件的诸如“模块”、“部件”或“单元”的后缀仅为了有利于本发明的说明,其本身并没有特定的意义。因此,"模块"与"部件"可以混合地使用。In the following description, the use of suffixes such as "module", "component" or "unit" for indicating an element is merely an explanation for facilitating the present invention, and does not have a specific meaning per se. Therefore, "module" and "component" can be used in combination.
实施例一Embodiment 1
如图1所示,在本实施例中,一种磁编码器校准方法,包括:As shown in FIG. 1, in this embodiment, a magnetic encoder calibration method includes:
S10、通过电调板驱动电机以预设的电角度步进旋转;S10, driving the motor through the ESC to rotate at a preset electrical angle;
S20、采集每个步进点的编码器数据;S20. Collect encoder data of each step point;
S30、采用线性插值法对所述编码器数据进行线性化校准,得到线性化的机械角度数据。S30. Perform linearization calibration on the encoder data by linear interpolation to obtain linearized mechanical angle data.
在本实施例中,本校准方法可自动执行,也可以对每个电机及电调板进行单独校准,能够提高磁编码器的校准效率和准确性。In this embodiment, the calibration method can be automatically performed, and each motor and the ESC can be separately calibrated to improve the calibration efficiency and accuracy of the magnetic encoder.
在本实施例中,所述电调板通过控制器局域网(Controller Area Network)CAN总线与上位机连接。In this embodiment, the ESC is connected to the host computer through a Controller Area Network (CAN) bus.
在本实施例中,所述上位机用于向电调板发送电角度校准指令、验证指令等,并接收电调板返回的成功信号、失败信号及其他交互信号。In this embodiment, the upper computer is configured to send an electrical angle calibration command, a verification command, and the like to the ESC, and receive a success signal, a failure signal, and other interaction signals returned by the ESC.
在本实施例中,所述电调板包括偏航电调板yaw、横滚电调板roll和俯仰电调板pitch,分别用于控制偏航电机、横滚电机和电机,每个电机上设置有一个编码器。In this embodiment, the ESC includes a yaw yaw, a roll ESC roll, and a pitch ESC pitch for controlling a yaw motor, a roll motor, and a motor, respectively. There is an encoder set.
在本实施例中,该方法使用于产线步骤中,此时,电调板与电机完整安装,云台未完整装配,电机旋转运动未受云台对电机的卡位限制,电机能自由旋转一圈,yaw、roll、pitch电调板通过CAN总线连接,并同过USBCAN转接与PC上位机连接。In this embodiment, the method is used in the production line step. At this time, the ESC and the motor are completely installed, the PTZ is not completely assembled, and the motor rotation motion is not limited by the position of the PTZ to the motor, and the motor can rotate freely. In one lap, the yaw, roll, and pitch ESCs are connected via the CAN bus and connected to the PC host computer with the USBCAN switch.
在本实施例中,所述预设的电角度是系统根据校准精度或用户要求来设置的电角度值,如60°、90°或120°等便于计算的电角度值,以电角度为60°为例,电机就可以每一步旋转60°,旋转6次既可以按照电角度旋转一圈。In this embodiment, the preset electrical angle is an electrical angle value set by the system according to calibration accuracy or user requirements, such as 60°, 90°, or 120°, etc., which is convenient for calculation, and the electrical angle is 60. ° For example, the motor can be rotated 60° every step, and it can be rotated one turn according to the electrical angle.
在本实施例中,电机每对极在定子内圆上所占的角度360°/p指的是实际的空间几何角度,这个角度被称为机械角度;在四极及以上极数(p≥4)的电机中常常把一对极所占的机械角度定义为360度电角度,这是因为绕组中感应电势变化一个周期为360°;对于两极电机,其定子内圆所占电角度和机械角度相等均为360°;而p对极电机, 其定子内圆全部电角度为360°*p,但机械角度却仍为360°,所以二者存在以下关系:In this embodiment, the angle 360°/p occupied by each pair of poles on the inner circle of the stator refers to the actual spatial geometric angle, which is called the mechanical angle; the number of poles at the quadrupole and above (p≥ 4) The motor usually defines the mechanical angle of a pair of poles as 360 degrees of electrical angle, because the induced potential change in the winding is 360° for one cycle; for the two-pole motor, the electrical angle of the stator inner circle and the mechanical angle The angles are equal to 360°; for the p-pole motor, the electrical angle of the stator inner circle is 360°*p, but the mechanical angle is still 360°, so the two have the following relationship:
电角度=机械角度×极对数Electrical angle = mechanical angle × pole pair
在本实施例中,定子的极对数为4对,则电角度与机械角度之间的关系为4倍。In the present embodiment, the number of pole pairs of the stator is four pairs, and the relationship between the electrical angle and the mechanical angle is four times.
作为另一种实施例,所述定子的极对数也可以是其他数量,皆可以采用本方法进行校准。As another embodiment, the number of pole pairs of the stator may also be other numbers, which can be calibrated by the method.
在本实施例中,所述步骤S20包括:In this embodiment, the step S20 includes:
根据所述预设的电角度计算所述电机的驱动信号;Calculating a driving signal of the motor according to the preset electrical angle;
依次向所述电机输出所述驱动信号,使所述电机按照机械角度旋转一圈,采集所述电机旋转一圈过程中每个步进点的编码器数据。The driving signal is sequentially outputted to the motor, so that the motor rotates one revolution according to a mechanical angle, and encoder data of each step point in the process of rotating the motor is acquired.
在本实施例中,所述驱动信号包括初始位置驱动信号,通过电调板向电机输出初始位置驱动信号,使所述电机转动到初始位置,采集此时的机械角度数据,并根据所述机械角度数据获取电角度零偏。In this embodiment, the driving signal includes an initial position driving signal, and an initial position driving signal is output to the motor through the ESC, and the motor is rotated to an initial position, and the mechanical angle data at this time is collected, and according to the mechanical The angle data obtains the electrical angle zero offset.
在本实施例中,上位机通过CAN总线发送电角度校准指令,电调板接收到校准指令后,关闭伺服控制环,包括角度环、速度环、电流环以及空间矢量脉宽调制(Space Vector Pulse Width Modulation)SVPWM单元,从SVPWM模式切换到脉宽调制(Pulse Width Modulation)PWM模式,电调板向电机输出 (0,T,T)信号驱动电机到电角度-180°处,此处,(0,T,T)信号即为初始位置驱动信号,(0,T,T)信号表示三相电机中其中一相没有通电(以0表示),其他两相通电(以T表示),并通过编码器数据变化程度判断电机是否已经被锁死,若电机已锁死,表示电机已经按照驱动信号到达步进点,记录下此时编码器给出的机械角数据,直到电机完成线性化校准回到校准起始点,对比起始点与终止点的机械角度数据,若相差位于阈值以内,判定此次校准成功,此时把线性化后的机械角度转换成电角度并加上-180°,写入FALSH中作为电角度零偏。In this embodiment, the host computer sends an electrical angle calibration command through the CAN bus, and after receiving the calibration command, the ESC closes the servo control loop, including the angle loop, the speed loop, the current loop, and the space vector pulse width modulation (Space). Vector Pulse Width Modulation) SVPWM unit, switching from SVPWM mode to pulse width modulation (Pulse Width) Modulation) PWM mode, the ESC sends a motor (0, T, T) signal to the motor to an electrical angle of -180°, where the (0, T, T) signal is the initial position drive signal, (0, The T, T) signal indicates that one of the three-phase motors is not energized (indicated by 0), the other two phases are energized (indicated by T), and the motor is locked by the degree of change in the encoder data, if the motor is locked Dead, indicating that the motor has reached the stepping point according to the driving signal, record the mechanical angle data given by the encoder at this time, until the motor completes the linear calibration and returns to the calibration starting point, comparing the mechanical angle data of the starting point and the ending point, if The phase difference is within the threshold, and it is determined that the calibration is successful. At this time, the linearized mechanical angle is converted into an electrical angle and added to -180°, and written into FALSH as an electrical angle zero offset.
在执行上述电角度校准步骤后,依次向电机输出以下 (0,T,T)、( 0,0,T)、(T, 0,T)、(T,0,0)、(T,T,0)、(0,T,0),驱动电机沿电角度正方向步进,每步进一步都通过编码器数据判断电机是否已到达步进点,直到电机已到达步进点,才输出下一步的PWM信号,继续驱动电机前进,步进角度为电角度60°,并依次记录所在步进点的编码器数据,直到电机旋转完机械角一圈,写入RAM和FALSH中,供线性化处理使用,最后向上位机回复结束信号。After performing the above electrical angle calibration step, the following (0, T, T), (0, 0, T), (T, 0, T), (T, 0, 0), (T, T) are sequentially output to the motor. , 0), (0, T, 0), the drive motor is stepped in the positive direction of the electrical angle, and each step further determines whether the motor has reached the step point through the encoder data until the motor has reached the step point, and then outputs One step PWM signal continues to drive the motor forward, the step angle is 60°, and the encoder data at the stepping point is recorded in turn until the motor rotates the mechanical angle one turn and is written into RAM and FALSH for linearization. The processing is used, and finally the end signal is returned to the upper machine.
在本实施例中,所述编码器采集到的数据为机械角度数据,当电角度旋转60°时,根据电角度与机械角度之间的转换关系可知,电机的机械角度旋转15°,而本方法是通过采集电机按照机械角度旋转一圈过程中每个步进点的编码器数据来进行校准的,因此就需要需要电机按照电角度旋转4圈,共需采集24次机械角度数据,由于众多非理想因素的影响,这些机械角度数据呈非线性关系,这就需要对这些机械角度数据进行线性化。In this embodiment, the data collected by the encoder is mechanical angle data. When the electrical angle is rotated by 60°, according to the conversion relationship between the electrical angle and the mechanical angle, the mechanical angle of the motor is rotated by 15°. The method is to calibrate by collecting the encoder data of each step point in the process of rotating the motor according to the mechanical angle. Therefore, it is necessary to rotate the motor 4 times according to the electrical angle, and a total of 24 mechanical angle data are collected, due to numerous These mechanical angle data are nonlinear in the influence of non-ideal factors, which requires linearization of these mechanical angle data.
作为另一种实施例,所述预设的电角度为90°时,驱动信号的数量为4个,具体算法为现有技术,兹不赘述。As another embodiment, when the preset electrical angle is 90°, the number of driving signals is four, and the specific algorithm is prior art, and details are not described herein.
在本实施例中,线性化校准使用线性插值的方法,以实际电角度作为参考点,对编码器的原始机械角进行线性插值处理,输出线性化后的机械角度数据,线性化后的机械角度乘以极对数p转化成电角度单位并减去电角度零偏得到电角度,最后输出给SVPWM模块使用。线性化后的机械角度减去机械角度零偏输出机械角度给伺服环进行位置伺服控制或输出给姿态环用于姿态的解耦控制。In the present embodiment, the linearization calibration uses a linear interpolation method, using the actual electrical angle as a reference point, linearly interpolating the original mechanical angle of the encoder, outputting the linearized mechanical angle data, and linearizing the mechanical angle. Multiply the pole log p into an electrical angle unit and subtract the electrical angle to obtain the electrical angle. Finally, the output is used by the SVPWM module. The linearized mechanical angle minus the mechanical angle zero-bias output mechanical angle gives the servo loop position servo control or output to the attitude loop for attitude decoupling control.
在本实施例中,所述步骤S30之前还包括:In this embodiment, before the step S30, the method further includes:
对所述编码器数据进行校准验证,判断所述每个步进点的编码器数据是否递增,且相邻步进点的编码器数据的差值是否在预设的阈值内,若是,则验证成功,电调板向上位机返回成功信号,不符合条件时,回复失败信号;校准验证步骤目的是为了排除出校准失败的情况,当校准过程有外力阻碍电机运动,或者由于电机本身问题,比如三相线中有某一相线断路,会导致校准失败。 Performing calibration verification on the encoder data, determining whether the encoder data of each step point is incremented, and whether the difference between the encoder data of the adjacent step points is within a preset threshold, and if so, verifying Successfully, the ESC returns a success signal to the upper computer. If the condition is not met, the failure signal is returned. The purpose of the calibration verification step is to eliminate the calibration failure. When the calibration process has external force to hinder the motor movement, or due to the motor itself, for example. One of the three phase lines is open, which will cause the calibration to fail.
实施例二Embodiment 2
如图2所示,在本实施例中,一种磁编码器校准系统,包括上位机10和伺服电机系统,所述伺服电机系统包括电调板20和电机30,其中,As shown in FIG. 2, in the embodiment, a magnetic encoder calibration system includes a host computer 10 and a servo motor system, and the servo motor system includes an electric adjustment board 20 and a motor 30, wherein
所述电调板,用于驱动电机以预设的电角度步进旋转;采集每个步进点的编码器数据;采用线性插值法对所述编码器数据进行线性化校准,得到线性化的机械角度数据;The ESC is configured to drive the motor to rotate in a preset electrical angle; acquire encoder data of each step point; linearly calibrate the encoder data by linear interpolation to obtain linearization Mechanical angle data;
所述上位机,用于与电调板进行交互。The upper computer is configured to interact with an electrical regulation board.
在本实施例中,本校准方法可自动执行,也可以对每个电机及电调板进行单独校准,能够提高磁编码器的校准效率和准确性。In this embodiment, the calibration method can be automatically performed, and each motor and the ESC can be separately calibrated to improve the calibration efficiency and accuracy of the magnetic encoder.
在本实施例中,所述电调板通过控制器局域网(Controller Area Network)CAN总线与上位机连接。In this embodiment, the ESC is connected to the host computer through a Controller Area Network (CAN) bus.
在本实施例中,所述上位机用于向电调板发送电角度校准指令、验证指令等,并接收电调板返回的成功信号、失败信号及其他交互信号。In this embodiment, the upper computer is configured to send an electrical angle calibration command, a verification command, and the like to the ESC, and receive a success signal, a failure signal, and other interaction signals returned by the ESC.
在本实施例中,所述电调板包括偏航电调板yaw、横滚电调板roll和俯仰电调板pitch,分别用于控制偏航电机、横滚电机和电机,每个电机上设置有一个编码器。In this embodiment, the ESC includes a yaw yaw, a roll ESC roll, and a pitch ESC pitch for controlling a yaw motor, a roll motor, and a motor, respectively. There is an encoder set.
在本实施例中,该方法使用于产线步骤中,此时,电调板与电机完整安装,云台未完整装配,电机旋转运动未受云台对电机的卡位限制,电机能自由旋转一圈,yaw、roll、pitch电调板通过CAN总线连接,并同过USBCAN转接与PC上位机连接。In this embodiment, the method is used in the production line step. At this time, the ESC and the motor are completely installed, the PTZ is not completely assembled, and the motor rotation motion is not limited by the position of the PTZ to the motor, and the motor can rotate freely. In one lap, the yaw, roll, and pitch ESCs are connected via the CAN bus and connected to the PC host computer with the USBCAN switch.
在本实施例中,所述预设的电角度是系统根据校准精度或用户要求来设置的电角度值,如60°、90°或120°等便于计算的电角度值,以电角度为60°为例,电机就可以每一步旋转60°,旋转6次既可以按照电角度旋转一圈。In this embodiment, the preset electrical angle is an electrical angle value set by the system according to calibration accuracy or user requirements, such as 60°, 90°, or 120°, etc., which is convenient for calculation, and the electrical angle is 60. ° For example, the motor can be rotated 60° every step, and it can be rotated one turn according to the electrical angle.
在本实施例中,电机每对极在定子内圆上所占的角度360°/p指的是实际的空间几何角度,这个角度被称为机械角度;在四极及以上极数(p≥4)的电机中常常把一对极所占的机械角度定义为360度电角度,这是因为绕组中感应电势变化一个周期为360°;对于两极电机,其定子内圆所占电角度和机械角度相等均为360°;而p对极电机, 其定子内圆全部电角度为360°*p,但机械角度却仍为360°,所以二者存在以下关系:In this embodiment, the angle 360°/p occupied by each pair of poles on the inner circle of the stator refers to the actual spatial geometric angle, which is called the mechanical angle; the number of poles at the quadrupole and above (p≥ 4) The motor usually defines the mechanical angle of a pair of poles as 360 degrees of electrical angle, because the induced potential change in the winding is 360° for one cycle; for the two-pole motor, the electrical angle of the stator inner circle and the mechanical angle The angles are equal to 360°; for the p-pole motor, the electrical angle of the stator inner circle is 360°*p, but the mechanical angle is still 360°, so the two have the following relationship:
电角度=机械角度×极对数Electrical angle = mechanical angle × pole pair
在本实施例中,定子的极对数为4对,则电角度与机械角度之间的关系为4倍。In the present embodiment, the number of pole pairs of the stator is four pairs, and the relationship between the electrical angle and the mechanical angle is four times.
作为另一种实施例,所述定子的极对数也可以是其他数量,皆可以采用本方法进行校准。As another embodiment, the number of pole pairs of the stator may also be other numbers, which can be calibrated by the method.
在本实施例中,所述采集每个步进点的编码器数据包括:In this embodiment, the collecting encoder data of each step point includes:
根据所述预设的电角度计算所述电机的驱动信号;Calculating a driving signal of the motor according to the preset electrical angle;
依次向所述电机输出所述驱动信号,使所述电机按照机械角度旋转一圈,采集所述电机旋转一圈过程中每个步进点的编码器数据。The driving signal is sequentially outputted to the motor, so that the motor rotates one revolution according to a mechanical angle, and encoder data of each step point in the process of rotating the motor is acquired.
在本实施例中,所述驱动信号包括初始位置驱动信号,通过电调板向电机输出初始位置驱动信号,使所述电机转动到初始位置,采集此时的机械角度数据,并根据所述机械角度数据获取电角度零偏。In this embodiment, the driving signal includes an initial position driving signal, and an initial position driving signal is output to the motor through the ESC, and the motor is rotated to an initial position, and the mechanical angle data at this time is collected, and according to the mechanical The angle data obtains the electrical angle zero offset.
在本实施例中,上位机通过CAN总线发送电角度校准指令,电机板接收到校准指令后,关闭伺服控制环,包括角度环、速度环、电流环以及空间矢量脉宽调制(Space Vector Pulse Width Modulation)SVPWM单元,从SVPWM模式切换到脉宽调制(Pulse Width Modulation)PWM模式,电调板向电机输出 (0,T,T)信号驱动电机到电角度-180°处,此处,(0,T,T)信号即为初始位置驱动信号,(0,T,T)信号表示三相电机中其中一相没有通电(以0表示),其他两相通电(以T表示),并通过编码器数据变化程度判断电机是否已经被锁死,若电机已锁死,表示电机已经按照驱动信号到达步进点,记录下此时编码器给出的机械角数据,直到电机完成线性化校准回到校准起始点,对比起始点与终止点的机械角度数据,若相差位于阈值以内,判定此次校准成功,此时把线性化后的机械角度转换成电角度并加上-180°,写入FALSH中作为电角度零偏。In this embodiment, the host computer sends an electrical angle calibration command through the CAN bus, and after receiving the calibration command, the motor board turns off the servo control loop, including the angle loop, the speed loop, the current loop, and the space vector pulse width modulation (Space Vector Pulse Width Modulation) SVPWM unit, switching from SVPWM mode to pulse width modulation (Pulse Width) Modulation) PWM mode, the ESC sends a motor (0, T, T) signal to the motor to an electrical angle of -180°, where the (0, T, T) signal is the initial position drive signal, (0, The T, T) signal indicates that one of the three-phase motors is not energized (indicated by 0), the other two phases are energized (indicated by T), and the motor is locked by the degree of change in the encoder data, if the motor is locked Dead, indicating that the motor has reached the stepping point according to the driving signal, record the mechanical angle data given by the encoder at this time, until the motor completes the linear calibration and returns to the calibration starting point, comparing the mechanical angle data of the starting point and the ending point, if The phase difference is within the threshold, and it is determined that the calibration is successful. At this time, the linearized mechanical angle is converted into an electrical angle and added to -180°, and written into FALSH as an electrical angle zero offset.
在执行上述电角度校准步骤后,依次向电机输出以下 (0,T,T)、( 0,0,T)、(T, 0,T)、(T,0,0)、(T,T,0)、(0,T,0),驱动电机沿电角度正方向步进,每步进一步都通过编码器数据判断电机是否已到达步进点,直到电机已到达步进点,才输出下一步的PWM信号,继续驱动电机前进,步进角度为电角度60°,并依次记录所在步进点的编码器数据,直到电机旋转完机械角一圈,写入RAM和FALSH中,供线性化处理使用,最后向上位机回复结束信号。After performing the above electrical angle calibration step, the following (0, T, T), (0, 0, T), (T, 0, T), (T, 0, 0), (T, T) are sequentially output to the motor. , 0), (0, T, 0), the drive motor is stepped in the positive direction of the electrical angle, and each step further determines whether the motor has reached the step point through the encoder data until the motor has reached the step point, and then outputs One step PWM signal continues to drive the motor forward, the step angle is 60°, and the encoder data at the stepping point is recorded in turn until the motor rotates the mechanical angle one turn and is written into RAM and FALSH for linearization. The processing is used, and finally the end signal is returned to the upper machine.
在本实施例中,所述编码器采集到的数据为机械角度数据,当电角度旋转60°时,根据电角度与机械角度之间的转换关系可知,电机的机械角度旋转15°,而本方法是通过采集电机按照机械角度旋转一圈过程中每个步进点的编码器数据来进行校准的,因此就需要需要电机按照电角度旋转4圈,共需采集24次机械角度数据,由于众多非理想因素的影响,这些机械角度数据呈非线性关系,这就需要对这些机械角度数据进行线性化。In this embodiment, the data collected by the encoder is mechanical angle data. When the electrical angle is rotated by 60°, according to the conversion relationship between the electrical angle and the mechanical angle, the mechanical angle of the motor is rotated by 15°. The method is to calibrate by collecting the encoder data of each step point in the process of rotating the motor according to the mechanical angle. Therefore, it is necessary to rotate the motor 4 times according to the electrical angle, and a total of 24 mechanical angle data are collected, due to numerous These mechanical angle data are nonlinear in the influence of non-ideal factors, which requires linearization of these mechanical angle data.
作为另一种实施例,所述预设的电角度为90°时,驱动信号的数量为4个,具体算法为现有技术,兹不赘述。As another embodiment, when the preset electrical angle is 90°, the number of driving signals is four, and the specific algorithm is prior art, and details are not described herein.
在本实施例中,线性化校准使用线性插值的方法,以实际电角度作为参考点,对编码器的原始机械角进行线性插值处理,输出线性化后的机械角度数据,线性化后的机械角度乘以极对数p转化成电角度单位并减去电角度零偏得到电角度,最后输出给SVPWM模块使用。线性化后的机械角度减去机械角度零偏输出机械角度给伺服环进行位置伺服控制或输出给姿态环用于姿态的解耦控制。In the present embodiment, the linearization calibration uses a linear interpolation method, using the actual electrical angle as a reference point, linearly interpolating the original mechanical angle of the encoder, outputting the linearized mechanical angle data, and linearizing the mechanical angle. Multiply the pole log p into an electrical angle unit and subtract the electrical angle to obtain the electrical angle. Finally, the output is used by the SVPWM module. The linearized mechanical angle minus the mechanical angle zero-bias output mechanical angle gives the servo loop position servo control or output to the attitude loop for attitude decoupling control.
在本实施例中,所述上位机还用于:In this embodiment, the upper computer is further configured to:
对所述编码器数据进行校准验证,判断所述每个步进点的编码器数据是否递增,且相邻步进点的编码器数据的差值是否在预设的阈值内,若是,则验证成功,电机板向上位机返回成功信号,不符合条件时,回复失败信号;校准验证步骤目的是为了排除出校准失败的情况,当校准过程有外力阻碍电机运动,或者由于电机本身问题,比如三相线中有某一相线断路,会导致校准失败。Performing calibration verification on the encoder data, determining whether the encoder data of each step point is incremented, and whether the difference between the encoder data of the adjacent step points is within a preset threshold, and if so, verifying Successfully, the motor board returns a success signal to the upper machine. If the condition is not met, the failure signal is returned. The purpose of the calibration verification step is to eliminate the calibration failure. When the calibration process has external force to hinder the motor movement, or due to the motor itself, such as three A phase line break in the phase line will cause the calibration to fail.
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。It is to be understood that the term "comprises", "comprising", or any other variants thereof, is intended to encompass a non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes those elements. It also includes other elements that are not explicitly listed, or elements that are inherent to such a process, method, article, or device. An element that is defined by the phrase "comprising a ..." does not exclude the presence of additional equivalent elements in the process, method, item, or device that comprises the element.
上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。The serial numbers of the embodiments of the present invention are merely for the description, and do not represent the advantages and disadvantages of the embodiments.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本发明各个实施例所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the foregoing embodiment method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be through hardware, but in many cases, the former is better. Implementation. Based on such understanding, the technical solution of the present invention, which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk, The optical disc includes a number of instructions for causing a terminal device (which may be a cell phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the methods described in various embodiments of the present invention.
以上仅为本发明的优选实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。The above are only the preferred embodiments of the present invention, and are not intended to limit the scope of the invention, and the equivalent structure or equivalent process transformations made by the description of the present invention and the drawings are directly or indirectly applied to other related technical fields. The same is included in the scope of patent protection of the present invention.
工业实用性Industrial applicability
本发明提出的一种磁编码器校准方法及系统通过电调板驱动电机以预设的电角度步进旋转;采集每个步进点的编码器数据;采用线性插值法对所述编码器数据进行线性化校准,得到线性化的机械角度数据,能够提高磁编码器的校准效率和准确性。因此,具有工业实用性。The magnetic encoder calibration method and system provided by the invention are driven by a motor to drive the motor to rotate at a preset electrical angle; the encoder data of each step point is collected; and the encoder data is linearly interpolated. Linear calibration is performed to obtain linearized mechanical angle data, which can improve the calibration efficiency and accuracy of the magnetic encoder. Therefore, it has industrial applicability.
 

Claims (10)

  1. 一种磁编码器校准方法,包括:A magnetic encoder calibration method comprising:
    通过电调板驱动电机以预设的电角度步进旋转;Driving the motor through the ESC to rotate at a preset electrical angle;
    采集每个步进点的编码器数据;Collect encoder data for each step point;
    采用线性插值法对所述编码器数据进行线性化校准,得到线性化的机械角度数据。The encoder data is linearly calibrated using linear interpolation to obtain linearized mechanical angle data.
  2. 根据权利要求1所述的一种磁编码器校准方法,其中,所述采集每个步进点的编码器数据包括:A magnetic encoder calibration method according to claim 1, wherein said acquiring encoder data for each step point comprises:
    根据所述预设的电角度计算所述电机的驱动信号;Calculating a driving signal of the motor according to the preset electrical angle;
    依次向所述电机输出所述驱动信号,使所述电机按照机械角度旋转一圈,采集所述电机旋转一圈过程中每个步进点的编码器数据。The driving signal is sequentially outputted to the motor, so that the motor rotates one revolution according to a mechanical angle, and encoder data of each step point in the process of rotating the motor is acquired.
  3. 根据权利要求2所述的一种磁编码器校准方法,其中,所述驱动信号包括初始位置驱动信号,通过电调板向电机输出初始位置驱动信号,使所述电机转动到初始位置,采集此时的机械角度数据,并根据所述机械角度数据获取电角度零偏。The magnetic encoder calibration method according to claim 2, wherein the driving signal comprises an initial position driving signal, and an initial position driving signal is output to the motor through the ESC, and the motor is rotated to an initial position, and the driving is performed. The mechanical angle data of the time, and the electrical angle zero offset is obtained according to the mechanical angle data.
  4. 根据权利要求2所述的一种磁编码器校准方法,其中,所述采用线性插值法对所述编码器数据进行线性化校准,得到线性化的机械角度数据之前还包括:A magnetic encoder calibration method according to claim 2, wherein said linearly calibrating said encoder data by linear interpolation to obtain linearized mechanical angle data further comprises:
    对所述编码器数据进行校准验证,判断所述每个步进点的编码器数据是否递增,且相邻步进点的编码器数据的差值是否在预设的阈值内,若是,则验证成功。Performing calibration verification on the encoder data, determining whether the encoder data of each step point is incremented, and whether the difference between the encoder data of the adjacent step points is within a preset threshold, and if so, verifying success.
  5. 根据权利要求1所述的一种磁编码器校准方法,其中,所述电调板包括偏航电调板、横滚电调板和俯仰电调板,分别用于控制偏航电机、横滚电机和电机,每个电机上设置有一个编码器。A magnetic encoder calibration method according to claim 1, wherein said ESC includes a yaw electric adjustment plate, a roll adjustment plate and a pitch adjustment plate for controlling a yaw motor and a roll Motor and motor, one encoder is set on each motor.
  6. 一种磁编码器校准系统,包括上位机和伺服电机系统,所述伺服电机系统包括电调板和电机,其中,A magnetic encoder calibration system includes a host computer and a servo motor system, and the servo motor system includes an electric adjustment board and a motor, wherein
    所述电调板,用于驱动电机以预设的电角度步进旋转;采集每个步进点的编码器数据;采用线性插值法对所述编码器数据进行线性化校准,得到线性化的机械角度数据;The ESC is configured to drive the motor to rotate in a preset electrical angle; acquire encoder data of each step point; linearly calibrate the encoder data by linear interpolation to obtain linearization Mechanical angle data;
    所述上位机,用于与电调板进行交互。The upper computer is configured to interact with an electrical regulation board.
  7. 根据权利要求6所述的一种磁编码器校准系统,其中,所述采集每个步进点的编码器数据包括:A magnetic encoder calibration system according to claim 6 wherein said acquiring encoder data for each step point comprises:
    根据所述预设的电角度计算所述电机的驱动信号;Calculating a driving signal of the motor according to the preset electrical angle;
    依次向所述电机输出所述驱动信号,使所述电机按照机械角度旋转一圈,采集所述电机旋转一圈过程中每个步进点的编码器数据。The driving signal is sequentially outputted to the motor, so that the motor rotates one revolution according to a mechanical angle, and encoder data of each step point in the process of rotating the motor is acquired.
  8. 根据权利要求7所述的一种磁编码器校准系统,其中,所述驱动信号包括初始位置驱动信号,通过电调板向电机输出初始位置驱动信号,使所述电机转动到初始位置,采集此时的机械角度数据,并根据所述机械角度数据获取电角度零偏。A magnetic encoder calibration system according to claim 7, wherein said driving signal comprises an initial position driving signal, and an initial position driving signal is output to the motor through the ESC, and the motor is rotated to an initial position, and the driving is performed. The mechanical angle data of the time, and the electrical angle zero offset is obtained according to the mechanical angle data.
  9. 根据权利要求7所述的一种磁编码器校准系统,其中,所述上位机还用于:A magnetic encoder calibration system according to claim 7, wherein said upper computer is further configured to:
    对所述编码器数据进行校准验证,判断所述每个步进点的编码器数据是否递增,且相邻步进点的编码器数据的差值是否在预设的阈值内,若是,则验证成功。Performing calibration verification on the encoder data, determining whether the encoder data of each step point is incremented, and whether the difference between the encoder data of the adjacent step points is within a preset threshold, and if so, verifying success.
  10. 根据权利要求6所述的一种磁编码器校准系统,其中,所述电调板包括偏航电调板、横滚电调板和俯仰电调板,分别用于控制偏航电机、横滚电机和电机,每个电机上设置有一个编码器。A magnetic encoder calibration system according to claim 6, wherein said ESC includes a yaw electric adjustment plate, a roll adjustment plate and a pitch adjustment plate for controlling a yaw motor and a roll Motor and motor, one encoder is set on each motor.
PCT/CN2018/075863 2017-02-08 2018-02-08 Calibration method for magnetic encoder and system WO2018145647A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710069520.1 2017-02-08
CN201710069520.1A CN106679710B (en) 2017-02-08 2017-02-08 Magnetic encoder calibration method and system

Publications (1)

Publication Number Publication Date
WO2018145647A1 true WO2018145647A1 (en) 2018-08-16

Family

ID=58860512

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/075863 WO2018145647A1 (en) 2017-02-08 2018-02-08 Calibration method for magnetic encoder and system

Country Status (2)

Country Link
CN (1) CN106679710B (en)
WO (1) WO2018145647A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111550592A (en) * 2019-02-12 2020-08-18 杭州三花研究院有限公司 Control method, control system and electric valve
TWI774442B (en) * 2021-06-25 2022-08-11 台達電子工業股份有限公司 Magnetic encoder compensation system and method of compensating the same
US11934171B2 (en) 2021-12-28 2024-03-19 Industrial Technology Research Institute Servo motor and encoder calibration method thereof

Families Citing this family (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106679710B (en) * 2017-02-08 2020-03-10 亿航智能设备(广州)有限公司 Magnetic encoder calibration method and system
WO2019071390A1 (en) * 2017-10-09 2019-04-18 深圳市大疆灵眸科技有限公司 Mechanical angle detecting method, pan/tilt head and machine readable storage medium
CN113324565A (en) * 2017-11-14 2021-08-31 深圳市大疆创新科技有限公司 Mechanical angle detection method, holder and machine-readable storage medium
CN108873770B (en) * 2018-05-09 2021-03-19 中国科学院长春光学精密机械与物理研究所 AS5048A magnetic encoder control method and system based on state machine
EP3813248A4 (en) * 2018-07-02 2021-06-16 SZ DJI Technology Co., Ltd. Method and system for acquiring initial mechanical angle of electric motor
CN109655083B (en) * 2019-02-15 2021-10-08 广州极飞科技股份有限公司 Magnetic encoder, calibration method and calibration device thereof, motor and unmanned aerial vehicle
CN109870177B (en) * 2019-02-15 2021-10-08 广州极飞科技股份有限公司 Magnetic encoder, calibration method and calibration device thereof, motor and unmanned aerial vehicle
CN110375788B (en) * 2019-07-26 2021-04-13 中国航空工业集团公司北京长城计量测试技术研究所 Four-way orthogonal differential signal demodulation instrument calibration method and system
CN110631474B (en) * 2019-11-04 2021-07-30 重庆市亿飞智联科技有限公司 Motor calibration system, method and device, controller and storage medium
CN110940371B (en) * 2019-12-13 2020-08-21 浙江禾川科技股份有限公司 Calibration method, device and equipment of rotary magnetoelectric encoder
CN111076761B (en) * 2019-12-30 2023-02-03 杭州电子科技大学 Magnetic encoder calibration method and system
CN113758513B (en) * 2020-06-04 2022-11-04 杭州海康威视数字技术股份有限公司 Method for detecting precision of magnetic encoder in equipment and electronic equipment
CN111750903B (en) * 2020-07-07 2022-02-01 哈尔滨理工大学 Winding integrated magnetoelectric encoder and independent calibration method thereof
CN113029222A (en) * 2021-03-08 2021-06-25 深圳市昂霸科技有限公司 Calibration method and device for magnetic encoder and magnetic encoder
WO2023201513A1 (en) * 2022-04-19 2023-10-26 舍弗勒技术股份两合公司 Calibration method and calibration apparatus for angle sensor
CN115127603B (en) * 2022-08-25 2022-12-20 天津云圣智能科技有限责任公司 Compensation method and device for magnetic encoder in unmanned aerial vehicle and electronic equipment
CN115355937B (en) * 2022-10-24 2022-12-27 泉州昆泰芯微电子科技有限公司 Self-calibration method of magnetic encoder and motor

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100820677B1 (en) * 2007-02-23 2008-04-11 한전케이피에스 주식회사 Rotary encoder tester
CN202814441U (en) * 2012-08-27 2013-03-20 北京经纬恒润科技有限公司 Absolute type encoder detection system
CN103954316A (en) * 2014-04-30 2014-07-30 湖南大学 Calibration method and device for angle encoder
CN103968877A (en) * 2014-05-16 2014-08-06 中国科学院长春光学精密机械与物理研究所 Vacuum experiment device for satellite-borne photo-electric axial angle encoder
CN205228503U (en) * 2015-12-23 2016-05-11 四川红光汽车机电有限公司 High accuracy photoelectric encoder automatic checkout device
CN106679710A (en) * 2017-02-08 2017-05-17 亿航智能设备(广州)有限公司 Magnetic encoder calibrating method and system

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE602006003954D1 (en) * 2005-08-11 2009-01-15 Mitutoyo Corp Method and circuit arrangement for interpolating the output signal of an encoder
CN102537473B (en) * 2012-01-10 2014-04-23 西安交通大学 Drive control device with 36-way rotary valve

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100820677B1 (en) * 2007-02-23 2008-04-11 한전케이피에스 주식회사 Rotary encoder tester
CN202814441U (en) * 2012-08-27 2013-03-20 北京经纬恒润科技有限公司 Absolute type encoder detection system
CN103954316A (en) * 2014-04-30 2014-07-30 湖南大学 Calibration method and device for angle encoder
CN103968877A (en) * 2014-05-16 2014-08-06 中国科学院长春光学精密机械与物理研究所 Vacuum experiment device for satellite-borne photo-electric axial angle encoder
CN205228503U (en) * 2015-12-23 2016-05-11 四川红光汽车机电有限公司 High accuracy photoelectric encoder automatic checkout device
CN106679710A (en) * 2017-02-08 2017-05-17 亿航智能设备(广州)有限公司 Magnetic encoder calibrating method and system

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111550592A (en) * 2019-02-12 2020-08-18 杭州三花研究院有限公司 Control method, control system and electric valve
CN111550592B (en) * 2019-02-12 2022-04-22 浙江三花智能控制股份有限公司 Control method, control system and electric valve
TWI774442B (en) * 2021-06-25 2022-08-11 台達電子工業股份有限公司 Magnetic encoder compensation system and method of compensating the same
US11934171B2 (en) 2021-12-28 2024-03-19 Industrial Technology Research Institute Servo motor and encoder calibration method thereof

Also Published As

Publication number Publication date
CN106679710A (en) 2017-05-17
CN106679710B (en) 2020-03-10

Similar Documents

Publication Publication Date Title
WO2018145647A1 (en) Calibration method for magnetic encoder and system
JP6888659B2 (en) Motor module and motor certification method
CN108322103B (en) Permanent magnet synchronous motor phase sequence correction method and device
KR100889961B1 (en) Method and system for compensating position error of step motor
JP5124483B2 (en) Method and apparatus for driving a synchronous machine
EP2258043B1 (en) Sensorless control of salient-pole machines
CN106374789B (en) Permanent-magnet brushless DC electric machine low torque ripple Hall fault tolerant control method
CN107086835B (en) Permanent magnet synchronous motor rotation initial zero-potential angle calibration system and calibration method
CN107809191B (en) Angle observation method for synchronous motor speed sensorless
WO2023116626A1 (en) Position deviation calibration method, electric motor driving method and system, and device
JP5177133B2 (en) Motor control device
CN211429147U (en) Rotary-transformation zero-adjusting system for permanent magnet synchronous motor
JP5733404B2 (en) PM motor position sensorless control device
CN107834914A (en) Brushless electric motor rotor angle computation method based on Hall
CN103368476A (en) Motor driving method and detection circuit for electric means of transportation
JP6844617B2 (en) Motor modules, motor step motion control systems, and motor controls
JP4735439B2 (en) Initial magnetic pole position estimation device for permanent magnet type synchronous motor
JP2014217086A (en) Motor control device and motor control method
CN112394312B (en) Fault diagnosis method for current sensor of three-phase motor driving system
JP2008178237A (en) Magnetic pole position correcting method of linear system, and linear system using the same
CN111478638A (en) Method and device for identifying initial position of permanent magnet synchronous motor rotor
CN116155170A (en) Servo diagnosis method, apparatus, device and readable storage medium
CN115811260A (en) Rotary transformer zero point identification method and device of motor and computer storage medium
CN114172414A (en) Servo motor initial electrical angle determining method and device and readable storage medium
CN113541554A (en) Self-adaptive belt speed charging control method for permanent magnet motor for flywheel

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18751595

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 08.01.2020)

122 Ep: pct application non-entry in european phase

Ref document number: 18751595

Country of ref document: EP

Kind code of ref document: A1