Two-dimensional position comparison method, system, device and storage medium for motion control
By obtaining the current and historical location of the motor encoder and outputting pulse signals or prompt information according to specific conditions, the problem that motion control in the existing technology cannot take into account both efficiency and accuracy is solved, and the precise control of multi-axis synchronous interpolation motion scenarios is realized and system stability.
Patent Information
- Application Number
- CN202311856827.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-29
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2043-12-29
AI Technical Summary
The prior art cannot take into account the efficiency and accuracy of motion control at the same time. Especially in scenarios where multi-axis synchronous interpolation motion scenarios and high-position comparison requirements, conventional methods have problems such as large resource occupation, single functions or insufficient accuracy.
By receiving the trigger information sent by the PC, the current and historical positions of the motor encoder are obtained, and the command position, the in-place width and the abnormal comparison flag are determined whether specific conditions are met, and the pulse signal or prompt information is output to achieve accurate position control.
It realizes precise control of the motion control system, takes into account high efficiency and accuracy, adapts to multi-axis synchronous interpolation motion scenarios, avoids abnormal situations, and improves the stability and reliability of the system.
Smart Images

Figure CN117850347B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of precision automation control, and in particular to a two-dimensional position comparison method, system, device and storage medium for motion control. Background Art
[0002] In the field of precision automation control, with the rapid development of visual technology, in addition to controlling position and speed, more and more production lines have higher and higher requirements for the quality of inspection of the shape and nameplate information of each product, and each product needs to be inspected as much as possible. In the current inspection, precise position control is required, such as camera control, dispensing switch valve control, etc. To achieve this goal, the commonly used solutions are generally divided into two types. One is to use the high-speed position comparison function of the servo drive to pre-store the point in the drive buffer in advance, and trigger the pulse signal when the feedback position reaches the set position. The second is to use the extremely short communication cycle of the bus on the bus controller, and periodically obtain the received instructions to compare the command position and the motor encoder position. When the set point is reached, the IO signal is triggered to achieve control of the camera.
[0003] Both solutions have their own application scenarios and shortcomings. First, on the servo drive, by utilizing the position comparison function inside the drive, the drive can be used to compare the feedback position and the command position in an extremely short 1us manner, with higher trigger accuracy, but it can only be single-channel or multi-channel single-channel, and cannot adapt to multi-axis synchronous interpolation motion scenarios, and the function is relatively single. It requires forward-looking advance writing and cannot be modified in real time. For scenarios with a large number of random points, it takes up more resources. Second, on the bus controller, although the comparison method is more flexible. It can meet the needs of different scenarios, but because it is restricted by the bus control cycle cannot be too small, it cannot be applied to scenarios with too high requirements for position comparison.
[0004] This shows that conventional technical means cannot take into account both efficiency and accuracy at the same time. Summary of the invention
[0005] The main purpose of the present invention is to solve the technical problem that position control cannot take into account both high efficiency and accuracy at the same time.
[0006] A first aspect of the present invention provides a two-dimensional position comparison method for motion control, the two-dimensional position comparison method for motion control comprising:
[0007] When receiving the trigger information sent by the PC, in response to the trigger information, the actual position currently fed back by the motor encoder is obtained, wherein the trigger information includes the command position, the in-position width, and the trigger abnormality comparison flag;
[0008] Determining whether a first trigger condition is met according to the actual position, the command position, and the in-place width;
[0009] If the first trigger condition is not met, output a prompt message according to the actual position, the command position, the in-position width and the trigger abnormal comparison flag and return to execute the step of obtaining the actual position currently fed back by the motor encoder;
[0010] If the first trigger condition is met, obtaining the historical position of the motor encoder at the previous moment;
[0011] determining whether a second trigger condition is satisfied according to the actual position, the command position, and the historical position;
[0012] If the second trigger condition is met, a trigger instruction of a pulse signal is output.
[0013] Optionally, in a first implementation manner of the first aspect of the present invention, the step of determining whether a first trigger condition is met according to the actual position, the command position, and the in-place width includes:
[0014] Determine, according to the actual position and the command position, whether the actual position is in a circular area formed by the command position and the in-position width;
[0015] If the actual position is within the circular area, determining that the first trigger condition is satisfied;
[0016] If the actual position is not within the circular area, it is determined that the first trigger condition is not satisfied.
[0017] Optionally, in a second implementation manner of the first aspect of the present invention, the step of determining whether a second trigger condition is met according to the actual position, the command position, and the historical position includes:
[0018] determining a first distance between the actual location and the commanded location and determining a second distance between the historical location and the commanded location;
[0019] If the second distance is greater than the first distance, it is determined that the second trigger condition is met.
[0020] Optionally, in a third implementation manner of the first aspect of the present invention, the step of determining a first distance between the actual position and the command position and determining a second distance between the historical position and the command position includes:
[0021] If the second distance is greater than the first distance, the process returns to the step of obtaining the actual position currently fed back by the motor encoder.
[0022] Optionally, in a fourth implementation of the first aspect of the present invention, if the first trigger condition is not met, the step of outputting prompt information according to the actual position, the command position, the in-place width, and the trigger abnormal comparison flag includes:
[0023] If the first trigger condition is not met, detecting in real time the minimum distance between the actual position and the command position;
[0024] If the minimum distance is greater than the in-place width, the trigger abnormal comparison flag is triggered to output the prompt information.
[0025] Optionally, in a fifth implementation of the first aspect of the present invention, after the step of outputting a trigger instruction of a pulse signal if the second trigger condition is met, the method further includes:
[0026] Detect whether there is trigger information to be processed;
[0027] If the trigger information to be processed exists, the trigger information to be processed is used as the trigger information, and the process returns to execute the step of obtaining the actual position currently fed back by the motor encoder in response to the trigger information.
[0028] Optionally, in a sixth implementation of the first aspect of the present invention, the step of outputting a trigger instruction of a pulse signal includes:
[0029] A trigger instruction of a pulse signal is sent to a preset target, wherein the preset target includes a camera and a laser interface.
[0030] A second aspect of the present invention provides a two-dimensional position comparison system for motion control, comprising:
[0031] A receiving module, configured to obtain the actual position currently fed back by the motor encoder in response to the trigger information when receiving the trigger information sent by the PC, wherein the trigger information includes the command position, the in-position width and the trigger abnormality comparison flag;
[0032] A first two-dimensional comparison module, used for determining whether a first trigger condition is satisfied according to the actual position, the command position and the in-place width;
[0033] a prompt module, configured to output prompt information according to the actual position, the command position, the in-position width and the trigger abnormal comparison flag and return to execute the step of obtaining the actual position currently fed back by the motor encoder if the first trigger condition is not met;
[0034] An acquisition module, configured to acquire a historical position of the motor encoder at a previous moment if the first trigger condition is met;
[0035] a second two-dimensional comparison module, configured to determine whether a second trigger condition is satisfied according to the actual position, the command position and the historical position;
[0036] The output module is used to output a trigger instruction of a pulse signal if the second trigger condition is met.
[0037] The third aspect of the present invention provides a two-dimensional position comparison device for motion control, comprising: a memory and at least one processor, wherein instructions are stored in the memory, and the memory and the at least one processor are interconnected via lines; the at least one processor calls the instructions in the memory so that the two-dimensional position comparison device for motion control executes the above-mentioned two-dimensional position comparison method for motion control.
[0038] A fourth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the above-mentioned two-dimensional position comparison method for motion control.
[0039] In an embodiment of the present invention, when a trigger message sent by a PC is received, in response to the trigger message, the actual position currently fed back by the motor encoder is obtained, and the trigger message includes a command position, an in-place width, and a trigger abnormal comparison flag; whether the first trigger condition is met is determined according to the actual position, the command position, and the in-place width; if the first trigger condition is not met, a prompt message is output according to the actual position, the command position, the in-place width, and the trigger abnormal comparison flag, and the step of obtaining the actual position currently fed back by the motor encoder is returned; if the first trigger condition is met, the historical position of the motor encoder at the previous moment is obtained; whether the second trigger condition is met is determined according to the actual position, the command position, and the historical position; if the second trigger condition is met, a trigger instruction of a pulse signal is output. The two-dimensional position comparison system of motion control obtains the current actual position and the historical position of the motor encoder by receiving the trigger message sent by the PC, and triggers the pulse signal according to certain conditions. By obtaining the actual position and the historical position currently fed back by the motor encoder, the precise control of the system position can be achieved. The program can automatically detect whether the first trigger condition is met according to parameters such as the actual position, the command position, and the in-place width, thereby improving the intelligence of the program. If the first trigger condition is not met, the program will output a prompt message and return to the step of obtaining the actual position currently fed back by the motor encoder, thereby avoiding the occurrence of abnormal situations. For the second trigger condition, the program can automatically detect whether the condition is met based on the changes in the actual position, command position, and historical position, thereby improving the time efficiency of the program. By triggering the pulse signal according to certain conditions, the stability and reliability of the system can be guaranteed. It takes into account both the efficiency and accuracy of position control. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 A schematic diagram of an embodiment of a two-dimensional position comparison method for motion control in an embodiment of the present invention;
[0041] Figure 2 A reference diagram of an embodiment of a two-dimensional position comparison method for motion control in an embodiment of the present invention;
[0042] Figure 3 A reference diagram of an embodiment of a two-dimensional position comparison method for motion control in an embodiment of the present invention;
[0043] Figure 4 A reference diagram of an embodiment of a two-dimensional position comparison method for motion control in an embodiment of the present invention;
[0044] Figure 5 A schematic diagram of an embodiment of a two-dimensional position comparison system for motion control in an embodiment of the present invention;
[0045] Figure 6 It is a schematic diagram of an embodiment of a two-dimensional position comparison device for motion control in an embodiment of the present invention. DETAILED DESCRIPTION
[0046] Embodiments of the present invention provide a two-dimensional position comparison method, system, device and storage medium for motion control.
[0047] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0048] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 , an embodiment of a two-dimensional position comparison method for motion control in an embodiment of the present invention includes:
[0049] 101. When trigger information sent by the PC is received, in response to the trigger information, an actual position currently fed back by the motor encoder is acquired, wherein the trigger information includes a command position, an in-position width, and a trigger abnormality comparison flag;
[0050] Specifically, PCs (personal computers) and motion controller software usually work together to achieve precise control and movement of robots, automated production lines or other automated systems. Motion controller software usually consists of industrial-grade controllers, programmers and other controller software, and can be integrated with a variety of devices and sensors, including motors, servo drives and sensors.
[0051] There are many ways for the PC and controller software to work together. For example, the PC can connect to the motion controller via a serial port or Ethernet, send control instructions to the controller, and receive feedback signals for execution monitoring and adjustment. In addition to the hardware connection, the software can also interact through some specific interfaces or APIs (application programming interfaces). For example, users can use the API provided by the controller software to write their own control programs and interact with the motion controller software to achieve more complex tasks and functions.
[0052] In the collaborative process, the PC is usually responsible for high-level control tasks such as decision making, GUI interface, data processing and network communication, while the motion controller is mainly responsible for low-level control tasks such as real-time control and motion monitoring, thereby achieving efficient, accurate and reliable motion control.
[0053] In this embodiment, the two-dimensional position comparison system of motion control sends the trigger information required to be triggered to the first two-dimensional comparison module (position comparison dedicated module) in the format of data (X, Y, R, A), where X is the X-axis position coordinate, Y is the Y-axis position coordinate, and R is the in-place width, triggering the abnormal comparison flag A. "Trigger abnormal comparison flag" is a parameter in the encoder control program, which is used to determine how to handle the abnormal situation when there is an error between the actual position currently fed back by the encoder and the command position. Specifically, if the flag is true, it means that an abnormal comparison is required, that is, to determine whether there is an abnormal situation; conversely, if the flag is false, it means that when the command position is not reached, the prompt information is directly output and the subsequent steps are returned. Usually, this flag will be set to true to ensure that the program can automatically detect and handle abnormal situations, thereby improving the stability and reliability of the system.
[0054] Optionally, the two-dimensional position comparison system of motion control in this embodiment is a software motion controller. A software motion controller generally refers to a type of motion control system based on computer software, which can achieve precise control and motion of a mechanical system by using technical means such as encoders, motors, and control algorithms. A software motion controller mainly includes three parts: a hardware interface, a motion control algorithm, and a user interface. The hardware interface is usually a physical connection between a controller and peripheral devices such as motors and encoders, which can realize data acquisition and control of peripheral devices. The motion control algorithm is the core part of the software motion controller, which is responsible for processing and analyzing the data of peripheral devices, thereby calculating the optimal motion path and control parameters, and achieving precise control of the mechanical system. The user interface provides an intuitive control panel and operating process, which facilitates users to configure and debug the motion controller. Common user interfaces include graphical interfaces and command line interfaces. Compared with traditional hardware motion controllers, software motion controllers have higher flexibility, scalability, and ease of use, and can be personalized and customized according to needs. It is suitable for industrial automation, robot control, medical equipment and other fields.
[0055] 102. Determine whether a first trigger condition is met according to the actual position, the command position, and the in-place width;
[0056] Optionally, it is determined whether the actual position is in the circular area formed by the command position and the in-place width based on the actual position and the command position; if the actual position is in the circular area, it is determined that the first trigger condition is met; if the actual position is not in the circular area, it is determined that the first trigger condition is not met.
[0057] Specifically, refer to Figure 2 , where the actual trajectory is the trajectory formed by the actual position, and the command trajectory is the trajectory formed by multiple command positions. The two-dimensional position comparison system of motion control uses the actual position actually fed back by the motor encoder to compare with the set command position. When the difference r between the feedback position of the motor encoder in the current cycle and the set coordinate position is the minimum value and the difference r is less than the in-position width R (satisfying the first trigger condition), the feedback position of the motor encoder will trigger the signal in the next interval T (e.g. 1us) cycle.
[0058] 103. If the first trigger condition is not met, output prompt information according to the actual position, the command position, the in-position width and the trigger abnormal comparison flag and return to execute the step of obtaining the actual position currently fed back by the motor encoder;
[0059] Optionally, if the first trigger condition is not met, the minimum distance between the actual position and the command position is detected in real time; if the minimum distance is greater than the in-place width, the trigger abnormal comparison flag is triggered to output the prompt information. Specifically, the actual entry into the in-place range is used as A s point, and start to determine the position of the motor encoder as point A0. If r is always greater than R at the minimum point Am, the abnormal comparison flag A will be triggered. At this time, the abnormal comparison flag A will be returned to the PC real-time bus for real-time data modification. Figure 3 .
[0060] 104. If the first trigger condition is met, obtain the historical position of the motor encoder at the previous moment;
[0061] Specifically, refer to Figure 2 , when A m+1 The point position is the actual position fed back by the motor encoder, then A m It is the historical location.
[0062] 105. Determine whether a second trigger condition is met according to the actual position, the command position, and the historical position;
[0063] Optionally, the second determination module in the two-dimensional position comparison system of motion control determines a first distance between the actual position and the command position and determines a second distance between the historical position and the command position; if the second distance is greater than the first distance, it is determined that the second trigger condition is satisfied. Specifically, the periodic determination L is repeated at intervals of T. 2 =(X-X1) 2 +(Y-Y1) 2 , while satisfying the fact that it is already within the width range (i.e. r is less than or equal to R) and starts to move away from the minimum point A m When the next A m+1 Position trigger signal.
[0064] 106. If the second trigger condition is met, output a trigger instruction of a pulse signal.
[0065] Specifically, refer to Figure 2 , when A m+1 The point position is the actual position fed back by the motor encoder, then A m is the historical position, A m The minimum point where r is less than or equal to R, then the trigger instruction of the pulse signal is output. At this time, the accuracy requirement is met and there is no need to call back the actual position before triggering the pulse signal, which takes into account both the trigger accuracy and the trigger efficiency.
[0066] Optionally, a complete two-dimensional position comparison cycle for motion control can be referenced Figure 4. Among them, the encoder feedback position is the actual position; the encoder feedback position of the next interval T cycle is the historical position, and the set coordinate position is the command position; detect whether there is pending trigger information; if there is the pending trigger information, use the pending trigger information as the trigger information, and return to execute the step of obtaining the motor encoder feedback position (obtaining the actual position of the current feedback of the motor encoder); if at the minimum point Am, the difference r between the encoder feedback position of the current cycle and the set coordinate position is greater than R, that is, there is Figure 3 In the abnormal situation shown, the abnormal comparison flag A is triggered, and the two-dimensional position comparison system of the motion control performs the parameter modification operation to return to the step of controlling the motor encoder to obtain the feedback position (obtaining the actual position of the current feedback of the motor encoder).
[0067] The pulse signal trigger interface of the motion control two-dimensional position comparison system sends a pulse signal trigger instruction to a preset target, which includes a camera and a laser interface. The pulse signal trigger interface generally refers to an interface used to realize automatic control of peripheral devices (such as cameras, lasers, etc.). The trigger interface can trigger the corresponding operation of the peripheral by sending a Trigger signal to it, thereby achieving precise measurement and control.
[0068] First, the internal position comparison of the comparison driver in this embodiment can meet the different requirements for position comparison in single-channel, two-dimensional and other occasions. No pre-writing is required. Compared with the bus controller method, although the comparison method is more flexible, it is restricted by the bus control cycle cannot be too small. Through the two-dimensional comparison module, an extremely short cycle, such as 1us, can be used. Compared with the common position comparison module, our trigger condition must simultaneously meet the coordinates entering the range of the in-place width and the minimum point starting to move away from the set coordinate point to trigger the signal. For exception handling, all processes can be monitored in real time through real-time interaction. And the position comparison signal can be monitored, the result confirmed and adjusted in real time.
[0069] Secondly, the internal position comparison of the comparison driver in this embodiment does not require pre-writing, and can achieve instant writing during the motion process, thereby improving efficiency and flexibility. Compared with the bus controller method, by utilizing the two-dimensional comparison module, its extremely short cycle can be used, the trigger signal is more accurate, and it has stronger functionality. Compared with the common position comparison output module, a more precise algorithm is used to achieve higher accuracy, and it can achieve full inspection of the product. For exception handling, the short cycle and rapid response of the PC-based software motion controller are fully utilized to enhance the efficiency of data interaction and parameter adjustment.
[0070] In an embodiment of the present invention, when a trigger message sent by a PC is received, in response to the trigger message, the actual position currently fed back by the motor encoder is obtained, and the trigger message includes a command position, an in-place width, and a trigger abnormal comparison flag; whether the first trigger condition is met is determined according to the actual position, the command position, and the in-place width; if the first trigger condition is not met, a prompt message is output according to the actual position, the command position, the in-place width, and the trigger abnormal comparison flag, and the step of obtaining the actual position currently fed back by the motor encoder is returned; if the first trigger condition is met, the historical position of the motor encoder at the previous moment is obtained; whether the second trigger condition is met is determined according to the actual position, the command position, and the historical position; if the second trigger condition is met, a trigger instruction of a pulse signal is output. The two-dimensional position comparison system of motion control obtains the current actual position and the historical position of the motor encoder by receiving the trigger message sent by the PC, and triggers the pulse signal according to certain conditions. By obtaining the actual position and the historical position currently fed back by the motor encoder, the precise control of the system position can be achieved. The program can automatically detect whether the first trigger condition is met according to parameters such as the actual position, the command position, and the in-place width, thereby improving the intelligence of the program. If the first trigger condition is not met, the program will output a prompt message and return to the step of obtaining the actual position currently fed back by the motor encoder, thereby avoiding the occurrence of abnormal situations. For the second trigger condition, the program can automatically detect whether the condition is met based on the changes in the actual position, command position, and historical position, thereby improving the time efficiency of the program. By triggering the pulse signal according to certain conditions, the stability and reliability of the system can be guaranteed. It takes into account both the efficiency and accuracy of position control.
[0071] The above describes the two-dimensional position comparison method of motion control in the embodiment of the present invention. The following describes the two-dimensional position comparison system of motion control in the embodiment of the present invention. Figure 5 , an embodiment of a two-dimensional position comparison system for motion control in an embodiment of the present invention includes:
[0072] The receiving module 301 is used for obtaining the actual position currently fed back by the motor encoder in response to the trigger information when receiving the trigger information sent by the PC, wherein the trigger information includes the command position, the in-position width and the trigger abnormal comparison flag;
[0073] A first two-dimensional comparison module 302 is used to determine whether a first trigger condition is satisfied according to the actual position, the command position and the in-place width;
[0074] A prompt module 303 is used for outputting prompt information according to the actual position, the command position, the in-position width and the trigger abnormal comparison flag and returning to execute the step of obtaining the actual position currently fed back by the motor encoder if the first trigger condition is not met;
[0075] An acquisition module 304 is used to acquire the historical position of the motor encoder at the previous moment if the first trigger condition is met;
[0076] A second two-dimensional comparison module 305, configured to determine whether a second trigger condition is satisfied according to the actual position, the command position and the historical position;
[0077] The output module 306 is used to output a trigger instruction of a pulse signal if the second trigger condition is met.
[0078] Optionally, the first two-dimensional comparison module 302 may also be specifically used for:
[0079] Determine, according to the actual position and the command position, whether the actual position is in a circular area formed by the command position and the in-position width;
[0080] If the actual position is within the circular area, determining that the first trigger condition is satisfied;
[0081] If the actual position is not within the circular area, it is determined that the first trigger condition is not satisfied.
[0082] Optionally, the second two-dimensional comparison module 305 may also be specifically used for:
[0083] determining a first distance between the actual location and the commanded location and determining a second distance between the historical location and the commanded location;
[0084] If the second distance is greater than the first distance, it is determined that the second trigger condition is met.
[0085] Optionally, the second two-dimensional comparison module 305 may also be specifically used for:
[0086] If the second distance is greater than the first distance, the process returns to the step of obtaining the actual position currently fed back by the motor encoder.
[0087] Optionally, the prompt module 303 may also be specifically used for:
[0088] If the first trigger condition is not met, detecting in real time the minimum distance between the actual position and the command position;
[0089] If the minimum distance is greater than the in-place width, the trigger abnormal comparison flag is triggered to output the prompt information.
[0090] Optionally, the output module 306 may also be specifically used for:
[0091] Detect whether there is trigger information to be processed;
[0092] If the trigger information to be processed exists, the trigger information to be processed is used as the trigger information, and the process returns to execute the step of obtaining the actual position currently fed back by the motor encoder in response to the trigger information.
[0093] Optionally, the output module 306 may also be specifically used for:
[0094] A trigger instruction of a pulse signal is sent to a preset target, wherein the preset target includes a camera and a laser interface.
[0095] In an embodiment of the present invention, when a trigger message sent by a PC is received, in response to the trigger message, the actual position currently fed back by the motor encoder is obtained, and the trigger message includes a command position, an in-place width, and a trigger abnormal comparison flag; whether the first trigger condition is met is determined according to the actual position, the command position, and the in-place width; if the first trigger condition is not met, a prompt message is output according to the actual position, the command position, the in-place width, and the trigger abnormal comparison flag, and the step of obtaining the actual position currently fed back by the motor encoder is returned; if the first trigger condition is met, the historical position of the motor encoder at the previous moment is obtained; whether the second trigger condition is met is determined according to the actual position, the command position, and the historical position; if the second trigger condition is met, a trigger instruction of a pulse signal is output. The two-dimensional position comparison system of motion control obtains the current actual position and the historical position of the motor encoder by receiving the trigger message sent by the PC, and triggers the pulse signal according to certain conditions. By obtaining the actual position and the historical position currently fed back by the motor encoder, the precise control of the system position can be achieved. The program can automatically detect whether the first trigger condition is met according to parameters such as the actual position, the command position, and the in-place width, thereby improving the intelligence of the program. If the first trigger condition is not met, the program will output a prompt message and return to the step of obtaining the actual position currently fed back by the motor encoder, thereby avoiding the occurrence of abnormal situations. For the second trigger condition, the program can automatically detect whether the condition is met based on the changes in the actual position, command position, and historical position, thereby improving the time efficiency of the program. By triggering the pulse signal according to certain conditions, the stability and reliability of the system can be guaranteed. It takes into account both the efficiency and accuracy of position control.
[0096] above Figure 5The two-dimensional position comparison system for motion control in the embodiment of the present invention is described in detail from the perspective of modular functional entities. The two-dimensional position comparison device for motion control in the embodiment of the present invention is described in detail from the perspective of hardware processing.
[0097] Figure 6 1 is a schematic diagram of the structure of a motion-controlled two-dimensional position comparison device provided by an embodiment of the present invention. The motion-controlled two-dimensional position comparison device 500 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 510 (for example, one or more processors) and a memory 520, and one or more storage media 530 (for example, one or more mass storage devices) storing application programs 533 or data 532. Among them, the memory 520 and the storage medium 530 can be short-term storage or permanent storage. The program stored in the storage medium 530 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the motion-controlled two-dimensional position comparison device 500. Furthermore, the processor 510 may be configured to communicate with the storage medium 530 to execute a series of instruction operations in the storage medium 530 on the motion-controlled two-dimensional position comparison device 500.
[0098] The motion-controlled two-dimensional position comparison device 500 may further include one or more power supplies 540, one or more wired or wireless network interfaces 550, one or more input and output interfaces 560, and / or one or more operating systems 531, such as Windows Serve, Mac OS X, Unix, Linux, FreeBSD, etc. It will be appreciated by those skilled in the art that Figure 6 The illustrated structure of the motion-controlled two-dimensional position comparison device does not constitute a limitation on the motion-controlled two-dimensional position comparison device, and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.
[0099] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When the instructions are executed on a computer, the computer executes the steps of the two-dimensional position comparison method of motion control.
[0100] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described system, device, or unit can refer to the corresponding process in the aforementioned method embodiment and will not be repeated here.
[0101] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the whole or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other storage media that can store program codes.
[0102] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A two-dimensional position comparison method for motion control, characterized in that: The two-dimensional position comparison method of motion control comprises: When receiving the trigger information sent by the PC, in response to the trigger information, the actual position currently fed back by the motor encoder is obtained, wherein the trigger information includes the command position, the in-position width, and the trigger abnormality comparison flag; Determining whether a first trigger condition is met according to the actual position, the command position, and the in-place width; If the first trigger condition is not met, output a prompt message according to the actual position, the command position, the in-position width and the trigger abnormal comparison flag and return to execute the step of obtaining the actual position currently fed back by the motor encoder; If the first trigger condition is met, obtaining the historical position of the motor encoder at the previous moment; determining whether a second trigger condition is satisfied according to the actual position, the command position, and the historical position; If the second trigger condition is met, a trigger instruction of a pulse signal is output; The step of determining whether the first trigger condition is met according to the actual position, the command position and the in-place width comprises: Determine, according to the actual position and the command position, whether the actual position is in a circular area formed by the command position and the in-position width; If the actual position is within the circular area, determining that the first trigger condition is satisfied; If the actual position is not within the circular area, determining that the first trigger condition is not met; The step of determining whether a second trigger condition is met according to the actual position, the command position, and the historical position includes: determining a first distance between the actual location and the commanded location and determining a second distance between the historical location and the commanded location; If the second distance is greater than the first distance, it is determined that the second trigger condition is met.
2. The two-dimensional position comparison method for motion control according to claim 1, characterized in that: The step of determining a first distance between the actual position and the command position and determining a second distance between the historical position and the command position comprises: If the second distance is greater than the first distance, the process returns to the step of obtaining the actual position currently fed back by the motor encoder.
3. The two-dimensional position comparison method for motion control according to claim 1, characterized in that: The step of outputting prompt information according to the actual position, the command position, the in-place width and the trigger abnormal comparison flag if the first trigger condition is not met includes: If the first trigger condition is not met, detecting in real time the minimum distance between the actual position and the command position; If the minimum distance is greater than the in-place width, the trigger abnormal comparison flag is triggered to output the prompt information.
4. The two-dimensional position comparison method for motion control according to claim 1, characterized in that: After the step of outputting a trigger instruction of a pulse signal if the second trigger condition is met, the method further includes: Detect whether there is trigger information to be processed; If the trigger information to be processed exists, the trigger information to be processed is used as the trigger information, and the process returns to execute the step of obtaining the actual position currently fed back by the motor encoder in response to the trigger information.
5. The two-dimensional position comparison method for motion control according to any one of claims 1 to 4, characterized in that: The step of outputting a trigger instruction of a pulse signal comprises: A trigger instruction of a pulse signal is sent to a preset target, wherein the preset target includes a camera and a laser interface.
6. A two-dimensional position comparison system for motion control, characterized in that: The two-dimensional position comparison system of the motion control comprises: A receiving module, configured to obtain the actual position currently fed back by the motor encoder in response to the trigger information when receiving the trigger information sent by the PC, wherein the trigger information includes the command position, the in-position width and the trigger abnormality comparison flag; A first two-dimensional comparison module, used for determining whether a first trigger condition is satisfied according to the actual position, the command position and the in-place width; a prompt module, configured to output prompt information according to the actual position, the command position, the in-position width and the trigger abnormal comparison flag and return to execute the step of obtaining the actual position currently fed back by the motor encoder if the first trigger condition is not met; An acquisition module, configured to acquire a historical position of the motor encoder at a previous moment if the first trigger condition is met; a second two-dimensional comparison module, configured to determine whether a second trigger condition is satisfied according to the actual position, the command position and the historical position; An output module, used for outputting a trigger instruction of a pulse signal if the second trigger condition is met; Wherein, the first two-dimensional comparison module is also specifically used for: Determine, according to the actual position and the command position, whether the actual position is in a circular area formed by the command position and the in-position width; If the actual position is within the circular area, determining that the first trigger condition is satisfied; If the actual position is not within the circular area, determining that the first trigger condition is not met; Wherein, the second two-dimensional comparison module is also specifically used for: determining a first distance between the actual location and the commanded location and determining a second distance between the historical location and the commanded location; If the second distance is greater than the first distance, it is determined that the second trigger condition is met.
7. A motion-controlled two-dimensional position comparison device, characterized in that: The motion-controlled two-dimensional position comparison device comprises: a memory and at least one processor, the memory stores instructions, and the memory and the at least one processor are interconnected via a line; The at least one processor calls the instructions in the memory to enable the two-dimensional position comparison device for motion control to execute the two-dimensional position comparison method for motion control according to any one of claims 1-5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the two-dimensional position comparison method for motion control according to any one of claims 1 to 5 is implemented.
