CN115833491B - Angle calculation method and device, storage medium and electronic equipment - Google Patents

Angle calculation method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN115833491B
CN115833491B CN202111660474.5A CN202111660474A CN115833491B CN 115833491 B CN115833491 B CN 115833491B CN 202111660474 A CN202111660474 A CN 202111660474A CN 115833491 B CN115833491 B CN 115833491B
Authority
CN
China
Prior art keywords
tooth
sampling
level time
code disc
teeth
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN202111660474.5A
Other languages
Chinese (zh)
Other versions
CN115833491A (en
Inventor
马荣桐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suteng Innovation Technology Co Ltd
Original Assignee
Suteng Innovation Technology Co Ltd
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
Application filed by Suteng Innovation Technology Co Ltd filed Critical Suteng Innovation Technology Co Ltd
Priority to CN202111660474.5A priority Critical patent/CN115833491B/en
Priority to CN202310926500.7A priority patent/CN117040208A/en
Publication of CN115833491A publication Critical patent/CN115833491A/en
Application granted granted Critical
Publication of CN115833491B publication Critical patent/CN115833491B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H02GENERATION; CONVERSION OR DISTRIBUTION OF ELECTRIC POWER
    • H02KDYNAMO-ELECTRIC MACHINES
    • H02K11/00Structural association of dynamo-electric machines with electric components or with devices for shielding, monitoring or protection
    • H02K11/20Structural association of dynamo-electric machines with electric components or with devices for shielding, monitoring or protection for measuring, monitoring, testing, protecting or switching
    • H02K11/21Devices for sensing speed or position, or actuated thereby
    • H02K11/22Optical devices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/11Complex mathematical operations for solving equations, e.g. nonlinear equations, general mathematical optimization problems
    • HELECTRICITY
    • H02GENERATION; CONVERSION OR DISTRIBUTION OF ELECTRIC POWER
    • H02KDYNAMO-ELECTRIC MACHINES
    • H02K11/00Structural association of dynamo-electric machines with electric components or with devices for shielding, monitoring or protection
    • H02K11/30Structural association with control circuits or drive circuits
    • H02K11/35Devices for recording or transmitting machine parameters, e.g. memory chips or radio transmitters for diagnosis
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application discloses an angle calculation method, an angle calculation device, a storage medium and electronic equipment, wherein the method comprises the following steps: and acquiring high-level time and low-level time generated by each tooth in the code disc passing through the photoelectric switch at different preset temperatures and different preset rotating speeds, calibrating the code disc based on each high-level time and each low-level time, acquiring angles corresponding to the number 0 tooth to the number N tooth in the code disc at the sampling temperatures and the sampling rotating speeds based on the calibrated code disc, acquiring target high-level time and target low-level time corresponding to the number N tooth in the code disc at the sampling temperatures and the sampling rotating speeds, and determining an actual rotation angle value of the code disc based on the angles corresponding to the number 0 tooth to the number N-1 tooth in the code disc at the sampling temperatures and the sampling rotating speeds, the target high-level time, the target low-level time and the actual sampling time after rising edge jump of the number N tooth. By adopting the scheme, the effect of improving the accuracy of rotation speed detection is achieved through detection of the code wheel and the photoelectric switch.

Description

Angle calculation method and device, storage medium and electronic equipment
Technical Field
The present application relates to the field of computers, and in particular, to a method and apparatus for calculating an angle, a storage medium, and an electronic device.
Background
The motor is applied to the aspects of daily life, namely, the motor plays an important role from the top to the aerospace industry and from the bottom to the toy parts. In order to ensure the normal operation of the motor, the detection of the motor is an indispensable operation.
Disclosure of Invention
The embodiment of the application provides an angle calculation method, an angle calculation device, a storage medium and electronic equipment, and the effect of improving the accuracy of rotation speed detection is realized through detection of a code disc and a photoelectric switch. The technical scheme is as follows:
in a first aspect, an embodiment of the present application provides an angle calculating method, which is characterized in that the method includes:
acquiring high-level time and low-level time generated by each tooth passing through a photoelectric switch in a code disc at different preset temperatures and different preset rotating speeds;
calibrating the code wheel based on each high level time and each low level time;
based on the calibrated code wheel, acquiring angles corresponding to the number 0 teeth to the number N teeth in the code wheel at the sampling rotation speed at the sampling temperature, and acquiring target high-level time and target low-level time corresponding to the number N teeth in the code wheel at the sampling rotation speed at the sampling temperature, wherein N is greater than or equal to 0 and less than or equal to N, N is the last number of teeth of the code wheel, and the number N is the number of teeth corresponding to the current sampling time;
And determining an actual rotation angle value of the code disc based on the angle corresponding to the number 0 tooth to the number N tooth in the code disc at the sampling temperature and the sampling rotation speed, the target high level time, the target low level time and the actual sampling time after the rising edge jump of the number N tooth.
In a second aspect, an embodiment of the present application provides an angle calculating device, including:
the time acquisition module is used for acquiring high-level time and low-level time generated by each tooth in the code disc through the photoelectric switch at different preset temperatures and different preset rotating speeds;
the code disc calibration module is used for calibrating the code disc based on the high level time and the low level time;
the angle acquisition module is used for acquiring angles corresponding to the number 0 teeth to the number N teeth in the code disc at the sampling rotation speed at the sampling temperature based on the calibrated code disc, and acquiring target high-level time and target low-level time corresponding to the number N teeth in the code disc at the sampling rotation speed at the sampling temperature, wherein N is greater than or equal to 0 and less than or equal to N, N is the last number of teeth of the code disc, and the number N is the number of teeth corresponding to the current sampling time;
And the angle determining module is used for determining an actual rotation angle value of the code disc based on the angle corresponding to the number 0 tooth to the number N tooth in the code disc, the target high level time, the target low level time and the actual sampling time after the rising edge jump of the number N tooth at the sampling temperature and the sampling rotation speed.
In a third aspect, embodiments of the present application provide a computer storage medium storing a plurality of instructions adapted to be loaded by a processor and to perform the above-described method steps.
In a fourth aspect, an embodiment of the present application provides an electronic device, which may include: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to perform the above-mentioned method steps.
The technical scheme provided by the embodiment of the application has the beneficial effects that at least:
the code wheel is calibrated by acquiring high-level time and low-level time generated by each tooth in the code wheel through the photoelectric switch at different preset temperatures and different preset rotating speeds, and the corresponding rotating speed and angle are calculated by acquiring the high-level time and the low-level time of each tooth at the sampling temperature after the code wheel is calibrated, so that the actual rotating angle value of the code wheel is obtained, and the effect of improving the rotating speed detection accuracy is realized.
Drawings
In order to more clearly illustrate the embodiments of the application or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a system architecture diagram of an angle calculation method according to an embodiment of the present application;
fig. 2 is a schematic flow chart of an angle calculating method according to an embodiment of the present application;
FIG. 3 is a schematic diagram illustrating a positional relationship between a code wheel and a photoelectric switch according to an embodiment of the present application;
fig. 4 is a schematic circuit diagram of a shaping circuit according to an embodiment of the present application;
FIG. 5 is an exemplary schematic diagram of a waveform processing before and after processing according to an embodiment of the present application;
FIG. 6 is a schematic diagram illustrating an example of the information before and after calibration according to an embodiment of the present application;
FIG. 7 is an exemplary schematic diagram of a determination of tooth number 0 provided by an embodiment of the present application;
FIG. 8 is a schematic flow chart of an angle calculation method according to an embodiment of the present application;
FIG. 9 is an exemplary schematic diagram of a linear interpolation method according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of an angle calculating device according to an embodiment of the present application;
FIG. 11 is a schematic diagram of an angle calculating device according to an embodiment of the present application;
FIG. 12 is a schematic diagram of a code wheel calibration module according to an embodiment of the present application;
FIG. 13 is a schematic view of an angle determining module according to an embodiment of the present application;
fig. 14 is a schematic structural diagram of an angle calculating device according to an embodiment of the present application;
fig. 15 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with the application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the application as detailed in the accompanying claims.
In the description of the present application, it should be understood that the terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. The specific meaning of the above terms in the present application can be understood by those of ordinary skill in the art according to the specific circumstances. Furthermore, in the description of the present application, unless otherwise indicated, "a plurality" means two or more. "and/or", describes an association relationship of an association object, and indicates that there may be three relationships, for example, a and/or B, and may indicate: a exists alone, A and B exist together, and B exists alone. The character "/" generally indicates that the context-dependent object is an "or" relationship.
The existing scheme for detecting the motor including the rotating speed and the angle mainly comprises three types of schemes: photoelectric encoder, resolver and hall sensor. The photoelectric sensor is high in cost, accurate graduations are needed to detect positions, meanwhile, if dirt is polluted, detection results are wrong, the photoelectric sensor is easily affected by strong vibration and strong corrosion environments, and the photoelectric sensor is not suitable for severe construction environments; the resolver is also costly and requires complex hardware and software for position and rotational speed decoding; the Hall sensor has the problems of easy damage and low precision.
Based on the above, the embodiment of the application provides an angle calculation method, which can install a code wheel in a motor, place teeth in the code wheel in a photoelectric switch, calibrate the code wheel based on obtaining high-level time and low-level time generated by the photoelectric switch when each tooth in the code wheel passes through different preset rotating speeds at different preset temperatures, obtain target high-level time and target low-level time corresponding to N teeth at the sampling temperatures, search corresponding target rotating speeds and angles corresponding to 0 teeth to N-1 teeth based on the sampling temperatures and the target high-level time, calculate an angle value corresponding to the actual sampling time after the rising edge jump of the N teeth through the target rotating speeds, and obtain an actual rotating angle value of the code wheel based on the angles corresponding to the 0 teeth to N-1 teeth, thereby realizing the detection of the rotating speed and the position of the motor. According to the embodiment of the application, the code wheel is calibrated by acquiring the high-level time and the low-level time generated by the photoelectric switch when each tooth in the code wheel passes through different preset rotating speeds at different preset temperatures, and the corresponding rotating speed and angle are calculated by acquiring the high-level time and the low-level time of each tooth at the sampling temperature after the code wheel is calibrated, so that the accuracy of angle calculation can be improved, and the effect of improving the accuracy of rotating speed detection is realized by detecting the code wheel and the photoelectric switch.
The present application will be described in detail with reference to specific examples.
Referring to fig. 1, a system structure diagram of an angle calculating method according to an embodiment of the present application is shown. Fig. 1 includes a code wheel, a photoelectric switch, acquired data, a rotation speed and an angle. The acquired data are the high-level time and the low-level time generated by each tooth in the code wheel through the photoelectric switch, and the rotating speed and the angle corresponding to the N number of teeth are calculated through acquiring the high-level time, the low-level time and the temperature, so that the detection of the rotating speed and the angle of the motor is realized.
The method comprises the steps that teeth of a code disc are placed in a photoelectric switch to ensure that the teeth can shield an optical path of the photoelectric switch, high-level time and low-level time generated by the photoelectric switch when the teeth pass through the photoelectric switch in the code disc at different preset temperatures are obtained, the code disc is calibrated, target high-level time and target low-level time at sampling temperatures are obtained by the calibrated code disc, the obtained high-level time and low-level time generated by the photoelectric switch when the teeth pass through the photoelectric switch in the code disc at different preset temperatures are found, the current target rotating speed and corresponding angles are determined, and then the actual rotating angle value of the code disc is obtained, so that the detection of the rotating speed and the position of a motor is realized.
According to the method, the code disc is calibrated by acquiring the high-level time and the low-level time generated by the photoelectric switch when each tooth in the code disc passes through different preset rotating speeds at different preset temperatures, and the corresponding rotating speed and angle are calculated by acquiring the high-level time and the low-level time of each tooth at the sampling temperature after the code disc is calibrated, so that the actual rotating angle value of the code disc is obtained, and the effect of improving the rotating speed detection accuracy is achieved.
The method may be performed on an angle computing device, which may be a mobile terminal, including but not limited to: smart interactive tablets, personal computers, tablet computers, handheld devices, computing devices, or other processing devices connected to a wireless modem, etc. User terminals may be called different names in different networks, for example: a user equipment, an access terminal, a subscriber unit, a subscriber station, a mobile station, a remote terminal, a mobile device, a user terminal, a wireless communication device, a user agent or user equipment, a cellular telephone, a cordless telephone, a personal digital assistant (Personal Digital Assistant, PDA), a terminal device in a 5G network or a future evolution network, and the like.
Fig. 2 is a schematic flow chart of an angle calculating method according to an embodiment of the present application. The embodiment of the application is described by taking a mobile terminal as an example, and the angle calculation method can comprise the following steps:
s101, acquiring high-level time and low-level time generated by each tooth of a code disc passing through a photoelectric switch at different preset temperatures and different preset rotating speeds;
in one embodiment, the code disc is placed in a constant temperature environment to rotate at a constant rotating speed at a constant speed, and the high-level time and the low-level time generated by each tooth of the code disc passing through the photoelectric switch are recorded; after the data of each tooth is recorded, the rotating speed is changed for a plurality of times while the temperature is kept unchanged, wherein it can be understood that the code wheel is controlled to rotate at a constant speed under each rotating speed. Recording the high level time and the low level time of each tooth passing through the photoelectric switch under each rotating speed state; and changing the temperature for multiple times, keeping the code wheel to rotate at a constant speed according to each rotating speed when the data is recorded, and recording the high-level time and the low-level time generated by each tooth passing through the photoelectric switch at different preset rotating speeds of different preset temperatures.
When data is recorded, the gear of the code wheel is nested in the photoelectric switch, as shown in fig. 3, the teeth of the code wheel can be ensured to cover the light passage of the photoelectric switch, the gear is at a high level when the teeth cover the light passage of the photoelectric switch, and the gear is at a low level when the teeth do not cover the light passage of the photoelectric switch.
When each tooth passes through the photoelectric switch, the shaping processing is performed by a hardware circuit as shown in fig. 4, so that a signal generated by each tooth passing through the photoelectric switch is changed into a square wave signal, namely, the effect as shown in fig. 5. The voltage waveform of the electric signal generated by the teeth of the code wheel passing through the photoelectric switch in FIG. 4 is the unprocessed waveform in FIG. 5, and the electric signal passes through the comparator and U REF Comparing to obtainThe processed waveform in fig. 5 is a square wave. The processing is performed because the square wave gives the microcontroller a more appropriate detection period and the detected period is more accurate.
The rotational speed and the temperature of each change are not limited herein, and may be set according to practical situations, and one possible method is to set the temperature and the rotational speed according to a certain difference as shown in table 1. It should be noted that when the temperature and the rotation speed are set, the temperature is uniformly distributed as much as possible so as to avoid larger errors, and meanwhile, the temperature is the influence of equipment, and the influence of the excessively high or excessively low temperature on the performance of the equipment is avoided, so that the practicability and the accuracy of data are affected.
Further, after obtaining the high level time and the low level time corresponding to each tooth in the code wheel at different preset rotational speeds at different preset temperatures in table 1, summing the high level time and the low level time to obtain the rotational time corresponding to each tooth in the code wheel at different preset rotational speeds at different preset temperatures as shown in table 2.
Further, after table 2 is obtained, the rotation time corresponding to each tooth in the code wheel under different preset temperatures and different preset rotation speeds in table 2 is summed to obtain the total rotation time of one circle of rotation of the code wheel under different preset temperatures and different preset rotation speeds shown in table 3, and a data base is provided for the subsequent calibration of the code wheel.
Further, the high level time and the low level time corresponding to each tooth in the code wheel under different preset temperatures and different preset rotation speeds, and the rotation time corresponding to each tooth and the total rotation time are obtained, and the angles corresponding to each tooth in the code wheel under different preset rotation speeds and different preset temperatures as shown in table 4 can be obtained through the proportion of the rotation time corresponding to each tooth and the total rotation time. For example, the code wheel passes through tooth number 0 for 5ns, the total rotation time is 150ns, the angle of one rotation of the code wheel is 360 degrees, and then the corresponding angle of tooth number 0 is 12 degrees.
Wherein Th in Table 1 is high level time, tl is low level time, n is total number of teeth of the code wheel, and T1 is high level time generated by the photoelectric switch when the code wheel rotates at-30 ℃ at a rotational speed of 300 revolutions per minute.
Wherein t in Table 2 is the rotation time, n is the total number of teeth of the code wheel, and t1 is the rotation time of the number 0 teeth when the code wheel rotates at a rotation speed of 300 revolutions per minute at-30 ℃.
Wherein TN in Table 3 is the total rotation time, TN1 is the total rotation time of one rotation of the code wheel when the code wheel rotates at a rotation speed of 300 revolutions per minute at-30 ℃.
Wherein, θ in table 4 is the rotation angle of each tooth, and θ1 is the rotation angle of the number 0 tooth when the code wheel rotates at-30 ℃ at the rotation speed of 300 revolutions per minute.
TABLE 1
TABLE 2
TABLE 3 Table 3
TABLE 4 Table 4
S102, calibrating the code disc based on the high level time and the low level time;
calculating theoretical values of high-level time and low-level time generated by each tooth passing through a photoelectric switch in a code disc at different temperatures, calibrating the high-level time and the low-level time of each tooth based on the theoretical values, if errors of the recorded high-level time and low-level time and the corresponding theoretical values are within a preset error range, judging that a calibration result is correct, and if the recorded high-level time and/or low-level time and the corresponding theoretical values of one tooth under a certain condition are greater than the preset error range, judging that a certain link in the recording process possibly has a problem, and checking the code disc and a hardware circuit to determine whether a fault exists.
The preset error range may be set according to actual situations, and is not limited herein. One possible approach is to set the error range to be within + -10%, and if the error is within + -10%, the calibration result is considered correct, and if the error is greater than + -10%, inspection of the code wheel and/or hardware circuitry is required.
The effect achieved by calibrating the code wheel at different temperatures is shown in fig. 6, and at a certain temperature, the rotating speed corresponding to each tooth in the code wheel shows the result that the rotating speed is within a certain range through calibration.
S103, acquiring angles corresponding to the number 0 teeth to the number N teeth in the code disc at the sampling rotation speed at the sampling temperature based on the calibrated code disc, and acquiring target high-level time and target low-level time corresponding to the number N teeth in the code disc at the sampling rotation speed at the sampling temperature, wherein N is greater than or equal to 0 and less than or equal to N, N is the last number of teeth of the code disc, and N is the number of teeth corresponding to the current sampling time;
after the code wheel is calibrated, angles corresponding to the number 0 teeth to the number N teeth in the code wheel at the sampling temperature and the sampling rotation speed can be obtained through table lookup, and then the target high-level time and the target low-level time corresponding to the number N teeth in the code wheel at the sampling temperature and the sampling rotation speed are obtained through real-time detection.
As shown in FIG. 7, the tooth number 0 is a tooth with a larger hollow in the code wheel, and the widths of other teeth in the code wheel are consistent so as to be convenient for distinguishing.
The N number of teeth can be teeth passing through the photoelectric switch at the current moment when the real-time detection is carried out in the code disc.
The target high-level time and the target low-level time can be high-level time and low-level time generated by the photoelectric switch through N number teeth in the code disc under the condition that the sampling temperature and the sampling rotating speed are obtained through real-time detection, and the code disc can not be ensured to always keep operation and rotation, so that real-time detection is required for the current situation.
S104, determining an actual rotation angle value of the code disc based on the angle corresponding to the number 0 tooth to the number N-1 tooth in the code disc, the target high level time, the target low level time and the actual sampling time after the rising edge jump of the number N tooth at the sampling temperature and the sampling rotation speed;
and multiplying the rotation time corresponding to the N number tooth obtained by adding the target high level time and the target low level time with the acquired angle of the N number tooth after obtaining the angles corresponding to the 0 number tooth to the N-1 number tooth in the code disc, the target high level time and the target low level time under the sampling temperature and the sampling rotating speed, obtaining the target rotating speed corresponding to the N number tooth, multiplying the target rotating speed with the preset sampling period corresponding to the N number tooth to obtain the angle change when the rising edge of the N number tooth jumps, combining the angles corresponding to the 0 number tooth to the N-1 number tooth respectively, adding the angle values corresponding to the actual sampling time after the rising edge jump of the N number tooth after adding and summing the angles, and obtaining the actual rotation angle value of the code disc.
By adopting the embodiment of the application, the code disc is calibrated by acquiring the high-level time and the low-level time generated by the photoelectric switch when each tooth in the code disc passes through different preset rotating speeds at different preset temperatures, and the corresponding rotating speed and angle are calculated by acquiring the high-level time and the low-level time of each tooth at the sampling temperature after the code disc is calibrated, so that the actual rotating angle value of the code disc is obtained, and the effect of improving the rotating speed detection accuracy is realized.
Fig. 8 is a schematic flow chart of an angle calculating method according to an embodiment of the present application. The embodiment of the application is described by taking a mobile terminal as an example, and the angle calculation method can comprise the following steps:
s201, acquiring high-level time and low-level time generated by each tooth of a code disc passing through a photoelectric switch at different preset temperatures and different preset rotating speeds;
see step S101, and details thereof are omitted herein.
S202, determining the maximum value of low-level time generated by each tooth of the code wheel through the photoelectric switch at different preset temperatures and different preset rotating speeds;
after the fact that the code disc and the hardware circuit can work normally and the generated errors are in a receivable range is determined, the maximum value of low-level time generated by the photoelectric switch when each tooth in the code disc passes through different preset rotating speeds at different preset temperatures is determined, and preparation is made for positioning each tooth in the code disc subsequently.
And S203, determining the tooth corresponding to the maximum value as the tooth number 0.
After determining the maximum value of low-level time generated by the photoelectric switch when each tooth in the code disc passes through different preset rotating speeds at different preset temperatures, taking the tooth corresponding to the maximum value as the number 0 tooth in the code disc, and as shown in fig. 3, the left side of the hollowed part is the number 0 tooth, and the right side is the number 1 tooth.
S204, acquiring high-level theoretical time and low-level theoretical time generated by each tooth in the code wheel through the photoelectric switch at different preset temperatures and different preset rotating speeds;
and calculating high-level theoretical time and low-level theoretical time generated when each tooth in the code wheel passes through the photoelectric switch at different preset temperatures and different preset rotating speeds.
It should be noted that, at different temperatures, the on characteristics of the photoelectric switch will change at different temperatures, so that the duty ratio of the pulse signal generated by each tooth passing through the photoelectric switch will change; meanwhile, the gradient of the transition of the original signal of the photoelectric switch from the low level to the high level at different rotating speeds is different, and the duty ratio of the comparator in the backward direction is also different, so that the related theoretical data at different temperatures are required to be calculated, and the preparation of data is carried out for the subsequent calibration of the code disc.
The duty ratio refers to the ratio of the time occupied by the high level within one period, that is, the ratio of the period time occupied by the high level to the whole period time.
The specific theoretical data may be calculated according to the temperature during the actual experiment, and the setting of the temperature is not specifically limited here.
S205, if the high level time generated by each tooth passing through the photoelectric switch in the code disc and the corresponding high level theoretical time are in the error range at different preset temperatures and different preset rotating speeds, and the low level time generated by each tooth passing through the photoelectric switch in the code disc and the corresponding low level theoretical time are in the error range at different preset temperatures and different preset rotating speeds, determining that the code disc calibration is successful.
Determining high-level time and corresponding high-level theoretical time generated by each tooth in the code disc through the photoelectric switch at different preset temperatures and different preset rotating speeds, and comparing data one by one after the low-level time and corresponding low-level theoretical time generated by each tooth in the code disc through the photoelectric switch at different preset temperatures and different preset rotating speeds, and if the difference between the acquired data and the theoretical data is within a preset error range, judging that the code disc is successfully calibrated; if the difference between the acquired data and the theoretical data is larger than the preset error range, the code disc and the hardware circuit need to be checked to determine whether damage occurs.
The preset error range may be set according to actual situations, and is not limited herein. One possible approach is to set the error range to be within + -10%, and if the error is within + -10%, the calibration result is considered correct, and if the error is greater than + -10%, inspection of the code wheel and/or hardware circuitry is required.
Collecting a first high level time and a first low level time corresponding to an N-th tooth in the code disc at a sampling temperature;
and taking the target tooth to be detected as an N-th tooth, and collecting a first high level time and a first low level time corresponding to the N-th tooth in the code disc at the sampling temperature.
Wherein N is greater than or equal to 0 and less than or equal to N, N being the number of the last tooth of the code wheel, e.g. the code wheel has 60 teeth in total, then N is 59.
S206, acquiring a sampling temperature and a sampling rotating speed, and judging whether the sampling temperature and the sampling rotating speed are the same as a preset temperature and a preset rotating speed;
and acquiring the sampling temperature and the sampling rotating speed of the code wheel at the current moment, comparing the acquired sampling temperature and sampling rotating speed with the preset temperature and the preset rotating speed, and judging whether the sampling temperature and the preset temperature and the sampling rotating speed are the same as the preset rotating speed.
The preset temperature and the preset rotation speed may be information of the temperature and the rotation speed existing in the calibration of the code wheel, for example, the temperatures of-30 ℃, -10 ℃ and the rotation speeds of 300rpm and 600rpm in table 1. When comparing the sampling temperature with the preset temperature, if the sampling temperature is-30 ℃, the corresponding numerical value can be found in a table comprising the preset temperature, the sampling temperature is the same as the preset temperature, and if the sampling temperature is-19 ℃, the corresponding numerical value cannot be found in the table of the preset temperature, the sampling temperature is different from the preset temperature. The comparison of the sampling rotation speed and the preset rotation speed is the same as the comparison method of the sampling temperature and the preset temperature.
S207, if the sampling temperature and the sampling rotation speed are different from the preset temperature and the preset rotation speed, obtaining the angles corresponding to the number 0 tooth to the number N tooth of the code wheel under the sampling temperature and the sampling rotation speed by adopting an interpolation method.
Acquiring high-level time and low-level time which are generated by a photoelectric switch and correspond to the number 0 tooth to the number N tooth of the code wheel under the pre-stored sampling temperature and sampling rotating speed;
acquiring the sum of high-level time and low-level time from the tooth 0 to the tooth N, calculating the proportion of the sum of the high-level time and the low-level time from the tooth 0 to the tooth N in a detection period, and calculating the corresponding angle from the tooth 0 to the tooth N of the code wheel under the sampling temperature and the sampling rotating speed according to the proportion relation; or alternatively, the first and second heat exchangers may be,
When the sampling temperature is different from one of the preset temperatures, the sampling rotation speed is the same as one of the preset rotation speeds, and the angles corresponding to the number 0 tooth to the number N tooth of the code wheel under the sampling temperature and the sampling rotation speed are obtained, and the method comprises the following steps:
performing linear interpolation on the sampling temperature value to obtain high-level time and low-level time corresponding to the number 0 tooth to the number N tooth of the code wheel at the sampling speed of the sampling temperature; and calculating the proportion of the sum of the high level time and the low level time of the number 0 tooth to the number N tooth to one detection period, and calculating the corresponding angle of the number 0 tooth to the number N tooth of the code wheel under the sampling temperature and the sampling rotating speed according to the proportion relation.
The main method of performing linear interpolation processing on the data is shown in fig. 9, and may be that each coordinate in the coordinate system shown in fig. 9 is connected by a curve that is as smooth as possible, so as to obtain high level time and low level time generated by photoelectric switches of each tooth in the code disc at each temperature and at different rotation speeds, that is, some undetected data are obtained by a linear interpolation processing method, so that the actual time spent in the experiment is reduced, and meanwhile, accurate data are obtained as much as possible.
The example of fig. 9 is merely a diagram illustrating a linear interpolation process, and does not represent specific data in any embodiment of the present application.
Or alternatively, the first and second heat exchangers may be,
when the sampling temperature is the same as one of the preset temperatures, the sampling rotation speed is different from one of the preset rotation speeds, and the angles corresponding to the number 0 tooth to the number N tooth of the code wheel under the sampling temperature and the sampling rotation speed are obtained, the method comprises the following steps:
performing linear interpolation on the sampling rotation speed to obtain high-level time and low-level time corresponding to the number 0 tooth to the number N tooth of the code wheel at the sampling rotation speed of the sampling temperature; calculating the proportion of the sum of the high level time and the low level time of the number 0 tooth to the number N tooth in one detection period, and calculating the corresponding angle of the number 0 tooth to the number N tooth of the code wheel under the sampling temperature sampling rotating speed according to the proportion relation;
or alternatively, the first and second heat exchangers may be,
when the sampling temperature is different from any preset temperature, and the sampling rotation speed is different from any preset rotation speed, the angles corresponding to the number 0 tooth to the number N tooth of the code wheel under the sampling temperature and the sampling rotation speed are obtained, and the method comprises the following steps:
performing linear interpolation on the sampling temperature to obtain high-level time and low-level time corresponding to the number 0 tooth to the number N tooth of the code wheel at a preset rotating speed at the sampling temperature;
performing linear interpolation on the sampling rotation speed to obtain high-level time and low-level time corresponding to the number 0 tooth to the number N tooth of the code wheel at the sampling rotation speed;
and calculating the proportion of the sum of the high level time and the low level time of the No. 0 tooth to the N tooth to one detection period, and calculating the corresponding angle of the No. 0 tooth to the N tooth of the code wheel under the sampling temperature and the sampling rotating speed according to the proportion relation.
S208, searching the sampling temperature and the angles corresponding to the number 0 tooth to the number N tooth of the sampling rotating speed from the angles corresponding to the teeth in the code disc under different preset rotating speeds at different preset temperatures;
after the calibration of the code wheel is completed, the angles corresponding to the teeth from the number 0 to the number N in the code wheel at different preset temperatures and different preset rotating speeds are obtained through table lookup, and the angles corresponding to the number 0 to the number N in the sampling temperature and the sampling rotating speed are sampled so as to prepare for the subsequent calculation of the target rotating speed of the number N teeth.
For example, the sampling temperature is-30 ℃ and the sampling rotation speed is 300rpm, and then angles A1, A5, … and An corresponding to the number 0 tooth to the number N at the code wheel rotation speed of 300rpm at the temperature of-30 ℃ can be obtained through table look-up 4.
S209, obtaining a target rotating speed corresponding to the N number of teeth based on the target high level time, the target low level time and the angle corresponding to the N number of teeth;
and obtaining target high level time and target low level time corresponding to the N-th tooth in the code disc, adding the target high level time and the target low level time to obtain target rotation time, and calculating target rotation speed corresponding to the N-th tooth according to the target rotation time and the angle through a formula (1) by combining the obtained angle corresponding to the N-th tooth.
ωn=θn≡formula (1)
Wherein θn is an angle corresponding to the N number of teeth, t is a target rotation time, and ωn is a target rotation speed of N number.
In the actual rotation, since it is not ensured that the code wheel is always rotated at a constant speed, the actual rotation speed of the N teeth needs to be calculated from the angle of the N teeth and the target rotation time.
S210, θk= Σ (θ (0) +θ (1) + … +θ (N-1)) + Σωn, where θk is the actual rotation angle value, where θ (0) is an angle corresponding to tooth No. 0, θ (1) is an angle corresponding to tooth No. 1, θ (N-1) is an angle corresponding to tooth No. N-1, ωn is a target rotation speed, ts is a preset sampling period, and Σωn×ts is an angle value corresponding to an actual sampling time after rising edge jump of tooth No. N.
After obtaining the angle corresponding to the middle number 0 tooth to the N-1 tooth through table lookup and obtaining the target rotating speed of the N number tooth through calculation in the step S211, the angle value corresponding to the actual sampling time after the rising edge jump of the N number tooth can be obtained through calculation in combination with the preset sampling period through a formula (2).
θk= Σ (θ (0) +θ (1) + … +θ (n-1)) +Σωnequation (2)
Wherein θk is the angle of rising edge jump of the N number of teeth, θ (0) to θ (N-1) are angles corresponding to the 0 number of teeth to the N-1 number of teeth respectively, ωn is the corresponding target rotation speed, and Ts can be a preset small time. And (2) calculating the sum of angles corresponding to the number 0 tooth to the number N-1 tooth respectively, and adding an angle value corresponding to the target rotating speed and the actual sampling time after the rising edge jump of the number N tooth, thereby obtaining the actual rotating angle value of the code disc.
Because the time that one tooth completely passes through the photoelectric switch is longer, the angle is defined as the angle of the rising edge of the pulse signal corresponding to the tooth, so that the angle of rising edge jump of the N number of teeth is obtained, ts is set, multiplied by the target rotating speed and summed, the angle value corresponding to the actual sampling time after rising edge jump of the N number of teeth can be obtained, and the sum of the angle value obtained and the angle value of the 0 number of teeth to the angle of the N-1 number of teeth is added, so that the actual rotating angle value of the code disc is finally obtained.
According to the embodiment of the application, the high-level time and the low-level time generated by each tooth in the code disc passing through the photoelectric switch at different preset temperatures and different preset rotating speeds are obtained, the adopted temperatures and the adopted rotating speeds are obtained and compared with the preset temperatures and the preset rotating speeds, if the adopted temperatures and the adopted rotating speeds are different, the angles corresponding to the number 0 tooth to the number N tooth in the code disc at different adopted temperatures are obtained through interpolation, then the target rotating speed corresponding to the number N tooth at the sampling temperature is calculated by obtaining the high-level time and the low-level time of the current number N tooth, and finally the angle value corresponding to the actual sampling time after jump of the rising edge of the number N tooth and the angle value corresponding to the number 0 tooth to the number N-1 tooth are determined based on the target rotating speed, so that the actual rotating angle value of the code disc is obtained. By adopting the scheme, the effect of improving the accuracy of rotation speed detection is achieved through detection of the code wheel and the photoelectric switch.
Referring to fig. 10, a schematic diagram of an angle calculating device according to an exemplary embodiment of the present application is shown. The angle calculating means may be implemented in software, hardware or a combination of both as all or part of the terminal. The device 1 comprises a time acquisition module 11, a code wheel calibration module 12, an angle acquisition module 13 and an angle determination module 14.
The time acquisition module 11 is used for acquiring high-level time and low-level time generated by each tooth in the code wheel through the photoelectric switch at different preset temperatures and different preset rotating speeds;
a code wheel calibration module 12, configured to calibrate the code wheel based on each of the high level times and each of the low level times;
the angle acquisition module 13 is configured to acquire an angle corresponding to a number 0 tooth to a number N tooth in the code disc at a sampling rotational speed at a sampling temperature based on the calibrated code disc, and acquire a target high level time and a target low level time corresponding to the number N tooth in the code disc at the sampling rotational speed at the sampling temperature, where N is greater than or equal to 0 and less than or equal to N, and N is a last number of teeth of the code disc, and N is a number of teeth corresponding to a current sampling time;
the angle determining module 14 is configured to determine an actual rotation angle value of the code wheel based on an angle corresponding to a number 0 tooth to a number N tooth in the code wheel at the sampling rotation speed at the sampling temperature, the target high level time, the target low level time, and an actual sampling time after a rising edge jump of the number N tooth.
Optionally, as shown in fig. 11, the angle calculating device 1 further includes:
the sampling data judging module 15 is used for judging whether the sampling temperature and the sampling rotation speed are the same as the preset temperature and the preset rotation speed;
and the interpolation module 16 is configured to obtain an angle corresponding to the number 0 tooth to the number N tooth of the code wheel at the sampling temperature and the sampling rotation speed by adopting an interpolation method if the sampling temperature and the sampling rotation speed are different from the preset temperature and the preset rotation speed.
Alternatively, as shown in fig. 12, the code wheel calibration module 12 includes:
a theoretical time obtaining unit 121, configured to obtain a high-level theoretical time and a low-level theoretical time generated by each tooth in the code wheel passing through the photoelectric switch at different preset temperatures and different preset rotation speeds;
the code wheel calibration unit 122 is configured to determine that the code wheel calibration is successful if the high level time generated by each tooth of the code wheel passing through the photoelectric switch and the corresponding high level theoretical time are within an error range at different preset rotational speeds at different preset temperatures, and the low level time generated by each tooth of the code wheel passing through the photoelectric switch and the corresponding low level theoretical time are within an error range at different preset rotational speeds at different preset temperatures.
Alternatively, as shown in fig. 13, the angle determining module 14 includes:
The angle obtaining unit 141 is configured to find the sampling temperature and an angle corresponding to a number 0 tooth to a number N tooth of the sampling rotation speed from angles corresponding to each tooth in the code wheel at different preset rotation speeds and different preset temperatures;
a rotation speed obtaining unit 142, configured to obtain a target rotation speed corresponding to the N number of teeth based on the target high level time, the target low level time, and the angle corresponding to the N number of teeth;
and the angle determining unit 143 is configured to determine an actual rotation angle value of the code wheel based on the angle corresponding to the number 0 tooth to the number N-1 tooth in the code wheel, the target rotation speed corresponding to the number N tooth, and the actual sampling time after the rising edge jump of the number N tooth at the sampling temperature and the sampling rotation speed.
Optionally, the angle determining unit 143 is configured to
θk= Σ (θ (0) +θ (1) + … +θ (n-1)) + Σωn×ts, where θk is the actual rotation angle value;
the angle corresponding to the tooth number 0 is θ (0), the angle corresponding to the tooth number 1 is θ (1), the angle corresponding to the tooth number N-1 is θ (N-1), ωn is the target rotation speed, ts is the preset sampling period, Σωn×ts is the angle value corresponding to the actual sampling time after the rising edge jump of the tooth number N.
Optionally, as shown in fig. 14, the apparatus 1 further includes:
the time determining module 15 is used for determining the maximum value of the low-level time generated by the photoelectric switch when each tooth in the code wheel passes through the photoelectric switch at different preset rotating speeds at different preset temperatures;
and the tooth number 0 determining module 16 is used for determining the tooth corresponding to the maximum value as tooth number 0.
According to the embodiment of the application, the high-level time and the low-level time generated by the photoelectric switch of each tooth in the code disc at different preset temperatures and different preset rotating speeds are obtained, the adopted temperatures and the adopted rotating speeds are obtained and compared with the preset temperatures and the preset rotating speeds, if the adopted temperatures and the adopted rotating speeds are different, the angles corresponding to the number 0 tooth to the number N tooth in the code disc at different adopted temperatures are obtained through interpolation, then the target rotating speed corresponding to the number N tooth at the sampling temperature is calculated by obtaining the high-level time and the low-level time of the current number N tooth, finally the angle value corresponding to the actual sampling time after jump of the rising edge of the number N tooth and the angle value corresponding to the number 0 tooth to the number N-1 tooth are determined based on the target rotating speed, and the actual rotating angle value of the code disc is obtained. By adopting the scheme, the effect of improving the accuracy of rotation speed detection is achieved through detection of the code wheel and the photoelectric switch.
It should be noted that, in the angle calculating device provided in the foregoing embodiment, only the division of the foregoing functional modules is used for illustration when the angle calculating method is executed, and in practical application, the foregoing functional allocation may be performed by different functional modules according to needs, that is, the internal structure of the apparatus is divided into different functional modules, so as to complete all or part of the functions described above. In addition, the angle calculating device and the angle calculating method provided in the foregoing embodiments belong to the same concept, which embody the detailed implementation process in the method embodiment, and are not described herein.
The foregoing embodiment numbers of the present application are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
The embodiment of the present application further provides a computer storage medium, where the computer storage medium may store a plurality of instructions, where the instructions are adapted to be loaded by a processor and execute the method steps of the embodiment shown in fig. 1 to fig. 9, and the specific execution process may refer to the specific description of the embodiment shown in fig. 1 to fig. 9, which is not repeated herein.
The present application also provides an electronic device, where at least one instruction is stored, where the at least one instruction is loaded by the processor and executed by the processor, and detailed descriptions of the embodiments shown in fig. 1 to fig. 9 are omitted herein.
Referring to fig. 15, a schematic structural diagram of an electronic device is provided in an embodiment of the present application. As shown in fig. 15, the electronic device 1000 may include: at least one processor 1001, at least one network interface 1004, a user interface 1003, a memory 1005, at least one communication bus 1002.
Wherein the communication bus 1002 is used to enable connected communication between these components.
The user interface 1003 may include a Display screen (Display) and a Camera (Camera), and the optional user interface 1003 may further include a standard wired interface and a wireless interface.
The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface), among others.
Wherein the processor 1001 may include one or more processing cores. The processor 1001 connects various parts within the entire electronic device 1000 using various interfaces and lines, and performs various functions of the electronic device 1000 and processes data by executing or executing instructions, programs, code sets, or instruction sets stored in the memory 1005, and invoking data stored in the memory 1005. Alternatively, the processor 1001 may be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), programmable logic array (Programmable Logic Array, PLA). The processor 1001 may integrate one or a combination of several of a central processing unit (Central Processing Unit, CPU), an image processor (Graphics Processing Unit, GPU), and a modem, etc. The CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for rendering and drawing the content required to be displayed by the display screen; the modem is used to handle wireless communications. It will be appreciated that the modem may not be integrated into the processor 1001 and may be implemented by a single chip.
The memory 1005 may include a random access memory (Random Access Memory, RAM) or a Read-only memory (Read-only memory). Optionally, the memory 1005 includes a non-transitory computer readable medium (non-transitory computer-readable storage medium). The memory 1005 may be used to store instructions, programs, code, sets of codes, or sets of instructions. The memory 1005 may include a stored program area and a stored data area, wherein the stored program area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing the above-described respective method embodiments, etc.; the storage data area may store data or the like referred to in the above respective method embodiments. The memory 1005 may also optionally be at least one storage device located remotely from the processor 1001. As shown in fig. 15, an operating system, a network communication module, a user interface module, and an angle calculation application program may be included in the memory 1005, which is one type of computer storage medium.
In the electronic device 1000 shown in fig. 15, the user interface 1003 is mainly used for providing an input interface for a user, and acquiring data input by the user; and the processor 1001 may be configured to call an angle calculation application program stored in the memory 1005, and specifically perform the following operations:
Acquiring high-level time and low-level time generated by each tooth passing through a photoelectric switch in a code disc at different preset temperatures and different preset rotating speeds;
calibrating the code wheel based on each high level time and each low level time;
based on the calibrated code disc, acquiring angles corresponding to the number 0 teeth to the number N teeth in the code disc at the sampling temperature and the sampling rotating speed, and acquiring target high-level time and target low-level time corresponding to the number N teeth in the code disc at the sampling temperature and the sampling rotating speed, wherein N is greater than or equal to 0 and less than or equal to N, N is the last number of teeth of the code disc, and the number N is the number of teeth corresponding to the current sampling moment;
and determining an actual rotation angle value of the code disc based on the angle corresponding to the number 0 tooth to the number N tooth in the code disc, the target high level time, the target low level time and the actual sampling time after the rising edge jump of the number N tooth at the sampling temperature and the sampling rotation speed.
In one embodiment, before performing the calibration-based code wheel, the processor 1001 further performs the following operations to obtain the angle corresponding to tooth number 0 to tooth number N in the code wheel at the sampling temperature and the sampling rotational speed:
Judging whether the sampling temperature and the sampling rotating speed are the same as the preset temperature and the preset rotating speed;
and if the sampling temperature and the sampling rotating speed are different from the preset temperature and the preset rotating speed, acquiring angles corresponding to the number 0 tooth to the number N tooth of the code wheel under the sampling temperature and the sampling rotating speed by adopting an interpolation method.
In one embodiment, the processor 1001, when executing calibration of the code wheel based on each of the high level times and each of the low level times, specifically performs the following operations:
acquiring high-level theoretical time and low-level theoretical time generated by each tooth passing through a photoelectric switch in a code disc at different preset temperatures and different preset rotating speeds;
and if the high-level time generated by each tooth passing through the photoelectric switch in the code disc at different preset rotating speeds at different preset temperatures and the corresponding high-level theoretical time are in an error range, and the low-level time generated by each tooth passing through the photoelectric switch in the code disc at different preset rotating speeds at different preset temperatures and the corresponding low-level theoretical time are in an error range, determining that the code disc calibration is successful.
In one embodiment, the processor 1001 specifically performs the following operations when determining the actual rotation angle value of the code wheel based on the angle corresponding to the number 0 tooth to the number N tooth in the code wheel at the sampling temperature and the sampling rotation speed, the target high level time, the target low level time, and the actual sampling time after the rising edge jump of the number N tooth:
Searching the sampling temperature and the angles corresponding to the sampling rotation speed from the number 0 tooth to the number N-1 tooth in the angles corresponding to the teeth in the code disc under different preset rotation speeds at different preset temperatures;
obtaining a target rotating speed corresponding to the N number of teeth based on the target high level time, the target low level time and the angle corresponding to the N number of teeth;
and determining an actual rotation angle value of the code disc based on an angle corresponding to the number 0 tooth to the number N-1 tooth in the code disc at the sampling temperature and the sampling rotation speed, a target rotation speed corresponding to the number N tooth and an actual sampling time after the rising edge of the number N tooth jumps.
In one embodiment, the processor 1001 specifically performs the following operations when determining the actual rotation angle value of the code wheel based on the angle corresponding to the number 0 tooth to the number N tooth in the code wheel at the sampling temperature and the sampling rotation speed, the target high level time, the target low level time, and the actual sampling time after the rising edge jump of the number N tooth:
θk= Σ (θ (0) +θ (1) + … +θ (n-1)) + Σωn×ts, where θk is the actual rotation angle value;
the angle corresponding to the tooth number 0 is θ (0), the angle corresponding to the tooth number 1 is θ (1), the angle corresponding to the tooth number N-1 is θ (N-1), ωn is the target rotation speed, ts is the preset sampling period, Σωn×ts is the angle value corresponding to the actual sampling time after the rising edge jump of the tooth number N.
In one embodiment, the processor 1001, when executing the angle calculation application, further performs the following:
determining the maximum value of low-level time generated by each tooth passing through the photoelectric switch in the code disc at different preset temperatures and different preset rotating speeds;
and determining the tooth corresponding to the maximum value as tooth number 0.
According to the embodiment of the application, the high-level time and the low-level time generated by each tooth in the code disc passing through the photoelectric switch at different preset temperatures and different preset rotating speeds are obtained, the adopted temperatures and the adopted rotating speeds are obtained and compared with the preset temperatures and the preset rotating speeds, if the adopted temperatures and the adopted rotating speeds are different, the angles corresponding to the number 0 tooth to the number N tooth in the code disc at different adopted temperatures are obtained through interpolation, then the target rotating speed corresponding to the number N tooth at the sampling temperature is calculated by obtaining the high-level time and the low-level time of the current number N tooth, and finally the actual rotating angle value of the code disc is obtained based on the target rotating speed and the angle value corresponding to the actual sampling time after the rising edge jump of the number N tooth and the angle value corresponding to the number 0 tooth to the number N-1 tooth. By adopting the scheme, the effect of improving the accuracy of rotation speed detection is achieved through detection of the code wheel and the photoelectric switch.
Those skilled in the art will appreciate that implementing all or part of the above-described methods in accordance with the embodiments may be accomplished by way of a computer program stored on a computer readable storage medium, which when executed may comprise the steps of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a read-only memory, a random access memory, or the like.
The foregoing disclosure is illustrative of the present application and is not to be construed as limiting the scope of the application, which is defined by the appended claims.

Claims (9)

1. A method of angle calculation, the method comprising:
acquiring high-level time and low-level time generated by each tooth passing through a photoelectric switch in a code disc at different preset temperatures and different preset rotating speeds;
calibrating the code wheel based on each high level time and each low level time;
based on the calibrated code disc, acquiring angles corresponding to the number 0 teeth to the number N teeth in the code disc at the sampling temperature and the sampling rotating speed, and acquiring target high-level time and target low-level time corresponding to the number N teeth in the code disc at the sampling temperature and the sampling rotating speed, wherein N is greater than or equal to 0 and less than or equal to N, N is the last number of teeth of the code disc, and the number N is the number of teeth corresponding to the current sampling moment;
Searching the sampling temperature and the angles corresponding to the number 0 tooth to the number N-1 tooth at the sampling rotation speed from the angles corresponding to the teeth in the code wheel at different preset rotation speeds at different preset temperatures;
obtaining a target rotating speed corresponding to the N number of teeth based on the target high level time, the target low level time and the angle corresponding to the N number of teeth;
and determining an actual rotation angle value of the code disc based on the angle corresponding to the number 0 tooth to the number N-1 tooth in the code disc, the target rotation speed corresponding to the number N tooth and the actual sampling time after the rising edge jump of the number N tooth at the sampling temperature and the sampling rotation speed.
2. The method of claim 1, wherein the method further comprises, prior to obtaining an angle corresponding to tooth number 0 to tooth number N in the code wheel at the sampling temperature and the sampling rotational speed based on the calibrated code wheel:
judging whether the sampling temperature and the sampling rotating speed are the same as the preset temperature and the preset rotating speed;
and if the sampling temperature and the sampling rotating speed are different from the preset temperature and the preset rotating speed, acquiring angles corresponding to the number 0 tooth to the number N tooth of the code wheel under the sampling temperature and the sampling rotating speed by adopting an interpolation method.
3. The method of claim 1, wherein the calibrating the code wheel based on each of the high level times and each of the low level times comprises:
Acquiring high-level theoretical time and low-level theoretical time generated by each tooth passing through a photoelectric switch in a code disc at different preset temperatures and different preset rotating speeds;
and if the actual high-level time generated by each tooth passing through the photoelectric switch in the code disc and the corresponding high-level theoretical time are in the error range at different preset temperatures and different preset rotating speeds, and the actual low-level time generated by each tooth passing through the photoelectric switch in the code disc and the corresponding low-level theoretical time are in the error range at different preset temperatures, determining that the code disc is successfully calibrated.
4. The method of claim 1, wherein the determining the actual rotation angle value of the code wheel based on the angle corresponding to tooth number 0 to tooth number N in the code wheel at the sampling temperature and the sampling rotational speed, the target high level time, the target low level time, and the actual sampling time after the rising edge jump of tooth number N comprises:
θk= Σ (θ (0) +θ (1) + … +θ (n-1)) + Σωn×ts, where θk is the actual rotation angle value;
the angle corresponding to the tooth number 0 is θ (0), the angle corresponding to the tooth number 1 is θ (1), the angle corresponding to the tooth number N-1 is θ (N-1), ωn is the target rotation speed, ts is the preset sampling period, Σωn×ts is the angle value corresponding to the actual sampling time after the rising edge jump of the tooth number N.
5. The method according to claim 1, wherein the method further comprises:
determining the maximum value of low-level time generated by each tooth passing through the photoelectric switch in the code disc at different preset temperatures and different preset rotating speeds;
and determining the tooth corresponding to the maximum value as tooth number 0.
6. An angle calculation device, the device comprising:
the time acquisition module is used for acquiring high-level time and low-level time generated by each tooth in the code disc through the photoelectric switch at different preset temperatures and different preset rotating speeds;
the code disc calibration module is used for calibrating the code disc based on the high level time and the low level time;
the angle acquisition module is used for acquiring angles corresponding to the number 0 teeth to the number N teeth in the code disc under the sampling temperature and the sampling rotating speed based on the calibrated code disc, and acquiring target high level time and target low level time corresponding to the number N teeth in the code disc under the sampling temperature and the sampling rotating speed, wherein N is greater than or equal to 0 and less than or equal to N, N is the last number of teeth of the code disc, and the number N is the number of teeth corresponding to the current sampling moment;
the angle determining module is used for searching the sampling temperature and the angles corresponding to the number 0 tooth to the number N-1 tooth at the sampling rotating speed from the angles corresponding to the teeth in the code wheel at different preset rotating speeds at different preset temperatures; obtaining a target rotating speed corresponding to the N number of teeth based on the target high level time, the target low level time and the angle corresponding to the N number of teeth; and determining an actual rotation angle value of the code disc based on the angle corresponding to the number 0 tooth to the number N-1 tooth in the code disc, the target rotation speed corresponding to the number N tooth and the actual sampling time after the rising edge jump of the number N tooth at the sampling temperature and the sampling rotation speed.
7. The apparatus of claim 6, wherein the apparatus further comprises:
the sampling data judging module is used for judging whether the sampling temperature and the sampling rotating speed are the same as the preset temperature and the preset rotating speed;
and the interpolation module is used for acquiring the angles corresponding to the number 0 teeth to the number N teeth of the code wheel under the sampling temperature and the sampling rotating speed by adopting an interpolation method if the sampling temperature and the sampling rotating speed are different from the preset temperature and the preset rotating speed.
8. A computer storage medium having a plurality of instructions adapted to be loaded by a processor and to carry out the method steps of any one of claims 1 to 5.
9. An electronic device, comprising: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to perform the method steps of any of claims 1-5.
CN202111660474.5A 2021-12-30 2021-12-30 Angle calculation method and device, storage medium and electronic equipment Active CN115833491B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202111660474.5A CN115833491B (en) 2021-12-30 2021-12-30 Angle calculation method and device, storage medium and electronic equipment
CN202310926500.7A CN117040208A (en) 2021-12-30 2021-12-30 Angle calculation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111660474.5A CN115833491B (en) 2021-12-30 2021-12-30 Angle calculation method and device, storage medium and electronic equipment

Related Child Applications (1)

Application Number Title Priority Date Filing Date
CN202310926500.7A Division CN117040208A (en) 2021-12-30 2021-12-30 Angle calculation method and device

Publications (2)

Publication Number Publication Date
CN115833491A CN115833491A (en) 2023-03-21
CN115833491B true CN115833491B (en) 2023-08-25

Family

ID=85516134

Family Applications (2)

Application Number Title Priority Date Filing Date
CN202310926500.7A Pending CN117040208A (en) 2021-12-30 2021-12-30 Angle calculation method and device
CN202111660474.5A Active CN115833491B (en) 2021-12-30 2021-12-30 Angle calculation method and device, storage medium and electronic equipment

Family Applications Before (1)

Application Number Title Priority Date Filing Date
CN202310926500.7A Pending CN117040208A (en) 2021-12-30 2021-12-30 Angle calculation method and device

Country Status (1)

Country Link
CN (2) CN117040208A (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN201680963U (en) * 2010-03-25 2010-12-22 重庆大学 Coupled intelligent bearing monitor
CN103913591A (en) * 2014-03-03 2014-07-09 深圳市智慧机器技术有限公司 Method and device for measuring rotating speeds of rotating device
CN105675029A (en) * 2016-01-07 2016-06-15 三一重型能源装备有限公司 Wind power generation system, velocity-measuring and positioning device and method
CN205356209U (en) * 2016-01-28 2016-06-29 西安科技大学 Stepping motor control device
CN106921325A (en) * 2017-04-24 2017-07-04 常州寻心电子科技有限公司 A kind of high speed angular position sensing system and method
CN109791058A (en) * 2016-08-23 2019-05-21 弗瑞柏私人有限公司 Calibrate the method and rotary encoder of rotary encoder
CN110987167A (en) * 2019-12-17 2020-04-10 北京昊鹏智能技术有限公司 Fault detection method, device, equipment and storage medium for rotary mechanical equipment

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN201680963U (en) * 2010-03-25 2010-12-22 重庆大学 Coupled intelligent bearing monitor
CN103913591A (en) * 2014-03-03 2014-07-09 深圳市智慧机器技术有限公司 Method and device for measuring rotating speeds of rotating device
CN105675029A (en) * 2016-01-07 2016-06-15 三一重型能源装备有限公司 Wind power generation system, velocity-measuring and positioning device and method
CN205356209U (en) * 2016-01-28 2016-06-29 西安科技大学 Stepping motor control device
CN109791058A (en) * 2016-08-23 2019-05-21 弗瑞柏私人有限公司 Calibrate the method and rotary encoder of rotary encoder
CN106921325A (en) * 2017-04-24 2017-07-04 常州寻心电子科技有限公司 A kind of high speed angular position sensing system and method
CN110987167A (en) * 2019-12-17 2020-04-10 北京昊鹏智能技术有限公司 Fault detection method, device, equipment and storage medium for rotary mechanical equipment

Also Published As

Publication number Publication date
CN117040208A (en) 2023-11-10
CN115833491A (en) 2023-03-21

Similar Documents

Publication Publication Date Title
CN109959400B (en) Method and device for calculating absolute encoder parameters and terminal equipment
EP2998848A1 (en) Method, device, and apparatus for controlling screen rotation
CN112781484B (en) Rotor angle calibration method and device of linear Hall sensor and electronic equipment
CN108474671B (en) Mechanical angle detection method, holder and machine-readable storage medium
US10451647B2 (en) Method and device for measuring speed of permanent magnet synchronous motor
JP6352540B2 (en) Detection device, rotation angle detection device, detection method, and program
CN115833491B (en) Angle calculation method and device, storage medium and electronic equipment
JP6286983B2 (en) Temperature correction method and temperature correction apparatus for received signal strength indicator
CN115543514A (en) Pointer display method, device, chip, electronic watch, and readable storage medium
CN110865785A (en) Method and device for acquiring pixel size and electronic equipment
CN113300792B (en) Marking method, system and storage medium for extremely weak radio frequency interference
CN115561731B (en) Pose optimization method, point cloud map establishment method, computer device and medium
CN116482660A (en) Efficient calibration method, system, equipment and medium for mobile platform radar
CN114298098A (en) Data processing method and device for error correction
CN114168890A (en) Fourier coefficient calculation method, device, terminal equipment and medium
CN114975212A (en) Wafer center positioning method, device, equipment and medium
CN110020264B (en) Method and device for determining invalid hyperlinks
CN113489970A (en) Method and device for correcting pan-tilt camera, storage medium and electronic device
CN110388938B (en) Notification method, terminal and computer storage medium
CN113063447B (en) Gyroscope calibration method and device, readable storage medium and electronic equipment
US9245322B2 (en) Method and arrangement for suppressing noise in digital signal sequences and a corresponding computer program and a corresponding computer-readable storage medium
CN111829550A (en) Movement distance determination method, device and equipment
CN116360649A (en) Mobile control method, device, equipment and medium
CN115391612B (en) Data processing method, device, equipment and readable storage medium
CN113904607B (en) Predictive current control method for permanent magnet synchronous motor and related equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant