A high-precision position comparison signal output method, device and fly-shot system
The integration of MCU and FPGA in a flyback system for position comparison signal output addresses signal lag and resource inefficiencies, enabling high-precision, real-time photography.
Patent Information
- Application Number
- CN202211710146.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-29
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2042-12-29
AI Technical Summary
In the prior art, the output of the position comparison signal has a lag, resulting in blurred or incorrect position of the captured photos, which cannot meet the high-precision requirements, and also occupies a large number of microcontroller units and field programmable gate array resources.
The actual position of the motor is obtained through polling by the microcontroller unit module, the delay time is calculated and the delay control signal is sent to the field programmable gate array module. The field programmable gate array module outputs the pulse signal after delay, and combines the signal loop detection circuit to adjust the delay time to achieve high-precision position comparison signal output.
It realizes high-precision position comparison signal output, meets real-time requirements, and does not occupy too much microcontroller unit and field programmable gate array resources, improving the clarity of photos.
Smart Images

Figure CN116017130B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of flying shooting technology, and in particular, to a method and device for outputting a position comparison signal with high precision and a flying shooting system. Background Art
[0002] Flying shooting is mostly used to trigger a light source controller and an industrial camera to capture pictures during the high-speed operation of a motor. This application has certain requirements for the accuracy of the output of the position comparison signal. Because the low accuracy of the output of the position comparison signal will result in blurred pictures or incorrect shooting positions, which cannot meet the application requirements.
[0003] A common method for outputting a position comparison signal is to directly output the position comparison signal by a main microcontroller unit (MCU) chip. The main MCU polls to obtain the current actual position information at a fixed period (usually 62.5 μs), compares the actual position with the user-set position. Once it detects that the actual position is greater than or equal to the user-set position, it outputs a pulse signal to trigger the light source controller and the industrial camera. This method has a simple program and is easy to implement, and only occupies a small amount of MCU resources, but there is a lag in the output of the pulse signal. The reason for the lag is that when the actual position reaches the user-set position, the MCU cannot immediately obtain the actual position and must wait until the next polling period to obtain the actual position information and then output the pulse signal, resulting in a lag.
[0004] Another common method for outputting a position comparison signal is to directly output the position comparison signal by a field-programmable gate array (FPGA) chip. The FPGA obtains the current actual position information in real time (applicable to an incremental encoder), compares the actual position with the user-set position. Once it detects that the actual position is greater than or equal to the user-set position, it outputs a pulse signal to trigger the light source controller and the industrial camera. This method has good real-time performance and high accuracy in the output of the pulse signal, but it occupies more FPGA resources because the FPGA calculates the current actual position at all times, compares it with the user-set position at the same time, and outputs a pulse signal according to the comparison result, occupying more FPGA resources. Summary of the Invention
[0005] The present invention provides a method and device for outputting a position comparison signal with high precision and a flying shooting system, so as to achieve the output of a position comparison signal with high precision, meet the real-time requirements of general applications, and not occupy too many resources of the microcontroller unit module and the field-programmable gate array module.
[0006] According to one aspect of the present invention, a method for outputting a high-precision position comparison signal is provided, which is characterized in that it is executed by a high-precision position comparison signal output device. The high-precision position comparison signal output device includes a field programmable gate array module and a microcontroller unit module. The method includes:
[0007] The microcontroller unit module polls to obtain the actual position of the motor within the current cycle at a preset period;
[0008] The microcontroller unit module calculates the actual position of the motor to be obtained in the next polling cycle according to the actual position of the motor within the current cycle and the actual speed of the motor;
[0009] The microcontroller unit module compares the actual position of the motor to be obtained in the next polling cycle with a preset position. If the preset position is less than the actual position of the motor to be obtained in the next polling cycle, it calculates the delay time according to the preset position, the actual position of the motor within the current cycle, and the actual speed of the motor, and sends a delay control signal to the field programmable gate array module;
[0010] After receiving the delay control signal, the field programmable gate array module delays according to the delay time, and outputs a pulse signal to trigger the photographing module after the delay ends.
[0011] Optionally, before the microcontroller unit module polls to obtain the actual position of the motor within the current cycle at a preset period, it further includes:
[0012] The field programmable gate array module controls the encoder module to sample the current position of the motor; wherein, the sampling signal is a differential signal;
[0013] The field programmable gate array module controls the encoder module to convert the differential signal into a TTL level signal and transmit it to the field programmable gate array module;
[0014] The field programmable gate array module calculates the current position information of the motor according to the TTL level signal and transmits it to the microcontroller unit module.
[0015] Optionally, before the microcontroller unit module calculates the actual position of the motor to be obtained in the next polling cycle according to the actual position of the motor within the current cycle and the actual speed of the motor, it further includes:
[0016] The microcontroller unit module calculates the actual speed of the motor according to the actual position of the motor within the current cycle, the actual position of the motor collected last time, and the preset period.
[0017] Optionally, the photographing module includes a camera and a light source controller; after receiving the delay control signal, the field programmable gate array module delays according to the delay time, and outputting a pulse signal to trigger the photographing module includes:
[0018] After receiving the delay control signal, the field programmable gate array module delays according to the delay time;
[0019] After the delay ends, the field programmable gate array module outputs a pulse signal to the light source controller and the camera, triggering the camera to take a picture. At the same time, it triggers the light source controller to illuminate when the camera takes a picture, and controls the light source controller to stop illuminating after the camera finishes taking pictures.
[0020] Optionally, after the field programmable gate array module outputs a pulse signal to the light source controller and the camera after the delay ends, triggering the camera to take a picture, and at the same time triggering the light source controller to illuminate when the camera takes a picture, and controlling the light source controller to stop illuminating after the camera finishes taking pictures, it further includes:
[0021] Adjust the delay time according to the clarity of the photo taken by the camera.
[0022] According to another aspect of the present invention, there is provided a high-precision position comparison signal output device, which is characterized by including an encoder module, a micro control unit module and a field programmable gate array module:
[0023] The encoder module is connected to the field programmable gate array module. The encoder module is used to detect the current position of the motor and output the motor position signal to the field programmable gate array module;
[0024] The micro control unit module is connected to the field programmable gate array module. The micro control unit module is used to poll and obtain the actual position of the motor within the current period at a preset period; and calculate the actual position of the motor to be obtained in the next polling period according to the actual position and the actual speed of the motor within the current period; it is also used to compare the actual position of the motor to be obtained in the next polling period with the preset position. If the preset position is less than the actual position of the motor to be obtained in the next polling period, calculate the delay time according to the preset position, the actual position of the motor within the current period and the actual speed of the motor, and send a delay control signal to the field programmable gate array module;
[0025] The field programmable gate array module is used to delay according to the delay time after receiving the delay control signal, and output a pulse signal to trigger the photographing module after the delay ends.
[0026] Optionally, the encoder module includes:
[0027] An external encoder, which is connected to the power supply and the signal isolation and protection circuit. The external encoder is used to sample the motor position information and convert it into a differential signal for output;
[0028] Power and signal isolation protection circuit. The power and signal isolation protection circuit is connected to an external encoder and a level signal conversion circuit. The power and signal isolation protection circuit is used to electrically isolate the differential signal output by the external encoder from the internal sampling circuit to avoid mutual interference;
[0029] Level signal conversion circuit. The level signal conversion circuit is connected to a field programmable gate array module. The level signal conversion circuit is used to convert the differential signal into a TTL level signal and output it to the field programmable gate array module.
[0030] Optionally, it further includes:
[0031] Position comparison signal shaping circuit. The position comparison signal shaping circuit is connected to the field programmable gate array module. The position comparison signal shaping circuit is used for level conversion and output filtering to reduce noise interference;
[0032] Position comparison signal output isolation circuit. The position comparison signal output isolation circuit is connected to the position comparison signal shaping circuit. The position comparison signal output isolation circuit is used to isolate the internal signal output circuit from an external light source controller and a camera to avoid mutual interference;
[0033] Position comparison signal output interface circuit. The position comparison signal output interface circuit is connected to the position comparison signal output isolation circuit. The position comparison signal output interface circuit is used to connect to an external light source controller and a camera.
[0034] Optionally, the position comparison signal output isolation circuit further includes:
[0035] High-speed optocoupler isolation circuit. The high-speed optocoupler isolation circuit is connected to the position comparison signal shaping circuit and the position comparison signal output interface circuit. The high-speed optocoupler isolation circuit is used to isolate the internal signal output circuit from an external light source controller and a camera to avoid mutual interference;
[0036] Signal loop detection circuit. The signal loop detection circuit is connected to the position comparison signal shaping circuit and the position comparison signal output interface circuit. The signal loop detection circuit is used to judge and fine-tune the delay time according to whether the photo taken by the camera is clear, and to detect the conduction time of the high-speed optocoupler isolation circuit.
[0037] According to another aspect of the present invention, there is provided a flying shooting system, characterized in that it includes a high-precision position comparison signal output device as described in the second aspect of the present invention, and further includes: a photographing module and a motor, the motor is connected to a micro control unit module; the photographing module is connected to the position comparison signal output interface circuit, and the photographing module further includes a light source controller and a camera;
[0038] A light source controller, which is used to turn on the light while the camera takes pictures and turn off the light after the camera finishes taking pictures;
[0039] A camera, which is used to take pictures at a preset position.
[0040] The technical solution of the embodiment of the present invention is to poll the micro control unit module to obtain the actual position of the motor in the current cycle, calculate the actual position of the motor obtained in the next polling cycle, judge whether the actual position of the motor in the current cycle will reach the preset position in this cycle, calculate the delay time, send a delay control signal to the field programmable gate array module, and the field programmable gate array module performs the delay and immediately outputs a pulse signal to trigger the camera module to take pictures at the preset position; The micro control unit module and the field programmable gate array module cooperate with each other. The field programmable gate array module outputs a pulse signal in real time, and there will be no signal lag resulting in insufficient accuracy. It can not only realize the output of high-precision position comparison signals, meet the real-time requirements of general applications, but also does not occupy too many resources of the micro control unit module and the field programmable gate array module.
[0041] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present invention, nor is it used to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. Description of the Drawings
[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0043] Figure 1 It is a flowchart of a method for outputting a high-precision position comparison signal provided by an embodiment of the present invention;
[0044] Figure 2 It is a flowchart of another method for outputting a high-precision position comparison signal provided by an embodiment of the present invention;
[0045] Figure 3 It is a flowchart of yet another method for outputting a high-precision position comparison signal provided by an embodiment of the present invention;
[0046] Figure 4 It is a structural schematic diagram of a device for outputting a high-precision position comparison signal provided by an embodiment of the present invention;
[0047] Figure 5 It is a structural schematic diagram of another device for outputting a high-precision position comparison signal provided by an embodiment of the present invention;
[0048] Figure 6 It is a schematic structural diagram of a flying shooting system provided by an embodiment of the present invention. Specific embodiments
[0049] In order to enable those skilled in the art to better understand the solution of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0050] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily need to be used to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device including a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0051] An embodiment of the present invention provides a method for outputting a high-precision position comparison signal, which can be executed by a high-precision position comparison signal output device and is applicable to capturing pictures during the high-speed operation of a motor. The high-precision position comparison signal output device includes a field programmable gate array module and a micro control unit module. The high-precision position comparison signal output device can be implemented in the form of hardware and / or software, and the high-precision position comparison signal output device can be integrated in a processor. Figure 1 It is a flowchart of a method for outputting a high-precision position comparison signal provided by an embodiment of the present invention. Refer to Figure 1 , and the method includes:
[0052] S101. The micro control unit module polls and obtains the actual position of the motor within the current period at a preset period.
[0053] Specifically, the preset period is jointly determined by the performance of the micro control unit module itself and the motor control performance. Generally, the higher the performance of the micro control unit module, the shorter the period time can be, and the stronger the motor control performance. Polling means that the micro control unit module sends an inquiry to the field programmable gate array module regularly according to the preset period to obtain and update the actual position of the motor within the current period.
[0054] S102. The microcontroller unit module calculates the actual position of the motor to be obtained in the next polling cycle according to the actual position and the actual speed of the motor in the current cycle.
[0055] Exemplarily, if the actual position of the motor in the current cycle is α and the actual speed of the motor is β, the actual position γ of the motor to be obtained in the next polling cycle can be calculated as γ = α + β × preset cycle. When the motor is in a uniform motion state, the accuracy of the output signal of this method is relatively high. However, when the motor is in an accelerating or decelerating motion state, the accuracy of the output signal will decrease because the actual speed β of the motor is constantly changing in the accelerating and decelerating states.
[0056] S103. The microcontroller unit module compares the actual position of the motor to be obtained in the next polling cycle with the preset position. If the preset position is less than the actual position of the motor to be obtained in the next polling cycle, it calculates the delay time according to the preset position, the actual position of the motor in the current cycle, and the actual speed of the motor, and sends a delay control signal to the field programmable gate array module.
[0057] Specifically, the preset position is the position where the motor needs to be photographed, and the preset position can be set according to the photographing requirements. The microcontroller unit module compares the actual position of the motor to be obtained in the next polling cycle with the preset position. If the preset position is less than the actual position of the motor to be obtained in the next polling cycle, it indicates that the actual position of the motor will reach the preset position in the current cycle. The difference δ between the two is calculated according to the preset position and the actual position of the motor in the current cycle. Combining the actual speed of the motor, the delay time ε = δ / β can be calculated, indicating that starting from the moment when it is detected that the preset position is less than the actual position γ of the motor to be obtained in the next polling cycle, after the delay time ε, the actual position of the motor in the current cycle will reach the preset position. After calculating the delay time, the microcontroller unit module sends a delay control signal to the field programmable gate array module to notify the field programmable gate array module to start delaying.
[0058] S104. After receiving the delay control signal, the field programmable gate array module delays according to the delay time and outputs a pulse signal to trigger the photographing module after the delay ends.
[0059] Specifically, after receiving the delay control signal, the field programmable gate array module delays according to the delay time ε, and immediately outputs a pulse signal to the photographing module after the delay ends to trigger the photographing module to take a photograph at the preset position.
[0060] In the technical solution of this embodiment, the microcontroller unit module polls to obtain the actual position of the motor in the current cycle, calculates the actual position of the motor to be obtained in the next polling cycle, determines whether the actual position of the motor in the current cycle will reach the preset position in this cycle, calculates the delay time, and sends a delay control signal to the field programmable gate array module. The field programmable gate array module performs the delay and immediately outputs a pulse signal to trigger the camera module to take a picture at the preset position; the microcontroller unit module and the field programmable gate array module cooperate together. The field programmable gate array module outputs a pulse signal in real time, and signal lag will not occur resulting in insufficient accuracy. It can not only achieve high-precision position comparison signal output and meet the real-time requirements of general applications; and in this solution, the field programmable gate array module is selected to output the pulse signal instead of the microcontroller unit module because if the microcontroller unit module outputs the pulse signal, at least one timer peripheral needs to be added, and at the same time, a corresponding interrupt service function needs to be added to implement the pulse output function, which occupies more resources of the microcontroller unit module. On the contrary, when the field programmable gate array module is selected to output the pulse signal, for the field programmable gate array module, only one output pulse signal needs to be added and it will not occupy much resources, avoiding occupying more resources of the microcontroller unit module and the field programmable gate array module.
[0061] Figure 2 It is a flowchart of another method for outputting a high-precision position comparison signal provided by an embodiment of the present invention. Optionally, refer to Figure 2 , and the method includes:
[0062] S201. The field programmable gate array module controls the encoder module to sample the current position of the motor; wherein, the sampling signal is a differential signal.
[0063] Specifically, the encoder module samples the current position of the motor and converts the sampling information into a differential signal for output.
[0064] S202. The field programmable gate array module controls the encoder module to convert the differential signal into a TTL level signal and transmits it to the field programmable gate array module.
[0065] Specifically, the voltage range of the differential signal output by the encoder module is [±3V, ±6V], which cannot be accepted and processed by the field programmable gate array module. Therefore, the encoder module needs to convert the differential signal into a TTL level signal and then transmit it to the field programmable gate array module for processing.
[0066] S203. The field programmable gate array module calculates the current position information of the motor according to the TTL level signal and transmits it to the microcontroller unit module.
[0067] Specifically, the field programmable gate array module analyzes and calculates the current position information of the motor based on the TTL level signal, and transmits it to the micro control unit module in real time.
[0068] S204. The micro control unit module polls to obtain the actual position of the motor within the current period at a preset period.
[0069] S205. The micro control unit module calculates the actual speed of the motor based on the actual position of the motor within the current period, the actual position of the motor collected last time, and the preset period.
[0070] Specifically, the actual position of the motor collected last time is the actual position of the motor collected in the previous polling period. The actual speed of the motor can be obtained by dividing the difference between the actual position of the motor within the current period and the actual position of the motor collected last time by the preset period.
[0071] S206. The micro control unit module calculates the actual position of the motor to be obtained in the next polling period based on the actual position of the motor within the current period and the actual speed of the motor.
[0072] S207. The micro control unit module compares the actual position of the motor to be obtained in the next polling period with the preset position. If the preset position is less than the actual position of the motor to be obtained in the next polling period, it calculates the delay time based on the preset position, the actual position of the motor within the current period, and the actual speed of the motor, and sends a delay control signal to the field programmable gate array module.
[0073] S208. After receiving the delay control signal, the field programmable gate array module delays according to the delay time, and outputs a pulse signal to trigger the photographing module after the delay ends.
[0074] The technical solution of this embodiment polls to obtain the actual position of the motor within the current period through the micro control unit module, calculates the actual position of the motor to be obtained in the next polling period, determines whether the actual position of the motor within the current period will reach the preset position within this period, calculates the delay time, sends a delay control signal to the field programmable gate array module, and the field programmable gate array module delays and immediately outputs a pulse signal to trigger the camera module to take a photo at the preset position; through the joint cooperation of the micro control unit module and the field programmable gate array module, the field programmable gate array module outputs a pulse signal in real time, and signal lag will not occur, resulting in insufficient accuracy. It can not only achieve high-precision position comparison signal output, meet the real-time requirements of general applications, but also will not occupy too many resources of the micro control unit module and the field programmable gate array module.
[0075] Figure 3It is a flowchart of another high-precision position comparison signal output method provided by an embodiment of the present invention. Optionally, the photographing module includes a camera and a light source controller. Refer to Figure 3 The method includes:
[0076] S301. The microcontroller unit module polls and obtains the actual position of the motor within the current period at a preset period.
[0077] S302. The microcontroller unit module calculates the actual position of the motor to be obtained in the next polling period according to the actual position of the motor and the actual speed of the motor within the current period.
[0078] S303. The microcontroller unit module compares the actual position of the motor to be obtained in the next polling period with a preset position. If the preset position is less than the actual position of the motor to be obtained in the next polling period, it calculates a delay time according to the preset position, the actual position of the motor within the current period, and the actual speed of the motor, and sends a delay control signal to the field programmable gate array module.
[0079] S304. After receiving the delay control signal, the field programmable gate array module delays according to the delay time.
[0080] S305. After the delay ends, the field programmable gate array module outputs a pulse signal to the light source controller and the camera, triggers the camera to take a picture, and at the same time triggers the light source controller to turn on the light when the camera takes a picture, and controls the light source controller to stop turning on the light after the camera finishes taking a picture.
[0081] Specifically, the light source controller includes an LED lamp. The light source controller is used to control the turning on and off of the LED lamp to turn on the light when the camera takes a picture, making the photo taken by the camera clearer. After the delay ends, the field programmable gate array module outputs a pulse signal to the light source controller and the camera, triggers the camera to take a picture at the preset position, and at the same time triggers the light source controller to control the LED lamp to turn on and turn on the light when the camera takes a picture, and after the camera finishes taking a picture, the light source controller controls the LED lamp to turn off and stop turning on the light.
[0082] S306. Adjust the delay time according to the clarity of the photo taken by the camera.
[0083] Specifically, the high-precision position comparison signal output device further includes a signal loop detection circuit. Through the signal loop detection circuit and the corresponding debugging program, the delay time can be adjusted according to the clarity of the photo taken by the camera, that is, simply increase or decrease the delay time ε, further improving the accuracy of the position comparison signal output.
[0084] In the technical solution of this embodiment, the microcontroller unit module polls to obtain the actual position of the motor within the current cycle, calculates the actual position of the motor to be obtained in the next polling cycle, determines whether the actual position of the motor in the current cycle will reach the preset position within this cycle, calculates the delay time, and sends a delay control signal to the field programmable gate array module. The field programmable gate array module performs the delay and immediately outputs a pulse signal to trigger the camera module to take a picture at the preset position. The microcontroller unit module and the field programmable gate array module cooperate together. The field programmable gate array module outputs a pulse signal in real time, and signal lag will not occur resulting in insufficient accuracy. It can not only achieve high-precision position comparison signal output, meet the real-time requirements of general applications, but also will not occupy too many resources of the microcontroller unit module and the field programmable gate array module. In addition, a signal loop detection circuit is set to adjust the delay time, further improving the output accuracy of the position comparison signal and making the photos taken by the camera clearer.
[0085] An embodiment of the present invention also provides a high-precision position comparison signal output device for implementing the high-precision position comparison signal output method described in any of the above embodiments. Figure 4 is a structural schematic diagram of a high-precision position comparison signal output device provided by an embodiment of the present invention. Refer to Figure 4 , this device includes an encoder module 1, a microcontroller unit module 2, and a field programmable gate array module 3:
[0086] The encoder module 1 is connected to the field programmable gate array module 3. The encoder module 1 is used to detect the current position of the motor and output the motor position signal to the field programmable gate array module 3.
[0087] The microcontroller unit module 2 is connected to the field programmable gate array module 3. The microcontroller unit module 2 is used to poll to obtain the actual position of the motor within the current cycle at a preset period; and calculate the actual position of the motor to be obtained in the next polling cycle according to the actual position of the motor in the current cycle and the actual speed of the motor; it is also used to compare the actual position of the motor to be obtained in the next polling cycle with the preset position. If the preset position is less than the actual position of the motor to be obtained in the next polling cycle, calculate the delay time according to the preset position, the actual position of the motor in the current cycle, and the actual speed of the motor, and send a delay control signal to the field programmable gate array module 3.
[0088] The field programmable gate array module 3 is used to perform a delay according to the delay time after receiving the delay control signal, and output a pulse signal to trigger the photographing module after the delay ends.
[0089] Specifically, the encoder module 1 is used to detect the current position of the motor and output the motor position signal to the field programmable gate array module 3. The field programmable gate array module 3 analyzes and calculates the current position information of the motor based on the motor position signal and transmits it to the micro control unit module 2. The micro control unit module 2 is used to poll the field programmable gate array module 3 at a preset period to obtain the actual position of the motor within the current period. The micro control unit module 2 is also used to calculate the actual speed of the motor, and based on the actual position of the motor and the actual speed of the motor within the current period, calculate the actual position of the motor to be obtained in the next polling period. The micro control unit module 2 is further used to compare the actual position of the motor to be obtained in the next polling period with a preset position. If the preset position is less than the actual position of the motor to be obtained in the next polling period, it indicates that the actual position of the motor within the current period will reach the preset position within this period; the micro control unit module 2 calculates the delay time based on the preset position, the actual position of the motor within the current period, and the actual speed of the motor, and sends a delay control signal to the field programmable gate array module 3. The field programmable gate array module 3 is used to delay according to the delay time after receiving the delay control signal, and immediately output a pulse signal to trigger the photographing module to take a photo at the preset position after the delay ends. The micro control unit module 2 communicates with the field programmable gate array module 3 in a parallel bus manner, with a frequency of 100 MHz and a nanosecond-level delay, which has almost no impact on general camera photographing and can be ignored.
[0090] The technical solution of this embodiment, through the cooperation of the micro control unit module and the field programmable gate array module, the micro control unit module is used for calculation and motor control, and the field programmable gate array module is used for processing the output signal of the encoder module and real-time output of pulse signals, which can not only achieve high-precision position comparison signal output, meet the real-time requirements of general applications, but also does not occupy too many resources of the micro control unit module and the field programmable gate array module.
[0091] Figure 5 It is a schematic structural diagram of another high-precision position comparison signal output device provided by an embodiment of the present invention. Optionally, refer to Figure 5 , the encoder module 1 includes:
[0092] An external encoder 11, the external encoder 11 is connected to a power supply and signal isolation protection circuit 12, and the external encoder 11 is used to sample the motor position information and convert it into a differential signal for output;
[0093] A power supply and signal isolation protection circuit 12, the power supply and signal isolation protection circuit 12 is connected to the external encoder 11 and a level signal conversion circuit 13, and the power supply and signal isolation protection circuit 12 is used to electrically isolate the differential signal output by the external encoder 11 from the internal sampling circuit to avoid mutual interference;
[0094] The level signal conversion circuit 13 is connected to the field programmable gate array module 3. The level signal conversion circuit 13 is used to convert differential signals into TTL level signals and output them to the field programmable gate array module 3.
[0095] Specifically, considering the two factors of the motor operating speed and the resolution of the encoder module 1, the circuit of the encoder module 1 is required to have a rate not lower than 10 Mbps in order to meet the requirements of the vast majority of application scenarios. If it is lower than 10 Mbps, then in the scenario where the motor runs at high speed or the resolution of the encoder module 1 is high, the encoder module 1 may not be able to correctly obtain the position information, resulting in failures.
[0096] Continue to refer to Figure 5 The high-precision position comparison signal output device further includes:
[0097] The position comparison signal shaping circuit 4 is connected to the field programmable gate array module 3. The position comparison signal shaping circuit 4 is used for level conversion and output filtering to reduce noise interference;
[0098] The position comparison signal output isolation circuit 5 is connected to the position comparison signal shaping circuit 4. The position comparison signal output isolation circuit 5 is used to isolate the internal signal output circuit from the external light source controller and the camera to avoid mutual interference;
[0099] The position comparison signal output interface circuit 6 is connected to the position comparison signal output isolation circuit 5. The position comparison signal output interface circuit 6 is used to connect to the external light source controller and the camera.
[0100] Specifically, the position comparison signal shaping circuit 4 is used for level conversion. The output level of the field programmable gate array module 3 is generally 3.3V, which is converted to 5V through the position comparison signal shaping circuit 4 to adapt to the power supply requirements of peripheral electrical appliances. Moreover, the position comparison signal shaping circuit 4 is also used to add output RC filtering to reduce noise interference. The position comparison signal output isolation circuit 5 further includes a high-speed optocoupler isolation circuit 51 and a signal loopback detection circuit 52. The high-speed optocoupler isolation circuit 51 is connected to the position comparison signal shaping circuit 4 and the position comparison signal output interface circuit 6. The high-speed optocoupler isolation circuit 51 is used to isolate the internal signal output circuit from the external light source controller and the camera to avoid mutual interference. The signal loopback detection circuit 52 is connected to the position comparison signal shaping circuit 4 and the position comparison signal output interface circuit 6. The signal loopback detection circuit 52 is used to judge and fine-tune the delay time according to whether the photo taken by the camera is clear, and to detect the conduction time of the high-speed optocoupler isolation circuit 51. Among them, the signal output optocoupler isolation circuit 5 requires a rate of not less than 1Mbps, and the conduction delay consistency of the optocoupler should be good, so that the optocoupler delay time can be subtracted in advance in the program to obtain higher accuracy. The good conduction delay consistency of the optocoupler means that if the high-speed optocoupler used in the signal output optocoupler isolation circuit 5 has a fixed delay of 0.8us from receiving the signal at the primary side to outputting the signal at the secondary side, then when the field programmable gate array module 3 receives the delay time ε of the micro control unit module 2, it immediately delays (ε - 0.8)us and then outputs a pulse signal to offset the conduction delay of the optocoupler, making the output pulse more accurate; in the production and manufacturing process of each optocoupler, the parameters cannot be exactly the same, and the conduction delays are also different. At this time, the manufacturer needs to try to meet the conduction delay consistency of each optocoupler, fixed at around 0.8us, and the deviation should not be too large. The position comparison signal output interface circuit 6 is used to connect to the external light source controller and the camera. The position comparison signal output interface circuit 6 is a standard DB15 connector interface, which is convenient for external wiring. When in use, only two wires need to be welded to connect to the external light source and the camera.
[0101] An embodiment of the present invention also provides a flying shooting system. Figure 6 It is a schematic structural diagram of a flying shooting system provided by an embodiment of the present invention. Refer to Figure 6 The device includes the high-precision position comparison signal output device described in any of the above embodiments, and further includes: a photographing module 7 and a motor 8. The motor 8 is connected to the micro control unit module 2; the photographing module 7 is connected to the position comparison signal output interface circuit 6. The photographing module 7 further includes a light source controller 71 and a camera 72;
[0102] The light source controller 71 is used to turn on the light while the camera 72 takes a photo and turn off the light after the camera 72 finishes taking a photo.
[0103] A camera 72 for taking pictures at a preset position.
[0104] Specifically, the light source controller 71 includes an LED lamp. The light source controller 71 is used to control the turning on and off of the LED lamp to provide lighting when the camera 72 takes pictures, making the pictures taken by the camera 72 clearer. When the camera 72 takes pictures at the preset position, the light source controller 71 controls the LED lamp to turn on, provides lighting when the camera 72 takes pictures, and controls the LED lamp to turn off to stop lighting after the camera 72 finishes taking pictures.
[0105] It should be understood that various forms of the processes shown above can be used, steps can be reordered, added, or deleted. For example, the steps described in the present invention can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved, and no limitation is made herein.
[0106] The above specific embodiments do not constitute a limitation on the protection scope of the present invention. Those skilled in the art should understand that various modifications, combinations, sub - combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention shall be included within the protection scope of the present invention.
Claims
1. A method for outputting a high-precision position comparison signal, characterized in that, Performed by a high-precision position comparison signal output device, the high-precision position comparison signal output device includes a field programmable gate array module and a micro control unit module, and the method includes: The micro control unit module polls to obtain the actual position of the motor in the current period at a preset period; The micro control unit module calculates the actual speed of the motor according to the actual position of the motor in the current period, the actual position of the motor collected last time, and the preset period; The micro control unit module calculates the actual position of the motor to be obtained in the next polling period according to the actual position of the motor and the actual speed of the motor in the current period; The micro control unit module compares the actual position of the motor to be obtained in the next polling period with a preset position to determine whether the actual position of the motor in the current period will reach the preset position in this period. If the preset position is less than the actual position of the motor to be obtained in the next polling period, it calculates a delay time according to the preset position, the actual position of the motor in the current period, and the actual speed of the motor, and sends a delay control signal to the field programmable gate array module; After receiving the delay control signal, the field programmable gate array module performs a delay according to the delay time, and outputs a pulse signal to trigger the photographing module after the delay ends, so as to avoid occupying the resources of the micro control unit module.
2. The method according to claim 1, characterized in that Before the micro control unit module polls to obtain the actual position of the motor in the current period at a preset period, it further includes: The field programmable gate array module controls the encoder module to sample the current position of the motor; wherein, the sampling signal is a differential signal; The field programmable gate array module controls the encoder module to convert the differential signal into a TTL level signal and transmit it to the field programmable gate array module; The field programmable gate array module calculates the current position information of the motor according to the TTL level signal and transmits it to the micro control unit module.
3. The method according to claim 1, characterized in that The photographing module includes a camera and a light source controller; after receiving the delay control signal, the field programmable gate array module performs a delay according to the delay time, and outputting a pulse signal to trigger the photographing module after the delay ends includes: After receiving the delay control signal, the field programmable gate array module performs a delay according to the delay time; After the delay ends, the field programmable gate array module outputs a pulse signal to the light source controller and the camera, triggers the camera to take a picture, and at the same time triggers the light source controller to turn on the light when the camera takes a picture, and controls the light source controller to stop turning on the light after the camera finishes taking pictures.
4. The method according to claim 3, characterized in that, After the field programmable gate array module outputs a pulse signal to the light source controller and the camera after the delay ends, triggers the camera to take a picture, and at the same time triggers the light source controller to turn on the light when the camera takes a picture, and controls the light source controller to stop turning on the light after the camera finishes taking pictures, it further includes: Adjust the delay time according to the clarity of the photo taken by the camera.
5. A high-precision position comparison signal output device, characterized in that, It includes an encoder module, a microcontroller unit module, and a field programmable gate array module: The encoder module is connected to the field programmable gate array module. The encoder module is used to detect the current position of the motor and output the motor position signal to the field programmable gate array module; The microcontroller unit module is connected to the field programmable gate array module. The microcontroller unit module is used to poll and obtain the actual position of the motor within the current period at a preset period; Calculate the actual speed of the motor based on the actual position of the motor in the current period, the actual position of the motor collected last time, and the preset period, and calculate the actual position of the motor to be obtained in the next polling period based on the actual position of the motor in the current period and the actual speed of the motor; It is also used to compare the actual position of the motor to be obtained in the next polling period with the preset position to determine whether the actual position of the motor in the current period will reach the preset position within this period. If the preset position is less than the actual position of the motor to be obtained in the next polling period, calculate the delay time based on the preset position, the actual position of the motor in the current period, and the actual speed of the motor, and send a delay control signal to the field programmable gate array module; The field programmable gate array module is used to perform a delay according to the delay time after receiving the delay control signal, and output a pulse signal to trigger the photographing module after the delay ends, so as to avoid occupying the resources of the microcontroller unit module.
6. The device according to claim 5, characterized in that, The encoder module includes: An external encoder, which is connected to the power supply and the signal isolation and protection circuit. The external encoder is used to sample the motor position information and convert it into a differential signal for output; The power supply and signal isolation and protection circuit, which is connected to the external encoder and the level signal conversion circuit. The power supply and signal isolation and protection circuit is used to electrically isolate the differential signal output by the external encoder from the internal sampling circuit to avoid mutual interference; The level signal conversion circuit, which is connected to the field programmable gate array module. The level signal conversion circuit is used to convert the differential signal into a TTL level signal for output to the field programmable gate array module.
7. The device according to claim 5, characterized in that, It also includes: The position comparison signal shaping circuit, which is connected to the field programmable gate array module. The position comparison signal shaping circuit is used for level conversion and output filtering to reduce noise interference; The position comparison signal output isolation circuit, which is connected to the position comparison signal shaping circuit. The position comparison signal output isolation circuit is used to isolate the internal signal output circuit from the external light source controller and the camera to avoid mutual interference; The position comparison signal output interface circuit, which is connected to the position comparison signal output isolation circuit. The position comparison signal output interface circuit is used to connect to the external light source controller and the camera.
8. The device according to claim 7, characterized in that, The position comparison signal output isolation circuit further includes: High-speed optocoupler isolation circuit, the high-speed optocoupler isolation circuit is connected to the position comparison signal shaping circuit and the position comparison signal output interface circuit, and the high-speed optocoupler isolation circuit is used to isolate the internal signal output circuit from the external light source controller and the camera to avoid mutual interference; Signal loop detection circuit, the signal loop detection circuit is connected to the position comparison signal shaping circuit and the position comparison signal output interface circuit, and the signal loop detection circuit is used to judge and fine-tune the delay time according to whether the photo taken by the camera is clear, and to detect the conduction time of the high-speed optocoupler isolation circuit.
9. A flying shooting system, characterized in that, It includes the high-precision position comparison signal output device according to any one of claims 5-8, and further includes: a photographing module and a motor, the motor is connected to the micro control unit module; the photographing module is connected to the position comparison signal output interface circuit, and the photographing module further includes a light source controller and a camera; The light source controller is used to turn on the light while the camera takes a photo and turn off the light after the camera finishes taking a photo; The camera is used to take a photo at a preset position.
Citation Information
Patent Citations
Material sorting control device and method
CN113245240A