Configurable servo-rotation image-taking method, electronic device, and computer-readable storage medium

By configuring the model parameters in the servo rotation image acquisition system and utilizing high-speed counter hardware interrupts, the universality and adaptability issues of servo rotation image acquisition in existing technologies are solved, achieving efficient and reliable image acquisition and anomaly handling, and reducing development and maintenance costs.

CN122160619APending Publication Date: 2026-06-05HARBIN NAISHI INTELLIGENT TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HARBIN NAISHI INTELLIGENT TECH CO LTD
Filing Date
2026-04-15
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing servo rotary image acquisition PLC programs suffer from poor versatility and adaptability, high development and maintenance costs, long debugging cycles, difficulty in balancing image acquisition speed and accuracy, and imperfect exception handling mechanisms.

Method used

The model parameters are configured via the touch screen and converted into the target pulse number of the encoder. The high-speed counter hardware interrupt is used to achieve microsecond-level response to trigger the camera to take pictures. The grating occlusion, servo alarm and limit signal are monitored in real time. When an abnormality occurs, the output is stopped immediately and a reset or rollback action is performed.

Benefits of technology

It enables adaptation to different machine models and workpieces without modifying the main program, improving testing efficiency and system reliability, reducing development and maintenance costs, and ensuring production continuity and safety.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122160619A_ABST
    Figure CN122160619A_ABST
Patent Text Reader

Abstract

The application provides a configurable servo rotation image taking method, an electronic device and a storage medium, and solves the problems of poor universality, weak adaptability, long debugging period, inability to balance image taking speed and precision and imperfect exception handling of an existing servo rotation image taking program. The method comprises the following steps: configuring the number of photographing, the angle value of each photographing point, the release point, the end point and the servo rotation speed through a touch screen; converting the angle value into an encoder target pulse number and writing the same into a high-speed counter comparison value list; after starting the servo rotation, comparing the pulse value in real time through the high-speed counter, and when the target pulse number is reached, outputting a camera trigger signal to execute a snapshot by hardware triggering interruption; confirming the collection state of each point through a loop program, skipping and alarming when the time is up; and simultaneously monitoring a grating, a servo alarm and a limit signal in real time to ensure safety. The application can be applied to scenes such as workpiece appearance detection, 3D image collection and product size measurement.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of industrial automation control technology, and in particular to a configurable servo rotation image acquisition method, electronic device, and computer-readable storage medium. Background Technology

[0002] In industrial automated production processes, servo rotation imaging technology is widely used in scenarios such as workpiece appearance inspection and product dimension verification. Its core principle is to use a PLC program to control a servo motor to precisely rotate an image acquisition device or workpiece, while simultaneously controlling the image acquisition device to acquire images at a preset angle. Currently, most existing servo rotation imaging PLC programs adopt a "custom-made" approach, meaning that a dedicated control program is written for specific servo system models, image acquisition devices, workpiece specifications, and imaging requirements. This fixed program has the following drawbacks: First, it has poor versatility. When changing the servo system, image acquisition equipment, or adjusting workpiece specifications and image acquisition parameters, technicians need to rewrite or significantly modify the main program, resulting in a large development workload and a long debugging cycle. Second, it has weak adaptability. The number of images, rotation angle, and image acquisition interval vary greatly in different industrial scenarios. The fixed program cannot flexibly adapt to multiple scenarios, and enterprises need to develop multiple programs, resulting in high maintenance costs. Third, it is difficult to balance image acquisition speed and accuracy. Traditional fixed shooting methods require stopping at the shooting point, which is inefficient. Even if some solutions use flying shooting technology, problems such as trigger timing deviation and blurry images are prone to occur when switching between multiple models, and there is a lack of hardware-level real-time response mechanism. Fourth, the abnormal handling mechanism is imperfect. When the servo rotation is abnormal, the image acquisition fails, communication is interrupted, or personnel accidentally enter, the program cannot respond in time, which can easily lead to equipment damage or product scrapping.

[0003] Therefore, there is an urgent need for a servo rotation image acquisition method that is flexibly configurable, highly versatile, and has hardware-level real-time triggering and comprehensive anomaly handling capabilities to meet the application requirements of multi-angle image acquisition in industrial scenarios. Summary of the Invention

[0004] To address the problems of poor versatility and weak adaptability in existing technologies, high development and maintenance costs, long debugging cycles, difficulty in balancing image acquisition speed and accuracy, and imperfect anomaly handling mechanisms, this invention proposes a configurable servo rotation image acquisition method, which includes: Step 1: Configure the model parameters via the touch screen. The model parameters include the number of photos taken, the angle value corresponding to each photo point, the placement point position, the camera trigger delay, the end point position, and the servo rotation speed. Step 2: Convert the angle values ​​corresponding to each shooting point into the encoder target pulse count, and write the target pulse count into the comparison value list of the high-speed counter in sequence; Step 3: Receive the signal that the workpiece is clamped and the robot has withdrawn from the interference zone, reset the current value of the high-speed counter and start servo rotation; Step 4: Acquire encoder feedback pulses in real time, and compare the current pulse value with the target pulse number in the comparison value list using a high-speed counter; Step 5: When the current pulse value equals the target pulse number, an interrupt is triggered by the high-speed counter hardware. The interrupt service routine outputs the camera trigger signal to execute the aerial photography and records the current point index. Step 6: In the main program, the image acquisition completion status of each shooting point is checked sequentially through a loop program. If it is not completed, the program continues to rotate and waits for the next interruption. If the timeout occurs, an alarm is recorded and the current point is skipped. Step 7: Once the image acquisition at all photo points has been confirmed, or when the current value of the high-speed counter reaches the pulse value corresponding to the end point position, stop the servo rotation and send a pick-up permission signal to the robot.

[0005] Furthermore, in step three, The servo rotation initiation specifically includes: outputting a direction signal and controlling the rotation speed by sending a frequency-adjustable pulse signal to the servo driver, wherein the frequency of the pulse signal is calculated based on the servo rotation speed.

[0006] Furthermore, in step five, The interrupt is triggered by a high-speed counter hardware, with an interrupt response time in the microsecond range. The current pulse value and timestamp are recorded in the interrupt service routine for debugging purposes.

[0007] Furthermore, in step six, The loop program is a FOR loop; The specific steps for recording an alarm and skipping the current point if a timeout occurs are as follows: a waiting timer is started for each point. If a successful acquisition signal from the camera is not received within the preset timeout period, an acquisition timeout alarm is recorded and the point is skipped to continue operation.

[0008] Furthermore, in step seven, The specific steps to stop the servo rotation and send a pick-up permission signal to the robot are as follows: first, stop the pulse output to decelerate the servo, then disable the comparison function of the high-speed counter, and then send a pick-up permission signal to the robot. After the robot enters, the clamping mechanism releases and takes away the workpiece.

[0009] Furthermore, during servo rotation, the grating occlusion signal, servo alarm signal, and soft and hard limit signals are monitored in real time, and the servo output is stopped immediately and the alarm is reset when an abnormality occurs.

[0010] Furthermore, if the grating is blocked, the servo output will be stopped immediately and an alarm will be triggered; if a servo alarm is detected, a clearing command will be executed automatically, and if the clearing fails more than three times, the machine will stop; if the current pulse value exceeds the soft limit or hard limit setting value, the servo will stop and reverse back; the start signal will be automatically reset after an abnormality or shutdown.

[0011] Furthermore, it also includes the step of adjusting the shooting position by jogging: in jogging mode, the servo stepping rotation is controlled by the touch screen to adjust the angle value corresponding to the shooting position in real time and update the target pulse number synchronously.

[0012] The present invention proposes an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the above-described method.

[0013] The present invention proposes a computer-readable storage medium for storing computer instructions, which, when executed by a processor, implement the steps of the above-described method.

[0014] The beneficial effects of this invention are: To address the problems of poor versatility and weak adaptability in existing technologies, high development and maintenance costs, long debugging cycles, difficulty in balancing image acquisition speed and accuracy, and imperfect anomaly handling mechanisms, this invention proposes a configurable servo rotation image acquisition method electronic device and computer-readable storage medium, which has the following improvements: 1. The number of photos, the angle of each photo point, the placement point, the end point, and the servo rotation speed can be directly configured via the touch screen. This allows for adaptation to different machine models, different workpieces, and different image acquisition requirements without modifying the main program, greatly reducing development and maintenance costs.

[0015] 2. The angle value is converted into the encoder target pulse number and written into the high-speed counter comparison value list. The hardware interrupt is used to achieve microsecond-level response to trigger the camera to capture images without servo interruption, which improves detection efficiency while ensuring accuracy. At the same time, the acquisition status of each point is checked sequentially through a loop program. If the timeout is exceeded, it will automatically skip and alarm, avoiding the whole machine from being stuck due to single-point failure and ensuring production continuity.

[0016] 3. Real-time monitoring of grating occlusion, servo alarms, and soft and hard limit signals. When an abnormality occurs, the servo output is stopped immediately and corresponding reset or rollback actions are performed, effectively preventing equipment damage and personal injury, and improving system reliability and safety. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0018] Figure 1 This is a schematic diagram of the touchscreen display interface of the present invention; Figure 2 This is a schematic diagram of the loop program of the present invention. Detailed Implementation

[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0020] Combination Figures 1-2 This invention proposes a configurable servo rotation image acquisition method, the method comprising: Step 1: Configure the model parameters via the touch screen. The model parameters include the number of photos taken, the angle value corresponding to each photo point, the placement point position, the camera trigger delay, the end point position, and the servo rotation speed. Furthermore, in step one, the number of photos taken can be set to hundreds, and the angle value corresponding to each photo point has an accuracy of 0.01 degrees.

[0021] Step 2: Convert the angle values ​​corresponding to each shooting point into the encoder target pulse count, and write the target pulse count into the comparison value list of the high-speed counter in sequence; Step 3: Receive the signal that the workpiece is clamped and the robot has withdrawn from the interference zone, reset the current value of the high-speed counter and start servo rotation; Furthermore, in step three, The servo rotation initiation specifically includes: outputting a direction signal and controlling the rotation speed by sending a frequency-adjustable pulse signal to the servo driver, wherein the frequency of the pulse signal is calculated based on the servo rotation speed.

[0022] Step 4: Acquire encoder feedback pulses in real time, and compare the current pulse value with the target pulse number in the comparison value list using a high-speed counter; Step 5: When the current pulse value equals the target pulse number, an interrupt is triggered by the high-speed counter hardware. The interrupt service routine outputs the camera trigger signal to execute the aerial photography and records the current point index. Furthermore, in step five, The interrupt is triggered by a high-speed counter hardware, with an interrupt response time in the microsecond range. The current pulse value and timestamp are recorded in the interrupt service routine for debugging purposes.

[0023] Step 6: In the main program, the image acquisition completion status of each shooting point is checked sequentially through a loop program. If it is not completed, the program continues to rotate and waits for the next interruption. If the timeout occurs, an alarm is recorded and the current point is skipped. Furthermore, in step six, The loop program is a FOR loop; The specific steps for recording an alarm and skipping the current point if a timeout occurs are as follows: a waiting timer is started for each point. If a successful acquisition signal from the camera is not received within the preset timeout period, an acquisition timeout alarm is recorded and the point is skipped to continue operation.

[0024] Step 7: Once the image acquisition at all photo points has been confirmed, or when the current value of the high-speed counter reaches the pulse value corresponding to the end point position, stop the servo rotation and send a pick-up permission signal to the robot.

[0025] Furthermore, in step seven, The specific steps to stop the servo rotation and send a pick-up permission signal to the robot are as follows: first, stop the pulse output to decelerate the servo, then disable the comparison function of the high-speed counter, and then send a pick-up permission signal to the robot. After the robot enters, the clamping mechanism releases and takes away the workpiece.

[0026] Furthermore, during servo rotation, the grating occlusion signal, servo alarm signal, and soft and hard limit signals are monitored in real time, and the servo output is stopped immediately and the alarm is reset when an abnormality occurs.

[0027] Furthermore, if the grating is blocked, the servo output will be stopped immediately and an alarm will be triggered; if a servo alarm is detected, a clearing command will be executed automatically, and if the clearing fails more than three times, the machine will stop; if the current pulse value exceeds the soft limit or hard limit setting value, the servo will stop and reverse back; the start signal will be automatically reset after an abnormality or shutdown.

[0028] Furthermore, it also includes the step of adjusting the shooting position by jogging: in jogging mode, the servo stepping rotation is controlled by the touch screen to adjust the angle value corresponding to the shooting position in real time and update the target pulse number synchronously.

[0029] The present invention proposes an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the above-described method.

[0030] The present invention proposes a computer-readable storage medium for storing computer instructions, which, when executed by a processor, implement the steps of the above-described method.

[0031] Taking a visual inspection device for surface defects of a workpiece as an example, the complete implementation process of the configurable servo rotation image acquisition method provided by this invention is described in detail, including the following steps: The hardware used includes: one Siemens S7-1200 series PLC, one V90 servo drive system, one double-sided clamping mechanism, one industrial camera and lens, one light source, one touch screen, and a light grating safety device.

[0032] The software environment is: TIA Portal V16, V-ASSISTANT, MVS.

[0033] First, use V-ASSISTANT software to set the servo parameters; use MVS to configure the camera parameters; and use TIAPortal V16 to write an image acquisition program.

[0034] A "parameter configuration module" is created in the PLC program, and data blocks are used to store configurable parameters. All parameters can be modified in real time by the operator on the touch screen.

[0035] When the PLC program is powered on or the model is switched, it reads configurable parameters from the touch screen or recipe data according to the model number selected on the touch screen and converts them into internal variables. It then converts the angle value of each photo point into the corresponding encoder pulse count value. The converted pulse counts are stored in the array sequentially.

[0036] The robot moves the workpiece to the working position of the dual-sided servo clamping mechanism and sends a "request clamping" signal to the PLC. After the PLC detects the clamping position sensor signal, it controls the solenoid valves of the dual-sided clamping cylinders to clamp the workpiece. After all the clamping position sensor signals turn TRUE, the PLC sends a "clamping complete" signal to the robot. After receiving this signal, the robot retracts to outside the interference zone and sends a "robot has withdrawn" signal to the PLC.

[0037] After receiving the "Robot has withdrawn" signal, the PLC executes the "Positioning Start Trigger" program segment. This program segment performs the following operations: resets the current value of the high-speed counter (sets it to 0); enables the high-speed counter comparison function, writes all target pulse values ​​in the array into the comparison value list of the HSC (high-speed counter); starts the servo, outputs a direction signal, and sends an adjustable frequency pulse signal to the V90 servo through analog signal or PTO (pulse train output), with the pulse frequency corresponding to the set rotation speed; at the same time, it starts the HSC counter to accumulate the encoder feedback pulse in real time.

[0038] During servo rotation, the HSC continuously compares the current pulse value with a preset comparison value. When the current value equals any comparison value, the HSC hardware immediately triggers a hardware interrupt, eliminating the need for CPU scan cycles and achieving microsecond-level response.

[0039] After receiving the trigger signal, the camera completes image acquisition according to preset parameters and transmits the image data to the image processing industrial control computer via Ethernet or USB.

[0040] When the current HSC value reaches the pulse value corresponding to the preset end point position (or the PLC detects that the rotation completion flag is TRUE), the PLC performs the following operations: stops the servo pulse output, the servo motor decelerates and stops; disables the HSC comparison function; sends a "workpiece removal permission" signal to the robot; the robot enters the clamping area, the clamping mechanism releases, and the robot removes the workpiece; one detection cycle ends, and waits for the next workpiece arrival signal.

[0041] During program execution, the following exception handling modules are executed in parallel: Light grating occlusion alarm program: Real-time monitoring of light grating sensor input. If the light grating is obstructed during servo rotation, the servo output is immediately stopped, an alarm message is output, and the robot is prohibited from entering until a reset signal is valid; Servo alarm clearing procedure: Periodically reads the alarm status of the V90 driver. If an alarm is detected, it automatically executes the clearing command and records the alarm code; if clearing fails more than 3 times, it stops the machine and prompts for maintenance. Soft and hard limit protection program: Real-time comparison of the current HSC value with the soft and hard limit settings. If the limit is exceeded, the servo immediately stops and reverses. Automatic start signal reset program: Automatically resets the start signal after any abnormality or shutdown to prevent accidental start.

[0042] This invention aims to solve the technical problems of existing servo rotation image acquisition PLC programs, such as poor versatility, weak adaptability, high development and maintenance costs, long debugging cycles, inability to balance image acquisition speed and accuracy, and susceptibility to data transmission congestion. It enables flexible adaptation to the servo rotation image acquisition needs of different scenarios and devices without modifying the main program, improves the program's versatility and scalability, reduces development, debugging and maintenance costs, and ensures the accuracy and completeness of image acquisition.

[0043] The configurable servo rotation image acquisition method, electronic device, and computer-readable storage medium proposed in this invention have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this invention. Therefore, the content of this specification should not be construed as a limitation of this invention.

Claims

1. A configurable servo rotation image acquisition method, characterized in that, Includes the following steps: Step 1: Configure the model parameters via the touch screen. The model parameters include the number of photos taken, the angle value corresponding to each photo point, the placement point position, the camera trigger delay, the end point position, and the servo rotation speed. Step 2: Convert the angle values ​​corresponding to each shooting point into the encoder target pulse count, and write the target pulse count into the comparison value list of the high-speed counter in sequence; Step 3: Receive the signal that the workpiece is clamped and the robot has withdrawn from the interference zone, reset the current value of the high-speed counter and start servo rotation; Step 4: Acquire encoder feedback pulses in real time, and compare the current pulse value with the target pulse number in the comparison value list using a high-speed counter; Step 5: When the current pulse value equals the target pulse number, an interrupt is triggered by the high-speed counter hardware. The interrupt service routine outputs the camera trigger signal to execute the aerial photography and records the current point index. Step Six: The image acquisition completion status of each photo point is checked sequentially through a loop program. If it is not completed, the program continues to rotate and waits for the next interruption. If the timeout occurs, an alarm is recorded and the current point is skipped. Step 7: Once the image acquisition at all photo points has been confirmed, or when the current value of the high-speed counter reaches the pulse value corresponding to the end point position, stop the servo rotation and send a pick-up permission signal to the robot.

2. The method according to claim 1, characterized in that, In step three, The servo rotation initiation specifically includes: outputting a direction signal and controlling the rotation speed by sending a frequency-adjustable pulse signal to the servo driver, wherein the frequency of the pulse signal is calculated based on the servo rotation speed.

3. The method according to claim 1, characterized in that, In step five, The interrupt is triggered by a high-speed counter hardware, with an interrupt response time in the microsecond range. The current pulse value and timestamp are recorded in the interrupt service routine for debugging purposes.

4. The method according to claim 1, characterized in that, In step six, The loop program is a FOR loop; The specific steps for recording an alarm and skipping the current point if a timeout occurs are as follows: a waiting timer is started for each point. If a successful acquisition signal from the camera is not received within the preset timeout period, an acquisition timeout alarm is recorded and the point is skipped to continue operation.

5. The method according to claim 1, characterized in that, In step seven, The specific steps to stop the servo rotation and send a pick-up permission signal to the robot are as follows: first, stop the pulse output to decelerate the servo, then disable the comparison function of the high-speed counter, and then send a pick-up permission signal to the robot. After the robot enters, the clamping mechanism releases and takes away the workpiece.

6. The method according to claim 1, characterized in that, During servo rotation, the grating occlusion signal, servo alarm signal, and soft and hard limit signals are monitored in real time, and the servo output is stopped immediately and the alarm is triggered to reset when an abnormality occurs.

7. The method according to claim 6, characterized in that, If the grating is blocked, the servo output will stop immediately and an alarm will be triggered; if a servo alarm is detected, a clearing command will be executed automatically, and if the clearing fails more than three times, the machine will stop; if the current pulse value exceeds the soft limit or hard limit setting value, the servo will stop and reverse back; the start signal will be automatically reset after an abnormality or shutdown.

8. The method according to claim 1, characterized in that, It also includes the step of adjusting the shooting position by jogging: in jogging mode, the servo stepping rotation is controlled by the touch screen to adjust the angle value corresponding to the shooting position in real time and update the target pulse number synchronously.

9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1-8.

10. A computer-readable storage medium for storing computer instructions, characterized in that, When the computer instructions are executed by the processor, they implement the steps of the method according to any one of claims 1-8.