[go: up one dir, main page]

CN111426339B - Code detection method and device - Google Patents

Code detection method and device Download PDF

Info

Publication number
CN111426339B
CN111426339B CN202010520501.8A CN202010520501A CN111426339B CN 111426339 B CN111426339 B CN 111426339B CN 202010520501 A CN202010520501 A CN 202010520501A CN 111426339 B CN111426339 B CN 111426339B
Authority
CN
China
Prior art keywords
square wave
wave signal
code
photoelectric encoder
array string
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
CN202010520501.8A
Other languages
Chinese (zh)
Other versions
CN111426339A (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.)
Beijing Yunji Technology Co Ltd
Original Assignee
Beijing Yunji 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 Beijing Yunji Technology Co Ltd filed Critical Beijing Yunji Technology Co Ltd
Priority to CN202010520501.8A priority Critical patent/CN111426339B/en
Publication of CN111426339A publication Critical patent/CN111426339A/en
Application granted granted Critical
Publication of CN111426339B publication Critical patent/CN111426339B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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
    • G01D5/00Mechanical means for transferring the output of a sensing member; Means for converting the output of a sensing member to another variable where the form or nature of the sensing member does not constrain the means for converting; Transducers not specially adapted for a specific variable
    • G01D5/26Mechanical means for transferring the output of a sensing member; Means for converting the output of a sensing member to another variable where the form or nature of the sensing member does not constrain the means for converting; Transducers not specially adapted for a specific variable characterised by optical transfer means, i.e. using infrared, visible, or ultraviolet light
    • G01D5/32Mechanical means for transferring the output of a sensing member; Means for converting the output of a sensing member to another variable where the form or nature of the sensing member does not constrain the means for converting; Transducers not specially adapted for a specific variable characterised by optical transfer means, i.e. using infrared, visible, or ultraviolet light with attenuation or whole or partial obturation of beams of light
    • G01D5/34Mechanical means for transferring the output of a sensing member; Means for converting the output of a sensing member to another variable where the form or nature of the sensing member does not constrain the means for converting; Transducers not specially adapted for a specific variable characterised by optical transfer means, i.e. using infrared, visible, or ultraviolet light with attenuation or whole or partial obturation of beams of light the beams of light being detected by photocells
    • G01D5/36Forming the light into pulses
    • G01D5/366Particular pulse shapes
    • 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
    • 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
    • G01D5/00Mechanical means for transferring the output of a sensing member; Means for converting the output of a sensing member to another variable where the form or nature of the sensing member does not constrain the means for converting; Transducers not specially adapted for a specific variable
    • G01D5/26Mechanical means for transferring the output of a sensing member; Means for converting the output of a sensing member to another variable where the form or nature of the sensing member does not constrain the means for converting; Transducers not specially adapted for a specific variable characterised by optical transfer means, i.e. using infrared, visible, or ultraviolet light
    • G01D5/32Mechanical means for transferring the output of a sensing member; Means for converting the output of a sensing member to another variable where the form or nature of the sensing member does not constrain the means for converting; Transducers not specially adapted for a specific variable characterised by optical transfer means, i.e. using infrared, visible, or ultraviolet light with attenuation or whole or partial obturation of beams of light
    • G01D5/34Mechanical means for transferring the output of a sensing member; Means for converting the output of a sensing member to another variable where the form or nature of the sensing member does not constrain the means for converting; Transducers not specially adapted for a specific variable characterised by optical transfer means, i.e. using infrared, visible, or ultraviolet light with attenuation or whole or partial obturation of beams of light the beams of light being detected by photocells
    • G01D5/36Forming the light into pulses

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Optical Transform (AREA)
  • Transmission And Conversion Of Sensor Element Output (AREA)

Abstract

The application provides a code detection method and a device, relates to the technical field of control, and is used for detecting whether a photoelectric encoder has a fault, wherein the code detection method comprises the following steps: acquiring a first square wave signal and a second square wave signal which are generated by a photoelectric module of a photoelectric encoder and used for detecting a driving motor connected with the photoelectric encoder; capturing two edges of the square wave signal to obtain a coding array string; and compares it with the standard code array string to determine whether missing codes appear in the output of the photoelectric encoder. The first square wave signal and the second square wave signal are obtained by a photoelectric encoder detecting a driving motor connected with the photoelectric encoder, a code array string is obtained from the first square wave signal and the second square wave signal, and whether the photoelectric encoder has a code loss fault or not is accurately judged through comparison between the code array string and a standard code array, so that when the robot cannot normally run, whether the robot has the code loss fault or not can be accurately judged.

Description

Code detection method and device
Technical Field
The present application relates to the field of control technologies, and in particular, to a method and an apparatus for code detection.
Background
The existing robot is mostly driven by a brushless direct current motor or a permanent magnet synchronous motor to realize movement and walking, and the movement of the robot needs to strictly control the track and speed of the robot, so that vector control is mostly adopted in a control strategy of the driving motor, and the key of the vector control is feedback control, namely speed closed-loop feedback control and current closed-loop feedback control are adopted to achieve rapid and accurate control of the speed. The key of the speed closed-loop feedback control is the acquisition of the actual speed of the robot.
In order to accurately acquire the actual speed of the robot, a precise photoelectric encoder is generally adopted for speed acquisition, and once the photoelectric encoder fails, for example, a code is lost, the acquired speed is incorrect, so that the robot cannot normally operate, and finally overcurrent protection is realized. Most robot drivers cannot detect the faults of the encoders, particularly the faults of missing codes, so that when the robot cannot normally operate, whether the robot is caused by the faults of the encoders or not cannot be accurately judged.
Disclosure of Invention
An object of the present invention is to provide a method and an apparatus for detecting a code, so as to solve the problem that a fault of a coder cannot be detected in the prior art.
In a first aspect, an embodiment of the present application provides a code detection method, configured to detect whether a photoelectric encoder fails, where the code detection method includes the following steps: acquiring a first square wave signal and a second square wave signal which are generated by a photoelectric module of the photoelectric encoder and used for detecting a driving motor connected with the photoelectric encoder; performing signal double-edge capture on the first square wave signal and the second square wave signal to acquire a coding array string; the encoding array string comprises a plurality of sequentially arranged encoding arrays, each encoding array comprises a first code and a second code, the first code corresponds to the first square wave signal, and the second code corresponds to the second square wave signal; and comparing the code array string with a standard code array string to judge whether the output of the photoelectric encoder has lost codes.
In the implementation process, the first square wave signal and the second square wave signal are acquired by a photoelectric encoder detecting a driving motor connected with the photoelectric encoder, a coding array string is acquired from the first square wave signal and the second square wave signal in a signal double-edge capturing mode, and whether a code loss fault occurs in the photoelectric encoder is accurately judged through comparison between the coding array string and a standard coding array, so that when the robot cannot normally run, whether the robot is caused by the fact that the encoder fails can be accurately judged.
Optionally, the step of performing signal double-edge capture on the first square wave signal and the second square wave signal to obtain the encoded array string includes: detecting the change of signal high-low level conversion of the first square wave signal and the second square wave signal; when the high and low levels of the signal are changed, acquiring a corresponding coding array; and determining a code array string according to a plurality of code arrays.
Optionally, after the step of comparing the encoded array string with a standard encoded array string to determine whether a missing code occurs in the output of the optical-electrical encoder, the method further includes: acquiring abnormal code positions of the code array string inconsistent with the standard code array string; and determining that the code disc of the photoelectric encoder has a fault according to the inconsistent abnormal code position.
Optionally, after the step of performing signal double-edge capture on the first square wave signal and the second square wave signal to obtain the encoded array string, the method includes: acquiring a coding sequence corresponding to a driving motor connected with the photoelectric encoder; and judging whether the code array string conforms to the coding sequence, and if not, determining that a code disc of the photoelectric encoder fails.
Optionally, after the step of acquiring a first square wave signal and a second square wave signal generated by a photovoltaic module of the photoelectric encoder and used for detecting a driving motor connected to the photoelectric encoder, the method further includes: acquiring a clock signal; and determining the rotating speed of the driving motor connected with the photoelectric encoder according to the clock signal, the first square wave signal and the second square wave signal.
Optionally, after the step of comparing the encoded array string with a standard encoded array string to determine whether a missing code occurs in the output of the optical-electrical encoder, the method further includes: acquiring a third-party wave signal, and detecting a pulse signal in the third-party wave signal; and when a pulse signal appears in the third square wave signal, the first square wave signal and the second square wave signal are acquired again.
Can guarantee to have under the condition of losing the code, reacquire first square wave signal and second square wave signal, can be according to the comparatively accurate rotational speed that acquires driving motor of first square wave signal and second square wave signal. And then guarantee that the robot can possess certain missing code fault-tolerant ability under the condition that the code missing trouble appears.
In a second aspect, an embodiment of the present application provides an encoding detection apparatus for detecting whether a photoelectric encoder fails, where the apparatus includes: the square wave signal acquisition module is used for acquiring a first square wave signal and a second square wave signal which are generated by a photoelectric module of the photoelectric encoder and used for detecting a driving motor connected with the photoelectric encoder; the encoding array string acquisition module is used for capturing the two edges of the first square wave signal and the second square wave signal to acquire an encoding array string; the encoding array string comprises a plurality of sequentially arranged encoding arrays, each encoding array comprises a first code and a second code, the first code corresponds to the first square wave signal, and the second code corresponds to the second square wave signal; and the judging module is used for comparing the code array string with a standard code array string so as to judge whether the output of the photoelectric encoder has lost codes.
Optionally, the encoding array string obtaining module includes: the signal detection unit is used for detecting the change of signal high-low level conversion of the first square wave signal and the second square wave signal; the coding array obtaining unit is used for obtaining a corresponding coding array when the high and low levels of the signal are changed; and the coding array string determining unit is used for determining a coding array string according to a plurality of coding arrays.
Optionally, the apparatus further comprises: the abnormal code position acquisition module is used for acquiring the abnormal code position of the code array string which is inconsistent with the standard code array string; and the fault determining module is used for determining that the code disc of the photoelectric encoder has faults according to the inconsistent abnormal coding positions.
Optionally, the encoding array string obtaining module includes: the coding sequence acquisition unit is used for acquiring a coding sequence corresponding to a driving motor connected with the photoelectric encoder; and the sequence judging unit is used for judging whether the coding array string conforms to the coding sequence, and if not, determining that a code disc of the photoelectric encoder fails.
Optionally, the apparatus further comprises: the clock acquisition module is used for acquiring a clock signal; and the rotating speed determining module is used for determining the rotating speed of the driving motor connected with the photoelectric encoder according to the clock signal, the first square wave signal and the second square wave signal.
Optionally, the apparatus further comprises: the third method signal acquisition module is used for acquiring a third square wave signal and detecting a pulse signal in the third square wave signal; and the square wave signal acquisition module is used for acquiring the first square wave signal and the second square wave signal again when a pulse signal appears in the third square wave signal.
In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory, where the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the electronic device executes the method provided in the first aspect.
In a fourth aspect, embodiments of the present application provide a readable storage medium, on which a computer program is stored, where the computer program runs the method provided in the first aspect as described above when being executed by a processor.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and that those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
Fig. 1 is a flowchart of a code detection method according to an embodiment of the present application;
fig. 2 is a schematic structural diagram of an optical-electrical encoder according to an embodiment of the present disclosure;
FIG. 3 is a schematic diagram of a square wave signal provided by an embodiment of the present application;
FIG. 4 is a schematic diagram of another square wave signal provided by an embodiment of the present application;
fig. 5 is a schematic structural diagram of a code detection apparatus according to an embodiment of the present disclosure;
fig. 6 is a block diagram of an electronic device according to an embodiment of the present disclosure.
Icon: 100-code detection means; 110-a square wave signal acquisition module; 120-code array string obtaining module; 130-a judgment module; 210-a light source; 220-code disc; 230-a diaphragm plate; 240-an optoelectronic component; 601-a processor; 602-a communication interface; 603-a memory; 604-communication bus.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present application without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present application, the terms "first", "second", and the like are used only for distinguishing the description, and are not to be construed as indicating or implying relative importance.
Referring to fig. 1, fig. 1 is a flow chart of a code detection method according to an embodiment of the present application, where the embodiment of the present application provides a code detection method for detecting whether a photoelectric encoder fails, and the code detection method includes the following steps:
step S110: the method comprises the steps of obtaining a first square wave signal and a second square wave signal which are generated by a photoelectric module of a photoelectric encoder and used for detecting a driving motor connected with the photoelectric encoder.
Referring to fig. 2, fig. 2 is a schematic structural diagram of an optical-electrical encoder according to an embodiment of the present disclosure, the optical-electrical encoder includes a set of light sources 210, a code wheel 220, a diaphragm 230, and an optical-electrical assembly 240, wherein radial light-transmitting slits, i.e., gratings, with equal pitches are engraved on the code wheel 220, and two sets of light-transmitting slits corresponding to the code wheel 220 are engraved on the diaphragm 230, and are used for passing or blocking light rays from the light sources 210 to the optical-electrical assembly 240. The pitch between the light-transmitting slits on the diaphragm 230 is equal to the pitch between the radial light-transmitting slits on the code wheel 220, and the two sets of light-transmitting slits on the diaphragm 230 are staggered 1/4 in pitch so that the signals that the opto-electronic component 240 can detect and output differ in phase by 90 °. The code wheel 220 is generally mounted on a rotating shaft of a driving motor of the robot to be tested, so that when the code wheel 220 rotates along with the rotating shaft to be tested, the diaphragm plate 230 does not move, light passes through the code wheel 220 and the slits on the diaphragm plate 230 and irradiates the optoelectronic component 240, and the optoelectronic component 240 outputs two groups of first square wave signals and second square wave signals with a phase difference of 90 °, as shown in fig. 3, where a square wave signal is a first square wave signal, and a square wave signal b is a second square wave signal.
Step S120: performing signal double-edge capture on the first square wave signal and the second square wave signal to acquire a coding array string; the coding array string comprises a plurality of coding arrays which are sequentially arranged, each coding array comprises a first code and a second code, the first codes correspond to the first square wave signals, and the second codes correspond to the second square wave signals.
Specifically, when signal double-edge capture is performed on the first square wave signal and the second square wave signal to obtain the code array string, the following process may be adopted: firstly, detecting the change of signal high-low level conversion of a first square wave signal and a second square wave signal, and then acquiring a corresponding coding array when the change of signal high-low level conversion occurs; and finally determining a code array string according to the plurality of code arrays.
Signal double edge capture triggers data capture when the high and low state of the signal changes, and is therefore often used to test pulse widths, either high or low, where it is used to capture a code array string. For example, in fig. 3, a first square wave signal a changes from a low level to a high level first, thereby triggering data capture, a first code 1 is obtained according to the first square wave signal a, a second code 1 is obtained according to the second square wave signal b, thereby obtaining a code array 11, then a second square wave signal b changes from a high level to a low level, thereby triggering data capture again, a first code 1 is obtained according to the first square wave signal a, a second code 0 is obtained according to the second square wave signal b, the code array is 10, and subsequently code arrays 00, 01, 11, 10, 00, and 01 are obtained in sequence by performing double edge capture on the first square wave signal a and the second square wave signal b, thereby obtaining a code array string 11, 10, 00, 01, 11, 10, and 01 by performing double edge capture on the first square wave signal a and the second square wave signal b, 00. 01, 11, 10, 00 and 01. It will be appreciated that the encoded array string may also be represented in other forms, for example, the encoded array string obtained as described above may be represented in decimal, specifically 3, 2, 0, 1, 3, 2, 0, and 1.
Step S130: and comparing the code array string with the standard code array string to judge whether the output of the photoelectric encoder has lost codes.
If a missing code occurs in the photoelectric encoder, the acquired first square wave signal and second square wave signal are as shown in fig. 4, at this time, the code array strings acquired according to the first square wave signal and second square wave signal in which the missing code occurs are 11, 10, 00, 01, and if the standard code array string is the code array string 11, 10, 00, 01, 11, 10, 00, 01 corresponding to fig. 3, it can be found by comparison that the code array string acquired in the period of time obviously lacks a plurality of code arrays compared with the standard code array string in the period of time, and normally 12 code arrays should be acquired, and in the case of the missing code, only 8 code arrays are acquired, so that it can be determined that the missing code occurs in the output of the photoelectric encoder.
In the implementation process, the first square wave signal and the second square wave signal are acquired by a photoelectric encoder detecting a driving motor connected with the photoelectric encoder, a coding array string is acquired from the first square wave signal and the second square wave signal in a signal double-edge capturing mode, and whether a code loss fault occurs in the photoelectric encoder is accurately judged through comparison between the coding array string and a standard coding array, so that when the robot cannot normally run, whether the robot is caused by the fact that the encoder fails can be accurately judged.
The code array string is compared with the standard code array string to judge whether the output of the photoelectric encoder is lost or not, and then the abnormal code position of the code array string, which is inconsistent with the standard code array string, can be obtained, and the code disc of the photoelectric encoder is determined to be in fault according to the inconsistent abnormal code position.
For example, if the standard code array strings are sequentially cycled through 11, 01, 00, 10, and 11 …, and the obtained code array strings are 11, 00, 10, and 11 … …, it is obvious that the second bit of the 01 code is lost in the obtained code array strings, that is, the second bit code is an abnormal code position, and it can be found out which specific raster in the code wheel has a fault according to the abnormal code position.
In addition, whether a code disc of the photoelectric encoder fails or not can be judged through the coding sequence, specifically, after signal double-edge capture is carried out on the first square wave signal and the second square wave signal to obtain the coding array string, the coding sequence corresponding to a driving motor connected with the photoelectric encoder can be obtained firstly, then whether the coding array string accords with the coding sequence or not is judged, and if not, the code disc of the photoelectric encoder fails. For example, if the coding sequence is 11, 01, 00, 10 four pairs of coding arrays are sequentially circulated, and the obtained coding array string is 11, 00, 10, 11 … …, it is obvious that 01 codes are lost in the obtained coding array string and the obtained coding array string does not conform to the coding sequence, and therefore, it can be determined that the code disc of the photoelectric encoder has a fault.
After the first square wave signal and the second square wave signal are obtained, the rotating speed of a driving motor connected with the photoelectric encoder can be calculated, and specifically, a clock signal can be obtained firstly; and then determining the rotating speed of a driving motor connected with the photoelectric encoder according to the clock signal, the first square wave signal and the second square wave signal. For example, a count time T is obtained from the clock signal, and then the number N of rising edges and falling edges within the count time T is obtained, thereby calculating the speed of the motor.
If the code array string is compared with the standard code array string, and after the output of the photoelectric encoder is judged to have lost codes, a third-party wave signal can be obtained, a pulse signal in the third-party wave signal is detected, the pulse signal in the third-party wave signal can indicate that the code disc rotates for a circle, when the pulse signal occurs in the third-party wave signal, the first square wave signal and the second square wave signal are obtained again, the situation that the codes are lost can be ensured, the first square wave signal and the second square wave signal are obtained again, and the rotating speed of the driving motor can be accurately obtained according to the first square wave signal and the second square wave signal. And then guarantee that the robot can possess certain missing code fault-tolerant ability under the condition that the code missing trouble appears.
Under the normal working condition of the photoelectric encoder, the square wave signal obtained in the counting time of one circle of code disc rotation comprises 1000 rising edges and falling edges, and then the rotating speed is calculated to be T1 according to the 1000 rising edges and falling edges and the counting time. If the photoelectric encoder has a missing code condition, the square wave signal obtained in the counting time of one rotation of the code disc comprises 800 number of rising edges and falling edges, the calculated rotating speed is T2, T2 should be smaller than T1, if the photoelectric encoder continues to work, each rotation of the code disc, the number of missing codes is accumulated in the square wave signal, including the total number of rising and falling edges, if the code wheel rotates three times, the number of the rising edges and the falling edges in the obtained square wave signal can be only 2100, and at the moment, the corresponding calculated T3 is smaller than T2, and T2 is more accurate relative to T3, therefore, the first square wave signal and the second square wave signal can be obtained again by detecting the pulse signal in the third square wave signal, so that the code accumulation and the total number are avoided being lost, therefore, the accuracy of calculating the rotating speed of the driving motor is ensured, and the fault tolerance of the method is improved.
Based on the same inventive concept, an encoding detection apparatus 100 is further provided in the embodiments of the present application, please refer to fig. 5, and fig. 5 is a block diagram of the encoding detection apparatus 100 provided in the embodiments of the present application. The apparatus may be a module, a program segment, or code on an electronic device. It should be understood that the code detection apparatus 100 corresponds to the above-mentioned embodiment of the method of fig. 1, and can perform the steps related to the embodiment of the method of fig. 1, and the specific functions of the code detection apparatus 100 can be referred to the description above, and the detailed description is appropriately omitted here to avoid redundancy.
Optionally, the encoding detection apparatus 100 is configured to detect whether the photoelectric encoder fails, and the encoding detection apparatus 100 includes:
the square wave signal acquisition module 110 is configured to acquire a first square wave signal and a second square wave signal, which are generated by a photoelectric module of the photoelectric encoder and used for detecting a driving motor connected to the photoelectric encoder;
a code array string obtaining module 120, configured to perform signal double-edge capture on the first square wave signal and the second square wave signal to obtain a code array string; the encoding array string comprises a plurality of sequentially arranged encoding arrays, each encoding array comprises a first code and a second code, the first codes correspond to the first square wave signals, and the second codes correspond to the second square wave signals;
the determining module 130 is configured to compare the code array string with the standard code array string to determine whether a missing code appears in the output of the optical-electrical encoder.
Optionally, the encoding array string obtaining module includes:
the signal detection unit is used for detecting the change of signal high-low level conversion of the first square wave signal and the second square wave signal;
the coding array obtaining unit is used for obtaining a corresponding coding array when the high and low levels of the signal are changed;
and the coding array string determining unit is used for determining a coding array string according to the plurality of coding arrays.
Optionally, the apparatus further comprises:
the abnormal code position acquisition module is used for acquiring the abnormal code position of the code array string which is inconsistent with the standard code array string;
and the fault determining module is used for determining that the code disc of the photoelectric encoder has faults according to the inconsistent abnormal coding positions.
Optionally, the encoding array string obtaining module includes:
the encoding sequence acquisition unit is used for acquiring an encoding sequence corresponding to a driving motor connected with the photoelectric encoder;
and the sequence judging unit is used for judging whether the coding array string conforms to the coding sequence, and if not, determining that a code disc of the photoelectric encoder fails.
Optionally, the apparatus further comprises:
the clock acquisition module is used for acquiring a clock signal;
and the rotating speed determining module is used for determining the rotating speed of a driving motor connected with the photoelectric encoder according to the clock signal, the first square wave signal and the second square wave signal.
Optionally, the apparatus further comprises:
the third method signal acquisition module is used for acquiring a third square wave signal and detecting a pulse signal in the third square wave signal;
and the square wave signal acquisition module is used for acquiring the first square wave signal and the second square wave signal again when a pulse signal appears in the third square wave signal.
Referring to fig. 6, fig. 6 is a block diagram of an electronic device according to an embodiment of the present disclosure, where the electronic device includes: at least one processor 601, at least one communication interface 602, at least one memory 603, and at least one communication bus 604. Wherein the communication bus 604 is used for implementing direct connection communication of these components, the communication interface 602 is used for communicating signaling or data with other node devices, and the memory 603 stores machine-readable instructions executable by the processor 601. When the electronic device is in operation, the processor 601 communicates with the memory 603 via the communication bus 604, and the machine-readable instructions when called by the processor 601 perform the methods described above.
The processor 601 may be an integrated circuit chip having signal processing capabilities. The processor 601 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field-Programmable Gate arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components. Which may implement or perform the various methods, steps, and logic blocks disclosed in the embodiments of the present application. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The Memory 603 may include, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read Only Memory (PROM), an Erasable Read Only Memory (EPROM), an electrically Erasable Read Only Memory (EEPROM), and the like.
It will be appreciated that the configuration shown in fig. 6 is merely illustrative and that the electronic device may include more or fewer components than shown in fig. 6 or have a different configuration than shown in fig. 6. The components shown in fig. 6 may be implemented in hardware, software, or a combination thereof.
The present application provides a readable storage medium, and when being executed by a processor, a computer program performs the method processes performed by an electronic device in the method embodiment shown in fig. 1.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working process of the apparatus described above may refer to the corresponding process in the foregoing method, and will not be described in too much detail herein.
In summary, the present application provides a method and an apparatus for detecting whether a photoelectric encoder has a fault, where the method includes the following steps: acquiring a first square wave signal and a second square wave signal which are generated by a photoelectric module of a photoelectric encoder and used for detecting a driving motor connected with the photoelectric encoder; performing signal double-edge capture on the first square wave signal and the second square wave signal to acquire a coding array string; the encoding array string comprises a plurality of sequentially arranged encoding arrays, each encoding array comprises a first code and a second code, the first codes correspond to the first square wave signals, and the second codes correspond to the second square wave signals; and comparing the code array string with the standard code array string to judge whether the output of the photoelectric encoder has lost codes. The first square wave signal and the second square wave signal are obtained by a photoelectric encoder detecting a driving motor connected with the photoelectric encoder, a coding array string is obtained from the first square wave signal and the second square wave signal in a signal double-edge capturing mode, and whether a code loss fault occurs in the photoelectric encoder is accurately judged through comparison between the coding array string and a standard coding array, so that when the robot cannot normally run, whether the robot is caused by the fact that the encoder fails can be accurately judged.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces 602, and may be in an electrical, mechanical or other form.
In addition, units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
Furthermore, the functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
In this document, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (9)

1. A code detection method for detecting whether a photoelectric encoder has a failure, the code detection method comprising the steps of:
acquiring a first square wave signal and a second square wave signal which are generated by a photoelectric module of the photoelectric encoder and used for detecting a driving motor connected with the photoelectric encoder;
performing signal double-edge capture on the first square wave signal and the second square wave signal to acquire a coding array string; the encoding array string comprises a plurality of sequentially arranged encoding arrays, each encoding array comprises a first code and a second code, the first code corresponds to the first square wave signal, and the second code corresponds to the second square wave signal;
comparing the code array string with a standard code array string to judge whether the output of the photoelectric encoder has lost codes;
after the step of comparing the encoded array string to a standard encoded array string to determine whether a missing code is present at the output of the optoelectronic encoder, the method further comprises:
acquiring abnormal code positions of the code array string inconsistent with the standard code array string;
and determining the fault position of a code disc of the photoelectric encoder and the grating fault position of the code disc of the photoelectric encoder according to the inconsistent abnormal coding position.
2. The method of claim 1, wherein said step of performing signal double edge capture on said first square wave signal and said second square wave signal to obtain a coded array string comprises:
detecting the change of signal high-low level conversion of the first square wave signal and the second square wave signal;
when the high and low levels of the signal are changed, acquiring a corresponding coding array;
and determining a code array string according to a plurality of code arrays.
3. The method of claim 1, wherein said step of performing signal double edge capture on said first square wave signal and said second square wave signal to obtain said encoded array string comprises:
acquiring a coding sequence corresponding to a driving motor connected with the photoelectric encoder;
and judging whether the code array string conforms to the coding sequence, and if not, determining that a code disc of the photoelectric encoder fails.
4. The method of claim 1, wherein after the step of obtaining the first square wave signal and the second square wave signal generated by the optoelectronic module of the optoelectronic encoder for detecting the driving motor connected to the optoelectronic encoder, the method further comprises:
acquiring a clock signal;
and determining the rotating speed of the driving motor connected with the photoelectric encoder according to the clock signal, the first square wave signal and the second square wave signal.
5. The method of claim 1, wherein after the step of comparing the encoded array string to a standard encoded array string to determine whether missing codes are present at the output of the optoelectronic encoder, the method further comprises:
acquiring a third-party wave signal, and detecting a pulse signal in the third-party wave signal;
and when a pulse signal appears in the third square wave signal, the first square wave signal and the second square wave signal are acquired again.
6. An encoding detection apparatus for detecting whether a photoelectric encoder is malfunctioning, the apparatus comprising:
the square wave signal acquisition module is used for acquiring a first square wave signal and a second square wave signal which are generated by a photoelectric module of the photoelectric encoder and used for detecting a driving motor connected with the photoelectric encoder;
the encoding array string acquisition module is used for capturing the two edges of the first square wave signal and the second square wave signal to acquire an encoding array string; the encoding array string comprises a plurality of sequentially arranged encoding arrays, each encoding array comprises a first code and a second code, the first code corresponds to the first square wave signal, and the second code corresponds to the second square wave signal;
the judging module is used for comparing the code array string with a standard code array string so as to judge whether the output of the photoelectric encoder has lost codes;
the device further comprises: the abnormal code position acquisition module is used for acquiring the abnormal code position of the code array string which is inconsistent with the standard code array string;
and the fault determining module is used for determining the fault of the code disc of the photoelectric encoder and the grating fault position of the code disc of the photoelectric encoder according to the inconsistent abnormal coding positions.
7. The apparatus of claim 6, wherein the code array string obtaining module comprises:
the signal detection unit is used for detecting the change of signal high-low level conversion of the first square wave signal and the second square wave signal;
the coding array obtaining unit is used for obtaining a corresponding coding array when the high and low levels of the signal are changed;
and the coding array string determining unit is used for determining a coding array string according to a plurality of coding arrays.
8. An electronic device comprising a processor and a memory, the memory storing computer readable instructions that, when executed by the processor, perform the method of any of claims 1 to 5.
9. A readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1 to 5.
CN202010520501.8A 2020-06-10 2020-06-10 Code detection method and device Active CN111426339B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010520501.8A CN111426339B (en) 2020-06-10 2020-06-10 Code detection method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010520501.8A CN111426339B (en) 2020-06-10 2020-06-10 Code detection method and device

Publications (2)

Publication Number Publication Date
CN111426339A CN111426339A (en) 2020-07-17
CN111426339B true CN111426339B (en) 2020-09-25

Family

ID=71551350

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010520501.8A Active CN111426339B (en) 2020-06-10 2020-06-10 Code detection method and device

Country Status (1)

Country Link
CN (1) CN111426339B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114485756A (en) * 2020-10-26 2022-05-13 北京金风科创风电设备有限公司 Detection apparatus and method of rotary encoder, and computer-readable storage medium
CN114413941B (en) * 2021-12-29 2024-10-11 歌尔科技有限公司 Photocell detection system, coding control method, processing chip, device and medium
CN114844742B (en) * 2022-07-04 2022-10-21 广东采日能源科技有限公司 Battery management system and control method thereof
CN118151132A (en) * 2022-12-05 2024-06-07 上海禾赛科技有限公司 Position detection device for laser radar rotating mechanism, self-diagnosis method of position detection device and laser radar

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004144667A (en) * 2002-10-25 2004-05-20 Okuma Corp Anomaly detection device for location information
CN100346137C (en) * 2002-09-25 2007-10-31 约翰尼斯海登海恩博士股份有限公司 Method for measuring absolute position

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007322301A (en) * 2006-06-02 2007-12-13 Okuma Corp Absolute position detector
CN101782405B (en) * 2010-01-26 2013-04-10 中国科学院光电技术研究所 Hardware real-time verification method and system based on pseudo-random coding displacement sensor
JP2013190327A (en) * 2012-03-14 2013-09-26 Omron Corp Monitoring device and method for rotary encoder
JP5994305B2 (en) * 2012-03-15 2016-09-21 オムロン株式会社 Rotary encoder and error detection method for rotary encoder
JP6363559B2 (en) * 2015-06-10 2018-07-25 ファナック株式会社 Rotation angle detector that can detect entry of foreign matter
EP3465099A1 (en) * 2016-05-25 2019-04-10 Renishaw plc Adaptive reference mark detection process
JP6549637B2 (en) * 2017-05-29 2019-07-24 ファナック株式会社 Encoder system having abnormality detection function and abnormality detection method

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100346137C (en) * 2002-09-25 2007-10-31 约翰尼斯海登海恩博士股份有限公司 Method for measuring absolute position
JP2004144667A (en) * 2002-10-25 2004-05-20 Okuma Corp Anomaly detection device for location information

Also Published As

Publication number Publication date
CN111426339A (en) 2020-07-17

Similar Documents

Publication Publication Date Title
CN111426339B (en) Code detection method and device
CN101825484B (en) Malfunction detection method of incremental encoder
JP4447875B2 (en) How to measure absolute position
CN108444506A (en) Encoder code disc, absolute value encoder, location acquiring method and system
CN109654988B (en) Electric automobile motor position detection and verification method and system and electric automobile
US10274944B2 (en) Motor control system, control method, encoder, and motor controller
CN110806225B (en) System and method for detecting disconnection position of incremental encoder
CN108981765B (en) Fault-tolerant design method for measuring channel of absolute photoelectric encoder
US9103883B2 (en) Method and evaluation device for checking plausibility of an incremental counter
CN208171299U (en) Encoder code disc, absolute value encoder and position acquisition system
CN1678914A (en) Devices for determining the number of revolutions of rotating machine parts by means of redundant sensors and analysis circuits
US20230327522A1 (en) Method for fault processing of hall position sensor in brushless direct current motor
JP2004144667A (en) Anomaly detection device for location information
CN110132327B (en) Photoelectric encoder
US7046172B2 (en) Dual optical angular encoder
CN115326117A (en) Method, device and equipment for correcting abnormal encoder position value and storage medium
CN113127273B (en) Singlechip detection circuit and corresponding detection method
US20230003853A1 (en) Device and method for generating test data for testing a distance determination in an optical time-of-flight measurement
JP3171485B2 (en) Creating a high-resolution absolute signal
CN108827353B (en) Pseudo-random code and increment code synchronization method
CN113848345B (en) Main pump rotating speed signal processing method and system based on digital logic hardware circuit
Anwar et al. Decoder design for a new single error correcting/double error detecting code
US8224882B2 (en) Industrial controller
CN106996799B (en) Fine tuning encoder, system and recognition methods for instrument panel
CN115752505A (en) Method and device for safely acquiring number of teeth of coding odometer

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
CP01 Change in the name or title of a patent holder
CP01 Change in the name or title of a patent holder

Address after: Room 201, building 4, courtyard 8, Dongbeiwang West Road, Haidian District, Beijing

Patentee after: Beijing Yunji Technology Co.,Ltd.

Address before: Room 201, building 4, courtyard 8, Dongbeiwang West Road, Haidian District, Beijing

Patentee before: BEIJING YUNJI TECHNOLOGY Co.,Ltd.