Moving part position detection method, device, equipment, medium and program product
The image sensor monitors the preset identification pattern on the moving parts, replacing the traditional photoelectric switch, solves the problem of connection complexity in limit control detection, and realizes more flexible and easy-to-use moving parts control, ensuring the accuracy of motor movement. Sex and safety.
Patent Information
- Application Number
- CN202411258083.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-09
- Publication Date
- 2025-01-07
AI Technical Summary
In the prior art, the connection is complex in the position detection process of moving parts limit control, resulting in complex equipment installation, debugging and maintenance.
An image sensor is used to monitor the preset identification pattern of the surface of the moving part, and by comparing the imaging position with multiple preset determination positions, the actual position of the moving part is determined, and instead of traditional photoelectric switches, wireless power supply and signal transmission are realized.
It reduces the workload of equipment installation and commissioning, improves the flexibility and ease of use of moving parts, reduces the connection complexity during limit control detection, and ensures precise control and safety of motor movement.
Smart Images

Figure CN119273751A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of position detection, and in particular to a method, device, equipment, medium and program product for detecting the position of a moving part. Background Art
[0002] In the current industrial control and automatic control fields, most of the detection methods for limit control of moving parts are to detect motor movement by using photoelectric switches. For example, in linear motion, whether it is a screw, belt, chain drive or linear motor, at least three photoelectric switches need to be configured in motion detection, one of which is used as a reference origin limit point, and two are used as left and right boundary limit points. In actual use, two photoelectric switches for approaching and exceeding the boundary will be added on both sides of the boundary limit photoelectric switch at the boundary limit point, which are used for detection of approaching and exceeding the left and right boundary limits. Each photoelectric switch requires three wires, namely the power line, the ground line and the detection signal output line. Therefore, in the simplest linear motion control device, at least nine wires need to be configured at the left and right boundary limit points, which increases the complexity of equipment modeling, installation, debugging, layout and wiring operations in industrial control equipment.
[0003] Therefore, how to solve the wiring complexity in the position detection process of the limit control of the moving parts is a problem that needs to be solved urgently. Summary of the invention
[0004] The main purpose of this application is to provide a method, device, equipment, medium and program product for detecting the position of a moving part, aiming to solve the technical problem of how to solve the complexity of wiring in the process of position detection of limit control of a moving part.
[0005] To achieve the above-mentioned purpose, the present application proposes a method for detecting the position of a moving part, which is applied to a position detection system. The position detection system includes a moving part and an image sensor, wherein the moving part is provided with a motor, and a preset identification pattern is provided on the surface of the moving part. The method for detecting the position of the moving part includes:
[0006] The preset identification pattern is monitored by the image sensor to obtain an imaging position of the preset identification pattern on an imaging surface of the image sensor;
[0007] The imaging position is compared with a plurality of preset determination positions one by one, and a preset determination position among the plurality of preset determination positions that is consistent with the imaging position is used as a detection position of the moving component.
[0008] In one embodiment, the method for detecting the position of a moving component further includes:
[0009] For any preset limit point of the moving component, controlling the moving component to move so as to move the preset identification pattern to the preset limit point;
[0010] When the preset identification pattern is at the preset limit point, the position of the preset identification pattern on the imaging surface is recorded to obtain a preset determination position.
[0011] In one embodiment, the moving component is driven by a motor, and the step of using a preset determination position among the plurality of preset determination positions that is consistent with the imaging position as the detection position of the moving component comprises:
[0012] Obtaining a limit signal corresponding to the detection position;
[0013] In the case where the limit signal is a speed regulation signal, outputting the speed regulation signal to adjust the speed and / or rotation direction of the motor through the speed regulation signal;
[0014] In the case where the limit signal is a stop signal, the stop signal is output to control the motor to stop rotating through the stop signal.
[0015] In one embodiment, the image sensor is configured with a wireless charging unit and a wireless transmission unit, the image sensor is powered by a wireless charging coil in the wireless charging unit, and the speed regulation signal or the stop signal is output through a wireless antenna in the wireless transmission unit.
[0016] In one embodiment, the step of comparing the imaging position with a plurality of preset determination positions one by one comprises:
[0017] For any preset determination position, the imaging position is compared with the preset determination position to obtain a matching degree between the imaging position and the preset determination position;
[0018] When the matching degree is greater than a preset matching degree, it is determined that the preset determination position is consistent with the imaging position.
[0019] In one embodiment, the step of comparing the imaging position with the preset determination position to obtain a matching degree between the imaging position and the preset determination position includes:
[0020] Extracting a preset number of first feature points in the imaging position and a preset number of second feature points in the preset determination position;
[0021] Comparing the first feature point and the second feature point to determine the number of feature groups formed by the first feature point and the second feature point that have a matching relationship, wherein the descriptor distance between the first feature point and the second feature point that have a matching relationship is less than a preset distance;
[0022] The degree of matching is determined based on a ratio of the number to the preset number.
[0023] In addition, to achieve the above-mentioned purpose, the present application also proposes a position detection device, which is applied to a position detection system, wherein the position detection system comprises a moving part and an image sensor, and a preset identification pattern is provided on the surface of the moving part. The position detection device comprises:
[0024] A monitoring module, used to monitor the preset identification pattern through the image sensor to obtain an imaging position of the preset identification pattern on an imaging surface of the image sensor;
[0025] The comparison module is used to compare the imaging position with a plurality of preset determination positions one by one, and use the preset determination position consistent with the imaging position among the plurality of preset determination positions as the detection position of the moving part.
[0026] In addition, to achieve the above-mentioned purpose, the present application also proposes an electronic device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the method for detecting the position of a moving part as described above.
[0027] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the method for detecting the position of the moving part as described above are implemented.
[0028] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the method for detecting the position of a moving part as described above are implemented.
[0029] One or more technical solutions proposed in this application have at least the following technical effects:
[0030] The present application first monitors a preset identification pattern through an image sensor to obtain the imaging position of the preset identification pattern on the imaging surface of the image sensor, and uses an image sensor to replace the traditional photoelectric switch. By monitoring the position of the preset identification pattern on the moving part, the traditional photoelectric switch detection method is avoided, because a light-shielding shielding plate that blocks the incident light of the photoelectric switch must be installed on the moving part, which makes it inconvenient to install, debug, disassemble and other operations on the moving part with limited space or shape, thereby improving the flexibility and ease of use of the moving part and reducing the complexity of wiring when detecting the position of the moving part; the imaging position is compared with multiple preset determination positions one by one, and the preset determination position consistent with the imaging position among the multiple preset determination positions is used as the detection position of the moving part, thereby realizing real-time judgment of the position of the moving part, thereby ensuring that the moving part under the control of the motor operates within a predetermined motion range, avoiding the risk of exceeding the boundary limit, and improving the flexibility and safety of motor motion control.
[0031] In summary, the present application monitors the preset identification pattern through the image sensor and accurately compares the imaging position to determine the actual position of the moving part when the imaging position comparison is consistent, avoiding the multiple connecting wires required by traditional photoelectric switches, thereby reducing the workload of equipment installation, debugging and maintenance. On the basis of ensuring the accuracy of detecting the position of the moving part, the complexity of the connection in the detection process of the limit control of the moving part is reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0033] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0034] Figure 1 A schematic diagram of a flow chart provided for the first embodiment of the method for detecting the position of a moving part of the present application;
[0035] Figure 2 A schematic diagram of a preset identification pattern of a method for detecting a position of a moving component provided in Embodiment 1 of the present application;
[0036] Figure 3 A schematic diagram of photoelectric switch detection of a method for detecting the position of a moving part provided in Example 1 of the present application;
[0037] Figure 4A schematic diagram of the photoelectric switch arrangement of the method for detecting the position of a moving part provided in the first embodiment of the present application;
[0038] Figure 5 A schematic diagram of a flow chart provided for the second embodiment of the method for detecting the position of a moving part of the present application;
[0039] Figure 6 A schematic diagram of preset limit points of the method for detecting the position of a moving part provided in the second embodiment of the present application;
[0040] Figure 7 A schematic diagram of a brief flow chart of a method for detecting the position of a moving part provided in the second embodiment of the present application;
[0041] Figure 8 This is a schematic diagram of the module structure of the position detection device according to an embodiment of the present application;
[0042] Fig. 9 Schematic diagram of the device structure of the hardware operating environment involved in the method for detecting the position of a moving part in an embodiment of the present application.
[0043] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0044] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0045] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0046] The main solution of the embodiment of the present application is: to monitor the preset identification pattern through an image sensor to obtain the imaging position of the preset identification pattern on the imaging surface of the image sensor; to compare the imaging position with multiple preset determination positions one by one, and to use the preset determination position among the multiple preset determination positions that is consistent with the imaging position as the detection position of the moving part.
[0047] Since the prior art detects the motor movement by using photoelectric switches. For example, in linear motion, whether it is a screw, belt, chain drive or linear motor, at least three photoelectric switches need to be configured in the motion detection, one of which is used as a reference origin limit point, and two are used as left and right boundary limit points. In actual use, two photoelectric switches approaching and exceeding the boundary will be added on both sides of the boundary limit photoelectric switch at the boundary limit point, which are used for detection of approaching and exceeding the left and right boundary limits, and each photoelectric switch requires three wires, namely a power line, a ground line and a detection signal output line. Therefore, in the simplest linear motion control device, at least nine wires need to be configured at the left and right boundary limit points, which increases the complexity of equipment modeling, installation, debugging, layout and wiring operations in industrial control equipment. Therefore, how to solve the complexity of wiring in the position detection process of the limit control of moving parts is a problem that needs to be solved urgently.
[0048] The present application provides a solution, which monitors a preset identification pattern through an image sensor and accurately compares the imaging position to determine the actual position of the moving part when the imaging position comparison is consistent, avoiding the multiple connecting wires required by traditional photoelectric switches, thereby reducing the workload of equipment installation, debugging and maintenance, and reducing the complexity of wiring in the detection process of limit control of the moving part while ensuring the accuracy of detecting the position of the moving part.
[0049] It should be noted that the execution subject of this embodiment may be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, etc. The following takes an electronic device as an example to illustrate this embodiment and the following embodiments.
[0050] Based on this, the embodiment of the present application provides a method for detecting the position of a moving part. Figure 1 , Figure 1 This is a flow chart of the first embodiment of the method for detecting the position of a moving component of the present application.
[0051] In this embodiment, the position detection method of the moving component is applied to a position detection system, wherein the position detection system includes a moving component and an image sensor, wherein the moving component is configured with a motor, and a preset identification pattern is provided on the surface of the moving component. The position detection method of the moving component includes steps S10 to S20:
[0052] Step S10, monitoring the preset identification pattern by the image sensor to obtain an imaging position of the preset identification pattern on an imaging surface of the image sensor;
[0053] It should be noted that the image sensor is a monocular camera that can convert optical images into electrical signals. The imaging principle of the monocular camera is based on the convex lens imaging principle. The preset identification pattern refers to a specific pattern that is pre-designed and pasted or printed on the surface of the moving parts (such as: screw, belt, chain, linear motor body) to replace the installation position of the light shielding sheet. Please refer to Figure 2 , which can be a circle C, a rectangle R, or a solid line regular figure S, etc.; the imaging surface refers to the photosensitive area inside the image sensor used to capture the image; the imaging position refers to the specific position of the image formed by the preset identification pattern on the imaging surface.
[0054] In addition, it should be noted that the image sensor is equipped with a wireless charging unit, and the image sensor is powered by a wireless charging coil in the wireless charging unit, wherein the wireless charging coil refers to a coil wound by a conductive material, which can receive an electromagnetic field from a transmitter and generate current through the principle of electromagnetic induction, thereby powering the image sensor. Since the traditional photoelectric switch has wiring complexity and installation difficulty due to wired connection, and there is a problem of being unable to power the device in scenarios where wiring is difficult, the image sensor is wirelessly powered, avoiding the use of physical connection wires, simplifying the installation and maintenance of the device, increasing the application flexibility of the device, and further reducing the wiring complexity in the detection process of the limit control of the moving parts.
[0055] It is understandable that in the traditional photoelectric switch detection method, a light shielding sheet must be installed on the moving part to block the incident light of the photoelectric switch. Figure 3 , and install multiple limit photoelectric switches, that is, at least including the origin photoelectric switch, the left limit switch and the right limit switch, and can also include the right limit switch and the right limit switch on both sides of the right limit switch, or the left limit switch and the left limit switch on both sides of the left limit switch to control the motor movement. Please refer to Figure 4 , which makes it inconvenient to install, debug, disassemble and other operations on moving parts with limited space or shape, so step S10 is performed to replace the traditional shading baffle with the identification pattern, which can avoid the complex setting of installation and connection of the shading baffle, improve the assembly efficiency and ease of use of the moving parts, and reduce the complexity of connection when detecting the position of the moving parts.
[0056] Step S20, comparing the imaging position with a plurality of preset determination positions one by one, and taking a preset determination position among the plurality of preset determination positions that is consistent with the imaging position as a detection position of the moving component.
[0057] It should be noted that the preset judgment position refers to a series of standard position information pre-set according to the requirements of motor motion limit control, and the position information corresponds to a specific limit point of the moving part; the detection position refers to the preset judgment position determined by comparison to match the current imaging position, that is, the limit point corresponding to the actual monitored position of the moving part.
[0058] It can be understood that since there is a risk of exceeding the boundary limit during the movement of the moving part, step S20 is performed to make a real-time judgment on the position of the moving part, thereby ensuring that the moving part under the control of the motor operates within a predetermined range of motion, avoiding the risk of exceeding the boundary limit, and improving the flexibility and safety of the moving part control.
[0059] In a feasible implementation manner, the step of comparing the imaging position with a plurality of preset determination positions one by one in step S20 may include steps S21 to S22:
[0060] Step S21, for any preset determination position, comparing the imaging position with the preset determination position to obtain a matching degree between the imaging position and the preset determination position;
[0061] It should be noted that the matching degree refers to the consistency between the imaging position and the preset determination position, and the consistency degree is a quantitative value.
[0062] In a feasible implementation manner, the step of comparing the imaging position with the preset determination position in step S21 to obtain the matching degree between the imaging position and the preset determination position may include steps S211 to S213:
[0063] Step S211, extracting a preset number of first feature points in the imaging position and a preset number of second feature points in the preset determination position;
[0064] It should be noted that the first feature point refers to a specific image information point extracted from the imaging position, such as an edge point, a corner point or other image feature point; the second feature point refers to a specific image information point extracted from a preset judgment position, such as an edge point, a corner point or other image feature point.
[0065] It is understandable that, since image features are the basis of image recognition and comparison, performing step S211 avoids the computational complexity and error caused by directly comparing the entire image position, thereby simplifying the comparison process and improving the efficiency and accuracy of comparison and recognition.
[0066] Step S212, comparing the first feature point and the second feature point to determine the number of feature groups formed by the first feature point and the second feature point that have a matching relationship, wherein the descriptor distance between the first feature point and the second feature point that have a matching relationship is less than a preset distance;
[0067] It should be noted that the descriptor distance refers to the distance between the feature vectors carried by the feature points extracted by specific algorithms such as SIFT (Scale-invariant feature transform), SURF (Speeded Up Robust Features) or ORB (Oriented Fast and Rotated BRIEF). For example, a 16*16 area is taken around the feature point through the SIFT algorithm, and the area is divided into 16 4*4 sub-areas. For each sub-area, the gradient histogram in 8 directions is calculated, so a 128-dimensional vector, namely the descriptor, is obtained, and the distance between different descriptors is calculated as the descriptor distance.
[0068] It can be understood that since the matching degree between the imaging position and the preset judgment position can be quantified by matching feature points, step S212 is performed to avoid the recognition error caused by the difficulty in quantifying the matching degree, thereby providing an objective and effective matching degree evaluation method, thereby enhancing the accuracy of position comparison.
[0069] Exemplarily, when a first descriptor of a preset number of first feature points and a second descriptor of a preset number of second feature points are extracted through the SIFT algorithm, the distance between each first descriptor and each second descriptor is calculated using the Euclidean distance formula. If the distance is less than the preset distance, it is determined that the first feature point corresponding to the first descriptor matches the second feature point corresponding to the second descriptor.
[0070] Exemplarily, when a first descriptor of a preset number of first feature points and a second descriptor of a preset number of second feature points are extracted through the SIFT algorithm, the distance between any first descriptor and each second descriptor is calculated using the Euclidean distance formula to determine two descriptors among multiple second descriptors that are closest to the first descriptor, as the first neighboring descriptor and the second neighboring descriptor, respectively. If the distance ratio between the first neighboring descriptor and the second neighboring descriptor is less than a preset threshold, it is determined that the descriptor with a smaller distance to the first descriptor among the first neighboring descriptor and the second neighboring descriptor has a matching relationship with the first descriptor.
[0071] Step S213: determining the matching degree based on the ratio of the number to the preset number.
[0072] Exemplarily, when the number of feature groups having matching relationships between the first feature points and the second feature points is 97, and the number of extracted first feature points and the second feature points, i.e. the preset number, is 100, the matching degree between the imaging position and the preset determination position is determined to be 97%.
[0073] In this embodiment, by accurately extracting and comparing key features in the image, noise interference and position errors in the image recognition process are reduced, and the accuracy and stability of the match between the imaging position and the preset judgment position are improved, thereby ensuring the accuracy of the position detection of the moving parts, avoiding the failure of control of the moving parts due to position recognition errors, and improving the performance and reliability of the entire moving part control system.
[0074] Step S22: when the matching degree is greater than a preset matching degree, determining that the preset determination position is consistent with the imaging position.
[0075] It should be noted that the preset matching degree refers to a threshold value preset for determining whether the imaging position and the preset determination position are close enough.
[0076] It can be understood that since precise control of the motor movement requires accurate identification of the imaging position, step S22 is performed to avoid erroneously identifying the detection position of the non-moving component as the detection position of the moving component when the matching degree is insufficient, and ensures that the preset determination position can be confirmed as the detection position of the moving component only when the imaging position is close enough to the preset determination position, thereby improving the accuracy and reliability of the moving component position detection.
[0077] In this embodiment, by comparing the matching degree between the imaging position and the preset judgment position, and setting a matching degree threshold, namely the preset matching degree, it is ensured that the position consistency is confirmed only when the matching degree exceeds the matching degree threshold, thereby improving the accuracy of the moving part position detection and the fault tolerance of the system, avoiding misjudgment due to image recognition errors, and providing an effective execution basis to ensure that the motor accurately stops or adjusts the movement at the preset limit point, thereby improving the performance and reliability of the entire moving part control system.
[0078] The present embodiment provides a method for detecting the position of a moving part, which monitors a preset identification pattern through an image sensor and accurately compares the imaging position, so as to determine the actual position of the moving part when the imaging position comparison is consistent, thereby avoiding the multiple connecting wires required for traditional photoelectric switches, thereby reducing the workload of equipment installation, debugging and maintenance, and reducing the complexity of wiring in the detection process of the moving part limit control while ensuring the accuracy of detecting the position of the moving part.
[0079] In a feasible implementation manner, the moving component is driven by a motor, and after step S20, steps S31 to S33 are further included:
[0080] Step S31, obtaining a limit signal corresponding to the detection position;
[0081] It should be noted that the limit signal refers to a control signal used to instruct the motor to stop or adjust the motion state;
[0082] In addition, it should be noted that the image sensor is also equipped with a wireless transmission unit, and the speed control signal or the stop signal is output through the wireless antenna in the wireless transmission unit, wherein the wireless antenna refers to a device for transmitting a limit signal, which can convert the limit signal into a radio wave for wireless transmission. By transmitting the limit signal wirelessly, the connection between devices is reduced, the flexibility and reliability of signal transmission are improved, and the difficulty of installation and maintenance is also reduced, especially in an environment where wiring is difficult or not suitable for wired connection, which further reduces the complexity of wiring in the detection process of limit control of moving parts.
[0083] It is understandable that since the position information obtained by identification and comparison is difficult to be effectively transmitted, the moving parts driven by the motor may lose control, so step S31 is performed to obtain accurate limit signals to ensure that when the moving parts are in the correct limit position, the motor can obtain the corresponding control signal, thereby improving the timeliness and accuracy of motor control.
[0084] Step S32, when the limit signal is a speed regulation signal, output the speed regulation signal to adjust the speed and / or rotation direction of the motor through the speed regulation signal;
[0085] It should be noted that the speed regulation signal refers to a control signal used to adjust the speed and / or rotation direction of the motor.
[0086] It is understandable that since the rotation speed and rotation direction of the motor driving the moving parts may need to be adjusted in real time according to the actual working conditions during the operation of the moving parts, performing step S32 can avoid problems such as low work efficiency, equipment damage or safety accidents caused by improper speed or wrong direction during the operation of the motor, and realize flexible and precise control of the movement state of the motor, optimize the working performance of the motor, improve production efficiency, and ensure the safety of operation.
[0087] Step S33: when the limit signal is a stop signal, output the stop signal to control the motor to stop rotating through the stop signal.
[0088] It should be noted that the stop signal refers to a control signal used to instruct the motor to stop rotating immediately.
[0089] It can be understood that, since the motor needs to be stopped immediately when the moving part reaches the predetermined limit point to avoid the moving part exceeding the range of motion and causing dangerous situations such as collision and equipment damage, performing step B33 can avoid equipment damage, production accidents or personal injuries caused by failure to stop the motor in time. By outputting a stop signal, it is ensured that the motor can stop rotating quickly and accurately when the moving part reaches the limit point, thereby improving the safety and reliability of the moving part driven by the motor.
[0090] In this embodiment, by obtaining the limit signal corresponding to the detection position and outputting the corresponding control signal according to the signal type (speed regulation signal or stop signal), the speed and / or rotation direction of the motor is adjusted, or the motor is stopped when necessary, thereby achieving the effect of precise control of the motor state, improving the flexibility and reliability of the moving parts driven by the motor, and ensuring the stability and safety of the equipment operation.
[0091] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. Figure 5 , Figure 5 This is a flow chart of the second embodiment of the method for detecting the position of a moving part of the present application. The method for detecting the position of a moving part further includes steps S01 to S02:
[0092] Step S01, for any preset limit point of the moving component, controlling the moving component to move so as to move the preset identification pattern to the preset limit point;
[0093] It should be noted that the preset limit points refer to a plurality of specific positions that are preset during the working process of the moving parts, and the specific positions are the change points of the motor motion control.
[0094] It can be understood that since the limit position of the motor movement needs to be accurately calibrated during the process of motor motion limit control, performing step S01 can avoid the problem of inaccurate motor movement range or control failure caused by improper limit position setting. By accurately controlling the movement of the equipment, it is ensured that the preset identification pattern can accurately reach each preset limit point, thereby providing reliable reference data for subsequent imaging position recognition and limit control. In addition, during the operation of the moving parts, if additional limit points need to be added, it is only necessary to perform step S01 to move the preset identification pattern to the new limit point. There is no need to increase the number of photoelectric switches and connecting lines. The addition of limit points can be achieved by simply adding marks for determining the position through software editing, thereby improving the usability and extensibility of the position detection system.
[0095] Step S02, when the preset identification pattern is at the preset limit point, the position of the preset identification pattern on the imaging surface is recorded to obtain a preset determination position.
[0096] It can be understood that since the limit position actually reached by the preset identification pattern needs to correspond to the position captured by the image sensor so that the image sensor can identify and compare the position, step S02 is performed to avoid the problem of position recognition error or matching failure caused by the lack of a clear preset judgment position, and ensure that the image sensor can output a limit signal for effective position matching based on accurate position information, thereby improving the accuracy and stability of the position detection system.
[0097] For example, please refer to Figure 6 In the figure, three preset limit points are set, namely limit 1, limit 2 and limit 3, CL is a convex lens, i.e., an image sensor, P is an imaging surface of the image sensor, and the three image position determination points from top to bottom in the imaging surface (limit 3 image position determination point P3, limit 1 image position determination point P1, limit 2 image position determination point P2) are three different preset determination positions, wherein the preset determination position corresponding to limit 1 is P1, the preset determination position corresponding to limit 2 is P2, and the preset determination position corresponding to limit 3 is P3.
[0098] In this embodiment, by precisely controlling the movement of the moving parts, it is ensured that the preset identification pattern can accurately reach each preset limit point, and the imaging position at this time is used as the preset judgment position, thereby providing a reliable position reference point for the image sensor, improving the accuracy of the limit control of the moving parts and the reliability of the system, avoiding control errors caused by position deviation, and ensuring that the motor can accurately control the moving parts to stop or adjust the movement at the predetermined limit point.
[0099] For example, in order to help understand the implementation process of the method for detecting the position of a moving part obtained by combining this embodiment with the above-mentioned embodiment 1, please refer to Figure 7 , Figure 7 A brief flow chart of a method for detecting the position of a moving part is provided, specifically:
[0100] First, the preset identification pattern on the moving part is monitored by an image sensor, and the preset determination position is calibrated, that is, the moving part is controlled to move to any preset limit point of the moving part, so as to move the preset identification pattern to the preset limit point; when the preset identification pattern is at the preset limit point, the position of the preset identification pattern on the imaging surface is recorded to obtain the preset determination position. Then, the calibrated preset determination position is compared with the monitored imaging position to determine the detection position of the moving part in multiple preset determination positions, and finally the limit signal corresponding to the detection position is output through the wireless antenna, thereby realizing the control of the moving part driven by the motor.
[0101] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the position detection method of the moving parts of the present application. More simple transformations based on this technical concept are all within the protection scope of the present application.
[0102] This application also provides a position detection device, please refer to Figure 8 The position detection device is applied to a position detection system, the position detection system comprises a moving part and an image sensor, a surface of the moving part is provided with a preset identification pattern, and the position detection device comprises:
[0103] A monitoring module 10, configured to monitor the preset identification pattern through the image sensor to obtain an imaging position of the preset identification pattern on an imaging surface of the image sensor;
[0104] The comparison module 20 is used to compare the imaging position with a plurality of preset determination positions one by one, and use the preset determination position consistent with the imaging position among the plurality of preset determination positions as the detection position of the moving part.
[0105] Optionally, the position detection device further includes:
[0106] The calibration module 30 is used for controlling the movement of the moving component to move the preset identification pattern to any preset limit point of the moving component;
[0107] When the preset identification pattern is at the preset limit point, the position of the preset identification pattern on the imaging surface is recorded to obtain a preset determination position.
[0108] Optionally, the comparison module 20 is further used for:
[0109] Obtaining a limit signal corresponding to the detection position;
[0110] In the case where the limit signal is a speed regulation signal, outputting the speed regulation signal to adjust the speed and / or rotation direction of the motor through the speed regulation signal;
[0111] In the case where the limit signal is a stop signal, the stop signal is output to control the motor to stop rotating through the stop signal.
[0112] Optionally, the image sensor is configured with a wireless charging unit and a wireless transmission unit, the image sensor is powered by a wireless charging coil in the wireless charging unit, and the speed regulation signal or the stop signal is output through a wireless antenna in the wireless transmission unit.
[0113] Optionally, the comparison module 20 is further used for:
[0114] For any preset determination position, the imaging position is compared with the preset determination position to obtain a matching degree between the imaging position and the preset determination position;
[0115] When the matching degree is greater than a preset matching degree, it is determined that the preset determination position is consistent with the imaging position.
[0116] Optionally, the comparison module 20 is further used for:
[0117] Extracting a preset number of first feature points in the imaging position and a preset number of second feature points in the preset determination position;
[0118] Comparing the first feature point and the second feature point to determine the number of feature groups formed by the first feature point and the second feature point that have a matching relationship, wherein the descriptor distance between the first feature point and the second feature point that have a matching relationship is less than a preset distance;
[0119] The degree of matching is determined based on a ratio of the number to the preset number.
[0120] The position detection device provided by the present application adopts the position detection method of the moving part in the above embodiment, which can solve the technical problem of how to solve the complexity of the connection in the position detection process of the moving part limit control. Compared with the prior art, the beneficial effects of the position detection device provided by the present application are the same as the beneficial effects of the position detection method of the moving part provided by the above embodiment, and other technical features in the position detection device are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0121] The present application provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method for detecting the position of a moving part in the above-mentioned embodiment one.
[0122] Reference below Fig. 9 , which shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present application. The electronic devices in the embodiments of the present application may include but are not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig. 9 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0123] like Fig. 9 As shown, the electronic device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the electronic device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows an electronic device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.
[0124] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0125] The electronic device provided by the present application adopts the position detection method of the moving part in the above embodiment, which can solve the technical problem of how to solve the complexity of the connection in the position detection process of the moving part limit control. Compared with the prior art, the beneficial effects of the electronic device provided by the present application are the same as the beneficial effects of the position detection method of the moving part provided by the above embodiment, and the other technical features in the electronic device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0126] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0127] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0128] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, wherein the computer-readable program instructions are used to execute the method for detecting the position of a moving component in the above-mentioned embodiment.
[0129] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.
[0130] The computer-readable storage medium may be included in the electronic device, or may exist independently without being installed in the electronic device.
[0131] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by an electronic device, the electronic device: monitors a preset identification pattern on the surface of a moving part through an image sensor to obtain an imaging position of the preset identification pattern on the imaging surface of the image sensor; compares the imaging position with multiple preset judgment positions one by one, and uses the preset judgment position among the multiple preset judgment positions that is consistent with the imaging position as the detection position of the moving part.
[0132] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0133] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0134] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0135] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned method for detecting the position of the moving part, and can solve the technical problem of how to solve the complexity of the wiring in the position detection process of the moving part limit control. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the method for detecting the position of the moving part provided by the above-mentioned embodiment, and will not be repeated here.
[0136] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned method for detecting the position of a moving component when executed by a processor.
[0137] The computer program product provided by the present application can solve the technical problem of how to solve the wiring complexity in the position detection process of the moving part limit control. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as the beneficial effects of the position detection method of the moving part provided by the above embodiment, which will not be repeated here.
[0138] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A method for detecting the position of a moving part, characterized in that: Applied to a position detection system, the position detection system includes a moving part and an image sensor, a surface of the moving part is provided with a preset identification pattern, and the position detection method of the moving part includes: The preset identification pattern is monitored by the image sensor to obtain an imaging position of the preset identification pattern on an imaging surface of the image sensor; The imaging position is compared with a plurality of preset determination positions one by one, and a preset determination position among the plurality of preset determination positions that is consistent with the imaging position is used as a detection position of the moving component.
2. The method for detecting the position of a moving part according to claim 1, wherein: The method for detecting the position of the moving part further comprises: For any preset limit point of the moving component, controlling the moving component to move so as to move the preset identification pattern to the preset limit point; When the preset identification pattern is at the preset limit point, the position of the preset identification pattern on the imaging surface is recorded to obtain a preset determination position.
3. The method for detecting the position of a moving part according to claim 1, wherein: The moving part is driven by a motor, and the step of using a preset determination position consistent with the imaging position among the plurality of preset determination positions as the detection position of the moving part comprises: Obtaining a limit signal corresponding to the detection position; In the case where the limit signal is a speed regulation signal, outputting the speed regulation signal to adjust the speed and / or rotation direction of the motor through the speed regulation signal; In the case where the limit signal is a stop signal, the stop signal is output to control the motor to stop rotating through the stop signal.
4. The method for detecting the position of a moving part according to claim 3, characterized in that: The image sensor is configured with a wireless charging unit and a wireless transmission unit. The image sensor is powered by a wireless charging coil in the wireless charging unit, and the speed regulation signal or the stop signal is output through a wireless antenna in the wireless transmission unit.
5. The method for detecting the position of a moving part according to claim 1, wherein: The step of comparing the imaging position with a plurality of preset determination positions one by one comprises: For any preset determination position, the imaging position is compared with the preset determination position to obtain a matching degree between the imaging position and the preset determination position; When the matching degree is greater than a preset matching degree, it is determined that the preset determination position is consistent with the imaging position.
6. The method for detecting the position of a moving part according to claim 5, characterized in that: The step of comparing the imaging position with the preset determination position to obtain a matching degree between the imaging position and the preset determination position includes: Extracting a preset number of first feature points in the imaging position and a preset number of second feature points in the preset determination position; Comparing the first feature point and the second feature point to determine the number of feature groups formed by the first feature point and the second feature point that have a matching relationship, wherein the descriptor distance between the first feature point and the second feature point that have a matching relationship is less than a preset distance; The degree of matching is determined based on a ratio of the number to the preset number.
7. A position detection device, characterized in that: Applied to a position detection system, the position detection system comprises a moving part and an image sensor, a surface of the moving part is provided with a preset identification pattern, and the position detection device comprises: A monitoring module, used to monitor the preset identification pattern through the image sensor to obtain an imaging position of the preset identification pattern on an imaging surface of the image sensor; The comparison module is used to compare the imaging position with a plurality of preset determination positions one by one, and use the preset determination position consistent with the imaging position among the plurality of preset determination positions as the detection position of the moving part.
8. An electronic device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the method for detecting the position of a moving component according to any one of claims 1 to 6.
9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the method for detecting the position of a moving part according to any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the method for detecting the position of a moving component according to any one of claims 1 to 6 are implemented.