Pig automatic immunization injection system based on a sorter and a control method thereof

CN122973166APending Publication Date: 2026-10-27INTELLIGENT EQUIPMENT RESEARCH CENTER BEIJING ACADEMY OF AGRICULTURE AND FORESTRY SCIENCES +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611337773.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-31
Publication Date
2026-10-27

AI Technical Summary

Benefits of technology

通过在分栏器的入口门与出口门之间形成保定区域,并在生猪进入保定区域后控制入口门与出口门关闭,从而在无需人工驱赶或强制固定的情况下实现对单头生猪的自动粗保定,降低了操作人员的劳动强度和人畜接触带来的安全风险;通过设置身份识别装置读取被保定生猪的身份信息,并根据身份信息查询免疫记录确定被保定生猪的免疫状态,从而避免了对已完成免疫接种的生猪进行重复注射,提高了疫苗使用效率并减少了不必要的应激刺激;通过在免疫状态为未免疫时利用视觉伺服相机采集的图像确定被保定生猪体表的注射点位置,从而实现了对生猪背部注射点的自动化识别与精准定位,消除了人工目视寻找注射位置导致的操作误差;通过将注射器安装于机械臂末端,并使机械臂的工作范围覆盖保定区域,控制机械臂驱动注射器移动至注射点位置以执行注射,从而以机械臂替代人工完成注射动作,避免了人工保定和人工注射过程中的操作误差以及人畜交叉感染风险;通过主控计算机分别与入口门、出口门、身份识别装置、视觉伺服相机和机械臂通信连接并统筹控制上述各部件的协同动作,从而将身份核验、注射点定位与注射执行整合为统一控制的自动化流程;通过在注射完成后更新与身份信息关联的免疫记录并控制出口门开启以放行生猪,从而将本次注射结果自动记入免疫档案并使生猪自主离开保定区域,形成了覆盖身份识别、状态判定、注射执行与数据记录的免疫管理流程,提升了群养生猪免疫接种的可追溯性与整体作业效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122973166A_ABST
    Figure CN122973166A_ABST
Patent Text Reader

Abstract

The application provides a pig automatic immunization injection system based on a separator and a control method, and belongs to the technical field of pig breeding. The system comprises a separator, an identity recognition device, a visual servo camera, a mechanical arm, an injector and a main control computer. The separator is provided with an entrance door and an exit door, and a holding area is formed between the two. The main control computer closes the entrance door and the exit door to hold the pig after the pig enters the holding area, determines the immunization state according to the immunization record of the identity information, determines the injection point position according to the image when the pig is not immunized, controls the mechanical arm to drive the injector to complete the injection, updates the immunization record after the injection, and opens the exit door to release the pig. The application uses the natural behavior of the pig passing through the separator independently to complete the closed-loop management of holding, identity verification, injection and data recording, and improves the traceability and overall operation efficiency of the group-raised pig immunization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of pig farming technology, and in particular to an automatic immunization injection system and control method for pigs based on a pen separator. Background Technology

[0002] As the pig farming industry continues to develop towards large-scale and intelligent operations, farms are increasingly demanding traceable management of the entire vaccination process and improved operational efficiency, especially for group-raised commercial pigs with large stock and a large number of immunizations.

[0003] Currently, most existing swine immunization robot solutions use wheeled mobile platforms combined with robotic arms and syringes to inject vaccines into the rump of sows in gestation crates, thereby automating the vaccination process.

[0004] For automated immunization of group-housed pigs, existing solutions fail to systematically address the issues of low-intrusion and low-stress restraint in such environments. Furthermore, they do not consider the reliable location of injection sites for pigs of different ages after restraint, nor do they adequately account for the impact of pig activity after restraint on the injection process. Therefore, current technologies cannot establish a continuous automated vaccination schedule for group-housed pigs, resulting in overall low efficiency in immunization operations. Summary of the Invention

[0005] This invention provides an automated immunization injection system and control method for pigs based on a pen separator, which addresses the deficiencies in the prior art and improves the traceability and overall operational efficiency of immunization in group-raised pigs.

[0006] This invention provides an automated immunization injection system for pigs based on a pen separator, comprising: The components include a column divider, an identification device, a visual servo camera, a robotic arm, a syringe, and a main control computer. The pen separator is equipped with an entrance door and an exit door, and a restraining area for accommodating live pigs is formed between the entrance door and the exit door; The identification device is installed on the pen separator and is used to read the identification information of live pigs located in the Baoding area; The visual servo camera is used to acquire images of live pigs within the Baoding area; The syringe is mounted at the end of the robotic arm, which is mounted on the divider, and the working range of the robotic arm covers the Baoding area; The main control computer is communicatively connected to the entrance gate, the exit gate, the identification device, the visual servo camera, and the robotic arm. The main control computer is used to: control the entrance gate and the exit gate to close after the pig enters the restraint area, thereby restraining the pig within the restraint area; query the immunization record based on the identification information to determine the immunization status of the restrained pig; if the immunization status is not immunized, determine the injection point location on the surface of the restrained pig based on the image, and control the robotic arm to drive the syringe to the injection point location to perform the injection; after the injection is completed, update the immunization record associated with the identification information, and control the exit gate to open to release the pig.

[0007] According to the present invention, an automatic immunization injection system for pigs based on a pen separator is provided. The system further includes a spraying device, which includes a rotating platform and nozzles mounted on the rotating platform. The rotating platform is used to adjust the orientation of the nozzles. The main control computer is also communicatively connected to the spraying device and is used to control the spraying device to spray the area containing the injection point when it is determined from the image that there is dirt on the body surface of the restrained pig.

[0008] This invention also provides an automatic immunization injection control method for pigs based on a pen separator, applied to a main control computer. The main control computer is communicatively connected to the entrance and exit gates of the pen separator, an identification device, a visual servo camera, and a robotic arm with a syringe installed at its end. A restraining area for accommodating pigs is formed between the entrance and exit gates. The method includes: When a live pig is detected entering the restraining area, the entrance gate and the exit gate are controlled to be closed in order to restrain the live pig within the restraining area; Obtain the identity information of the detained pigs read by the identity recognition device; The immunization record is queried based on the identity information to determine the immunization status of the pigs in Baoding; When the immune status is non-immunized, the image of the restrained pig captured by the visual servo camera is acquired, and the injection point location on the body surface of the restrained pig is determined based on the image. The robotic arm is controlled to drive the syringe to the injection point to perform the injection. After the injection is completed, the immunization record associated with the identity information is updated, and the exit gate is opened to release the pigs.

[0009] According to the present invention, an automatic immunization injection control method for pigs based on a pen separator is provided, wherein the image includes mutually aligned color images and depth images; the step of determining the injection point location on the body surface of the restrained pig based on the image includes: The color image is segmented to obtain a mask of the restrained pigs; Obtain the horizontal midpoint of each row of pixels in the mask, fit each horizontal midpoint to obtain the back ridge line of the restrained pig; Obtain the contour points on both sides of the mask in the color image that are at the same horizontal level as the target point on the back ridge line; Based on the target point and the two side contour points, two candidate injection points located on both sides of the back ridge line are determined; By combining the depth values ​​corresponding to the candidate injection points in the depth image, the two candidate injection points are transformed to the robot arm base coordinate system; The candidate injection point with the smallest distance between the two transformed candidate injection points and the preset coordinate axis of the robot arm base coordinate system is determined as the injection point location.

[0010] According to the present invention, an automated immunization injection control method for pigs based on a pen separator further includes, before controlling the robotic arm to drive the syringe to move to the injection point position to perform the injection: The system acquires multiple consecutive frames of images of the restrained pigs captured by the visual servo camera, segments each frame, and obtains the mask of the restrained pig in each frame. Calculate the mean value of the cross-union ratio between the masks of adjacent frames within a preset time window, and use the mean value as the movement stability index of the restrained pigs. When the motion stability index reaches a preset stability threshold, the step of controlling the robotic arm to drive the syringe to move to the injection point position to perform the injection is executed.

[0011] The automatic immunization injection control method for pigs based on a pen separator provided by the present invention further includes: Based on the temporal features extracted from the consecutive multi-frame images, the movement stability index of the restrained pigs in the future period is predicted. Based on the predicted motion stability index, the stabilization time window for the restrained pigs is determined. Before the arrival of the stabilization time window, the robotic arm is controlled to move to a preparatory position at a preset distance from the injection point position; After entering the stable time window, the robotic arm is controlled to drive the syringe from the preparatory position to the injection point position to perform the injection.

[0012] According to the present invention, an automated immunization injection control method for pigs based on a pen separator is provided, wherein controlling the robotic arm to drive the syringe to move to the injection point position to perform the injection includes: Control the robotic arm to move to a coarse positioning position that is a first preset distance away from the injection point; Obtain point cloud data within the neighborhood of the injection point location, perform plane fitting on the point cloud data to obtain the normal vector of the pig's body surface at the injection point location, and adjust the end posture of the robotic arm to align the axis of the syringe with the normal vector. The syringe is controlled to move linearly along the axis toward the injection point to trigger the injection.

[0013] The automatic immunization injection control method for pigs based on a pen separator provided by the present invention further includes: During the adjustment of the end posture and the linear motion, the displacement of the restrained pig in the future time period is predicted in real time. If the robotic arm is adjusting the end effector posture and the displacement exceeds a preset displacement threshold, then the robotic arm is controlled to pause its movement and maintain the current posture. If the syringe is in the process of linear motion and the displacement exceeds the preset displacement threshold, then the robotic arm is controlled to retract to a position at a preset safe distance from the pig's body surface. After the pigs in Baoding have stabilized, the robotic arm is controlled to continue the interrupted injection process; if the cumulative time since the start of the injection process exceeds a preset time, the injection is terminated.

[0014] According to the present invention, an automatic immunization injection control method for pigs based on a pen separator is provided, wherein a force sensor is provided at the end of the robotic arm; the method further includes: During the linear motion, the force value along the axial direction of the syringe is acquired by the force sensor; When the force value exceeds the preset force threshold, the robotic arm is controlled to stop the linear motion and retract.

[0015] According to the present invention, an automatic immunization injection control method for pigs based on a pen separator is provided, wherein the main control computer is also communicatively connected to a spraying device; the method of controlling the inlet gate and the outlet gate to be closed to restrain the pigs within the restraining area includes: When a live pig is detected entering the Baoding area, the entrance gate is controlled to close. The visual servo camera captures images of the Baoding area, and the number of pigs in the Baoding area is determined based on the images. If the number is greater than one, the exit gate is opened and the spraying device is sprayed to drive away the pigs in the Baoding area until the number of pigs in the Baoding area is one. If the quantity is one, then the exit gate is closed to restrain a single pig within the restraint area; The method further includes: The surface condition of the restrained pigs is determined based on the images; When the body surface is dirty, the area to be cleaned is determined based on the location of the injection point, the spraying device is controlled to adjust the nozzle direction to spray the area to be cleaned, and after spraying, the exit gate is controlled to open to release the pigs.

[0016] In summary, one or more technical solutions provided in the embodiments of this application have at least the following technical effects or advantages: By creating a restraint zone between the entrance and exit gates of the pen separator, and controlling the closure of the entrance and exit gates after the pigs enter the restraint zone, automatic coarse restraint of individual pigs is achieved without manual driving or forced fixation, reducing the labor intensity of operators and the safety risks associated with human-animal contact. An identification device reads the identity information of the restrained pigs and checks their immunization records to determine their immunization status, thus avoiding duplicate injections of already immunized pigs, improving vaccine utilization efficiency and reducing unnecessary stress. By using images captured by a visual servo camera when the immunization status is not yet immunized to determine the injection point location on the pig's body surface, automated identification and precise positioning of injection points on the pig's back are achieved, eliminating operational errors caused by manual visual searching for injection sites. The syringe is mounted at the end of the robotic arm. The system extends the working range of the robotic arm to cover the restraint area, controlling the robotic arm to move the syringe to the injection point to perform the injection. This replaces manual injection, avoiding operational errors and the risk of cross-infection between humans and animals during manual restraint and injection. The main control computer communicates and controls the entrance gate, exit gate, identification device, visual servo camera, and robotic arm, integrating the coordinated actions of these components. This unifies identification verification, injection point location, and injection execution into a unified, automated process. After injection, the system updates the immunization record associated with the pig's identity information and controls the exit gate to open and release the pig. This automatically records the injection result in the immunization file and allows the pig to leave the restraint area autonomously. This forms an immunization management process covering identification, status determination, injection execution, and data recording, improving the traceability and overall efficiency of immunization for group-raised pigs. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in this 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 some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0018] Figure 1 This is a schematic diagram of the automatic immunization injection system for pigs based on a pen divider provided by the present invention.

[0019] Figure 2 This is a schematic diagram of the communication structure provided by the present invention.

[0020] Figure 3 This is a flowchart illustrating the automatic immunization injection control method for pigs based on a pen separator provided by the present invention. Detailed Implementation

[0021] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0022] It should be noted that in the description of this invention, the terms "comprising," "including," or any other variations thereof are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element. The terms "upper," "lower," etc., indicating orientation or positional relationships according to the accompanying drawings, are only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the system or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the invention. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.

[0023] The terms "first," "second," etc., used in this invention are used to distinguish similar objects, not to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class, without limiting the number of objects; for example, a first object can be one or more. Furthermore, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0024] The following is combined with Figures 1 to 3 This invention describes the automatic immunization injection system and control method for pigs based on a pen divider.

[0025] Firstly, this embodiment provides an automated immunization injection system for pigs based on a pen divider. (Refer to...) Figure 1 , Figure 1 This is a schematic diagram of the automatic immunization injection system for pigs based on a pen divider provided by the present invention.

[0026] An automated immunization injection system for pigs based on a pen separator includes a main control computer, a pen separator, an identification device, a visual servo camera, a robotic arm, syringes, and a spraying device. The pen separator, as the basic unit of the entire system, has an entrance gate and an exit gate, forming a restraint area to accommodate the pigs. Pig restraint refers to keeping pigs quiet and fixed during operations such as blood collection, injection, examination, or surgery using specific methods. Therefore, the restraint area is the area where the pig's movement is controlled, keeping the pig fixed during the operation.

[0027] The main control computer is communicatively connected to the entrance gate, exit gate, identification recognition device, visual servo camera, robotic arm, and sprinkler system. In one possible implementation, refer to... Figure 2 , Figure 2 This is a schematic diagram of the communication structure provided by the present invention. The main control computer is connected to the entrance gate, exit gate, identification device, and sprinkler system via RS485 communication; the main control computer is connected to the visual servo camera via USB communication; the main control computer is connected to the robotic arm via Ethernet communication; and the robotic arm is connected to the syringe via RS485 communication.

[0028] The pen separator fully utilizes the existing fixed passageway facilities in large-scale pig houses, seamlessly integrating the immunization process into the natural behavioral flow of group-housed pigs as they autonomously move back and forth through the pen separator due to physiological needs such as feeding and drinking. Driven by physiological needs, pigs voluntarily enter the pen separator without the need for manual herding or forced restraint, fundamentally reducing stress responses caused by human intervention.

[0029] The identification device is installed on the pen separator and reads the identification information of pigs located within the Baoding area. The identification device is an RFID reader, which reads the unique individual identification information stored in the pig's ear tag in a non-contact manner to achieve individual identification and tracking of each pig.

[0030] The robotic arm is a six-degree-of-freedom (DOF) robotic arm, and the visual servoing camera, together with the six-DOF robotic arm, constitutes an eye-on-hand visual servoing system. Existing needle-free immunization robots generally adopt an eye-on-hand visual servoing solution, where the camera is directly mounted on the end of the robotic arm, and the camera moves synchronously with the end of the robotic arm. This results in a limited field of view when the robotic arm is close to the pig's back, and the vibration of the robotic arm severely affects the image acquisition quality. In contrast to the eye-on-hand visual servoing solution, this embodiment independently and fixedly mounts the visual servoing camera on the exit side of the sorting device, providing a global overhead view covering the entire Baoding area.

[0031] The fixed-mounted visual servo camera has two core functions. The first is to acquire images of pigs within the Baoding area to control the six-degree-of-freedom robotic arm. The main control computer determines the injection point location on the pig's body surface based on the images acquired by the visual servo camera and guides the six-degree-of-freedom robotic arm carrying the syringe to the injection point. The second core function is to acquire images of pigs within the Baoding area to identify their movement status. The main control computer dynamically monitors the pig's movement behavior based on the continuously acquired image stream from the visual servo camera and determines whether the pig is in a stable state suitable for injection.

[0032] The syringe is mounted at the end of a six-degree-of-freedom (DOF) robotic arm, which is positioned on a pen separator. The robotic arm's working range covers the restraint area. The syringe is a veterinary electric needle-free injector, equipped with a proximity switch at its end. When the injector contacts the pig's skin and is further advanced, triggering the proximity switch, the injection is automatically initiated. After the injection process is complete, the injection result is fed back to the main control computer. The end of the six-degree-of-freedom robotic arm integrates a six-dimensional force sensor. Combined with an eye-to-hand visual servo system, the main control computer can precisely control the contact angle and pressure between the veterinary electric needle-free injector and the injection point.

[0033] The main control computer, as the central control unit of the entire system, is responsible for key functions such as real-time path planning and motion control of the robotic arm, identification and calculation of injection points on the back of pigs, monitoring of the stability of pig movement, determination of the pig's body surface status, overall management of the opening and closing control of the entrance and exit gates of the pen separator, determination and management of pig immunization registration based on the immunization record database, issuance of immunization injection instructions, and comprehensive determination of pig location and quantity.

[0034] Furthermore, after the pigs enter the designated area, the main control computer closes the entrance and exit gates to restrain them within the designated area. Subsequently, the main control computer queries the immunization record database based on the identification information read by the identification device to determine the immunization status of the restrained pigs. The immunization record database stores the historical immunization information for each pig, with each record containing the pig's unique identifier, vaccine type, vaccination time, and vaccination result.

[0035] When the pig is not immunized, the main control computer determines the injection point location on the surface of the restrained pig's body based on images captured by a visual servo camera, and controls the robotic arm to move the syringe to the injection point to perform the injection. After the injection, the main control computer updates the immunization record associated with the pig's identity information, writes the vaccination result to the immunization record database, and controls the exit gate to open to release the pig. When the pig is immunized, the main control computer directly controls the exit gate to open to release the pig, allowing it to enter the next injection cycle.

[0036] Communication between the main control computer and the robotic arm is relayed through an edge computer, which is responsible for parsing and executing the low-level motion control commands of the robotic arm. The main control computer and the visual servo camera are connected via a high-speed data interface to ensure real-time transmission and processing of the video stream.

[0037] This implementation method uses a pen divider as the basic system carrier, leveraging the natural behavior of group-housed pigs autonomously moving back and forth through the divider due to their physiological needs such as feeding and drinking. The immunization process is embedded into the pigs' daily traffic flow, eliminating the need for additional mobile chassis or specialized equipment, significantly reducing the cost of modifying breeding facilities and minimizing disruption to the existing breeding environment. Simultaneously, through the linkage between RFID identification and the immunization record database, a closed-loop immunization management system covering identification, injection execution, data recording and updating is achieved, forming a traceable immunization record system.

[0038] This embodiment further introduces a spraying device based on the system provided in the aforementioned embodiments. The spraying device includes a rotating platform and nozzles mounted on the rotating platform. The rotating platform is a two-degree-of-freedom rotating platform, capable of adjusting the orientation of the nozzles in both the horizontal and vertical directions, thereby achieving precise spraying coverage of any location within the Baoding area. The spraying device is installed on the top or side wall of the divider, with the nozzles facing the Baoding area. The main control computer is communicatively connected to the spraying device, issuing control commands to the two-degree-of-freedom rotating platform to adjust the nozzle orientation to the target position and trigger the water spraying action.

[0039] Furthermore, since the bodies of group-raised pigs are often covered with feces and other dirt, these dirty areas interfere with visual recognition of the injection points and cause blockage of the nozzle of the veterinary electric needleless injector, affecting the injection effect. Therefore, the main control computer determines the body surface condition of the restrained pigs based on images captured by the visual servo camera.

[0040] When the main control computer determines that the surface of the restrained pig is dirty, it determines the area to be cleaned based on the injection point location. Specifically, using two candidate injection points as centers, a circular area with a radius of 20 pixels is selected as the area to be cleaned. The main control computer controls the spray device to spray the area to be cleaned, including the injection point location, thereby removing the dirt from the injection area and ensuring the accuracy of subsequent injection point identification and smooth drug administration with the veterinary electric needleless injector. After spraying is completed, the main control computer controls the exit gate to open to release the pig. After the pig leaves, the next cycle begins.

[0041] Furthermore, the spraying device also has a herding function. When there are multiple pigs in the Baoding area, the main control computer controls the exit gate to open and controls the spraying device to gently spray the excess pigs in the Baoding area, guiding the excess pigs away from the Baoding area until only one pig remains in the Baoding area. Then, the exit gate is closed to complete the Baoding of the single pig.

[0042] This embodiment introduces a spraying device with a two-degree-of-freedom rotating platform to achieve precise spraying of the target. On the one hand, it solves the problem of interference from dirt on the body surface of group-raised pigs on injection point identification and syringe nozzle blockage. On the other hand, it provides a flexible means of driving away multiple pigs. With one device, it can take care of both cleaning and driving away functions, maintain the smooth flow of the pen separator, and reduce the complexity of the system hardware.

[0043] Secondly, this embodiment provides an automatic immunization injection control method for pigs based on a pen divider.

[0044] The main control computer is the executing entity of this method. The main control computer is communicatively connected to the entrance and exit gates of the pig pen, an identification device, a visual servo camera, and a robotic arm with an end effector equipped with a syringe. A restraining area for accommodating live pigs is formed between the entrance and exit gates. In other embodiments, the executing entity of this method can also be an edge controller or an industrial control computer with equivalent data processing and equipment control capabilities; this embodiment uses the main control computer as the executing entity for explanation.

[0045] Reference Figure 3 , Figure 3 This is a flowchart illustrating the automatic immunization injection control method for pigs based on a pen divider provided by the present invention, which includes steps 110 to 160.

[0046] Step 110: When a live pig is detected entering the restraining area, the entrance and exit gates are closed to restrain the pig within the restraining area.

[0047] Initially, the entrance gate is open and the exit gate is closed, awaiting the entry of pigs. Driven by physiological needs such as feeding and drinking, the group-housed pigs actively enter the restraint area of ​​the pen. The main control computer monitors the restraint area in real time via a visual servo camera. Upon detecting a pig entering the restraint area, it closes the entrance gate while simultaneously keeping the exit gate closed, creating a closed restraint space for coarse restraint of the pigs. The pigs do not require manual herding or forced restraint; they enter the restraint area entirely through natural physiological behavior.

[0048] Step 120: Obtain the identity information of the pigs being protected by the identification device.

[0049] The identification device is an RFID reader. After the pigs enter the Baoding area, the RFID reader automatically scans the pig's ear tag in a non-contact manner, reads the unique identification information of each pig, and uploads the identification information to the main control computer.

[0050] Step 130: Query the immunization records based on the identity information to determine the immunization status of the pigs in Baoding.

[0051] After receiving the identity information, the main control computer queries the immunization record database using the identity information as an index to obtain the historical vaccination records of the pigs for the current vaccine type, and determines whether the pigs are immunized or not. If the pigs are immunized, the main control computer directly controls the exit gate to open to release the pigs and enter the next cycle.

[0052] Step 140: When the immunization status is not immunized, acquire images of the restrained pigs collected by the visual servo camera, and determine the injection point locations on the body surface of the restrained pigs based on the images.

[0053] A visual servo camera captures real-time images of the backs of pigs within the Baoding area from an overhead perspective. The main control computer analyzes and processes the images to locate the injection points on the pigs' bodies. Suitable injection sites include the perineum and anus regions, the tail root regions, and the back regions. This implementation uses the back region as the target injection area for intradermal injection. Intradermal injection has the advantages of requiring less drug, providing better immune response, and minimizing muscle tissue damage.

[0054] Step 150: Control the robotic arm to drive the syringe to the injection point to perform the injection.

[0055] The main control computer sends injection commands to the robotic arm control system. The robotic arm, carrying the syringe, moves along the planned path to the injection point and performs the injection. The syringe is a veterinary electric needleless injector, which administers medication non-invasively, avoiding the risks of needle breakage, cross-infection, and stress caused by puncture pain associated with traditional needle injections. Compared to pneumatic needleless injectors, the veterinary electric needleless injector operates with lower noise, further reducing stress in pigs.

[0056] Step 160: After the injection is completed, update the immunization record associated with the identity information and control the opening of the exit gate to release the pigs.

[0057] After injection, the syringe sends feedback to the main control computer regarding the injection result and remaining injection count. The main control computer associates the identification information of the pig in Baoding with the injection result and stores it in the immunization record database, automatically updating the immunization record to form a complete vaccination record. Subsequently, the main control computer controls the exit gate to open, allowing the injected pig to leave the Baoding area. After the exit gate opens, the entrance gate reopens, and the system enters the next injection cycle.

[0058] This implementation method combines the immunization injection control method with the natural passage behavior of pigs. The main control computer coordinates the opening and closing control of the entrance and exit gates, identity recognition and immunization status query, injection point positioning and robotic arm injection control, immunization record updating and other processes. It forms a complete closed-loop control method covering pig entry, identity verification, injection execution, data recording and pig release. It realizes unmanned automatic immunization management of group-raised pigs, reduces the labor intensity of operators, and eliminates the operational errors and cross-infection risks between humans and animals caused by manual injection.

[0059] Furthermore, this embodiment, based on the aforementioned embodiment, further explains the specific implementation steps of controlling the entrance and exit gates to be closed to restrain pigs within the restraint area, and introduces a spray device to control the driving of multiple pigs.

[0060] The main control computer communicates with the sprinkler system and controls the inlet and outlet gates to be closed to restrain pigs within the restraint area. The steps include: Step 111: When a live pig is detected entering the Baoding area, the entrance gate is closed.

[0061] The main control computer monitors the images at the entrance of the Baoding area in real time through a visual servo camera. When it detects pigs entering the Baoding area, it immediately sends a closing command to the entrance gate controller to close the entrance gate and prevent more pigs from entering. At this time, the exit gate remains closed.

[0062] Step 112: Acquire images of the Baoding area captured by the visual servo camera, and determine the number of pigs in the Baoding area based on the images.

[0063] The main control computer acquires the current frame image of the Baoding area captured by the visual servo camera, inputs the current frame image into the pig individual segmentation artificial intelligence model, the pig individual segmentation artificial intelligence model outputs the instance segmentation results of all pig individuals in the Baoding area, and the main control computer counts the number of pig individuals in the instance segmentation results to obtain the current number of pigs in the Baoding area.

[0064] Step 113: If the number is greater than one, control the exit gate to open and control the spraying device to spray and drive the pigs in the Baoding area until the number of pigs in the Baoding area is one; if the number is one, control the exit gate to close, so as to keep the single pig in the Baoding area.

[0065] When the main control computer detects that the number of pigs in the Baoding area is greater than one, it controls the exit gate to open and simultaneously issues control commands to the two-degree-of-freedom rotating platform of the spraying device. This adjusts the nozzles to face the backs or rumps of the pigs, gently spraying the multiple pigs in the Baoding area and guiding the excess pigs towards the exit gate and away from the Baoding area. The main control computer continuously updates the number of pigs in the Baoding area during the spraying process until the number of pigs in the Baoding area is reduced to one.

[0066] When the main control computer detects that there is only one pig in the designated area, it sends a closing command to the exit gate controller to close the exit gate, thereby securing the single pig independently within the designated area and providing stable single-pig restraint conditions for subsequent identification and injection operations.

[0067] This implementation method combines closing the entrance gate, visual recognition of the number of pigs, and spraying to drive them away, thus constructing an automated handling process when multiple pigs enter the restraint area at the same time. It realizes the automated transition from multiple pigs entering to the effective restraint of a single pig, ensuring that subsequent identification and injection operations are carried out under single-pig restraint conditions, and eliminating the risk of injection errors or omissions when multiple pigs are present at the same time.

[0068] Furthermore, this embodiment, based on the aforementioned embodiment, further explains the specific implementation method of determining the injection point location on the body surface of the restrained pig based on the image.

[0069] The images acquired by the visual servo camera include mutually aligned color and depth images. The color and depth images are aligned at the pixel level to ensure a one-to-one spatial correspondence between each pixel in the color image and its corresponding pixel in the depth image. Step 140, which involves determining the injection point locations on the surface of the restrained pig based on the images, includes: Step 141: Perform instance segmentation on the color image to obtain the mask of the pigs being restrained.

[0070] The main control computer constructs an artificial intelligence model for individual pig segmentation based on a lightweight instance segmentation artificial intelligence model, and deploys the individual pig segmentation artificial intelligence model on the main control computer for real-time inference.

[0071] The artificial intelligence model for individual pig segmentation is based on the YOLO11-seg architecture. YOLO11-seg uses a lightweight backbone network to extract multi-scale features from color images, aggregates the multi-scale features through a neck feature fusion network, and outputs target detection boxes and segmentation masks through the detection head.

[0072] The training dataset for the artificial intelligence model for individual pig segmentation includes images of pigs of different body sizes, postures, and surface conditions within the sorting grid. The training annotation categories include three types: pigs with dirty surfaces, standing pigs, and lying pigs.

[0073] The training process employs data augmentation strategies such as random horizontal flipping, random adjustment of brightness and contrast, and random cropping. The optimizer used for training is the SGD optimizer, with an initial learning rate of 0.01, a batch size of 16, and 300 training epochs. The loss functions include classification loss, bounding box regression loss, and segmentation mask loss.

[0074] The main control computer inputs the current frame color image into the pig individual segmentation artificial intelligence model. The pig individual segmentation artificial intelligence model outputs the set of pixel mask regions of the restrained pig in the color image. The set of pixel mask regions is the mask of the restrained pig.

[0075] Step 142: Obtain the horizontal midpoint of each row of pixels in the mask, fit each horizontal midpoint to obtain the back ridge line of the restrained pig.

[0076] The main control computer iterates through each row of pixels in the mask of the restrained pigs, obtaining the coordinates of the leftmost and rightmost pixels in each row, and calculating the horizontal midpoint coordinates of these two pixels to obtain the corresponding horizontal midpoint for each row. The set of horizontal midpoint coordinates for all rows is then fitted using a polynomial fitting method to obtain a curve. The fitted curve is defined as the back ridge line of the restrained pig, which represents the central axis of the pig's back in the image coordinate system.

[0077] Step 143: Obtain the contour points on both sides of the mask in the color image that are in the same horizontal row as the target point on the back ridge.

[0078] The main control computer takes the midpoint of the spine as the target point, and the coordinates of the target point in the image coordinate system are: The main control computer acquires the contour points on both sides of the mask in the color image that are at the same horizontal level as the target point. The left contour point is denoted as... The right contour point is denoted as ,in This represents the x-coordinate of the leftmost pixel in the mask row. This is the x-coordinate of the rightmost pixel in the mask row.

[0079] Step 144: Based on the target point and the contour points on both sides, determine two candidate injection points located on both sides of the back ridge line.

[0080] The main control computer calculates the coordinates of two candidate injection points in the image coordinate system based on the target point and the contour points on both sides. (Left candidate injection point) The x-coordinate is taken as the average of the x-coordinates of the left contour point and the target point, and the right candidate injection point... The x-coordinate is taken as the average of the x-coordinates of the right contour point and the target point. The y-coordinates of the two candidate injection points are the same as those of the target point. The formula for calculating the coordinates of the candidate injection points is: ; The aforementioned candidate injection sites are located symmetrically on both sides of the spine on the back of the pig, avoiding the vertebral bones, and selecting areas with abundant muscle tissue, which are suitable for intradermal injection.

[0081] Step 145: Combine the depth values ​​corresponding to the candidate injection points in the depth image to transform the two candidate injection points to the robot arm base coordinate system.

[0082] The main control computer acquires candidate injection points from the depth image. and Depth value at corresponding location and By combining the intrinsic parameter matrix of the visual servoing camera, the candidate injection points are transformed from the image coordinate system to the camera coordinate system, resulting in their 3D coordinates in the camera coordinate system. ; Subsequently, the main control computer uses the robotic arm's built-in software development kit to obtain the current pose of the robotic arm's end effector, and combines it with the pre-calibrated hand-eye calibration matrix. Transform the candidate injection points from the camera coordinate system to the robot arm base coordinate system to obtain the three-dimensional coordinates in the robot arm base coordinate system: ; Step 146: Determine the injection point position as the candidate injection point with the smallest distance between the two transformed candidate injection points and the preset coordinate axis of the robot arm base coordinate system.

[0083] The main control computer compares two candidate injection sites. and The distance from the preset coordinate axes of the robot arm's base coordinate system, where the preset coordinate axes are the distance from the robot arm's base coordinate system. Y Axis. The main control computer calculates separately. and Y Distance of axis as well as and Y Distance of axis The candidate injection point with the smallest distance is selected as the final injection point position. The reason for selecting the candidate injection point with the smallest distance from the preset coordinate axis is that the candidate injection point corresponds to a workspace position with lower kinematic singularity of the robotic arm, which is conducive to the robotic arm completing the injection action with a better joint configuration, thereby improving motion accuracy and stability.

[0084] This implementation extracts the contour points on both sides of the row containing the midpoint of the spine of the pig mask in the color image, and combines this with the depth image to complete the three-dimensional coordinate transformation from the image coordinate system to the robot arm's base coordinate system, achieving dynamic and precise three-dimensional positioning of the injection point on the pig's back. Without manual marking, the system can automatically extract the optimal safe injection point located in the muscle-rich areas on both sides of the spine when the pig is standing irregularly, providing a reliable three-dimensional coordinate basis for the subsequent precise vertical injection by the robot arm.

[0085] Furthermore, this embodiment, based on the aforementioned embodiment, further explains how to monitor the movement stability of the restrained pig before controlling the robotic arm to drive the syringe to the injection point position to perform the injection. Before controlling the robotic arm to drive the syringe to the injection point position to perform the injection, the main control computer also performs the following steps: Step 210: Acquire multiple consecutive frames of images of the restrained pigs captured by the visual servo camera, segment each frame, and obtain the mask of the restrained pig in each frame.

[0086] The main control computer samples keyframes from the video stream output by the visual servo camera at a 1-second interval, meaning one frame is captured every 1 second as a keyframe. The main control computer inputs each keyframe image into the pig individual segmentation AI model, which outputs a mask of the restrained pig in that frame image, resulting in a mask sequence of restrained pigs in multiple consecutive frames.

[0087] Step 220: Calculate the mean value of the cross-union ratio between the masks of adjacent frames within the preset time window, and use the mean value as the motion stability index of the restrained pigs.

[0088] The preset time window is 3 seconds long. The main control computer acquires 3 keyframe images within the preset time window, obtaining 3 mask frames. The main control computer calculates the cross-union ratio (CUI) between each pair of adjacent mask frames within the preset time window. The CUI is calculated by dividing the pixel intersection area of ​​the two mask frames by the pixel union area of ​​the two mask frames. The main control computer uses the average CUI of all adjacent mask frames within the preset time window as the motion stability index (MSI) of the restrained pigs. The formula for calculating the Motion Stability Index (MSI) is: ; in, N Δ is the number of adjacent frame pairs within a preset time window. t The time interval between adjacent frames. For the first The image frames captured at different times are masked by the Baoding pigs. For the first The image frames acquired at different times contain masks of the restrained pigs. IoU(·,·) is the cross-union ratio calculation function between two mask frames. The Motion Stability Index (MSI) ranges from 0 to 1. A higher MSI value indicates more stable movement of the restrained pig. When the restrained pig is stationary, the MSI is close to 1; when the restrained pig experiences violent shaking, the MSI is below 0.4. The preset stability threshold is determined based on professional veterinary experience and the results of manual injection tests.

[0089] Step 230: When the motion stability index reaches the preset stability threshold, execute the step of controlling the robotic arm to drive the syringe to move to the injection point to perform the injection.

[0090] The main control computer continuously calculates the Motion Stability Index (MSI) of the restrained pigs. When the MSI reaches a preset stability threshold, the pigs are determined to be in a stable state suitable for injection, and the main control computer sends an injection command to the robotic arm control system, triggering the injection action. When the MSI falls below the preset stability threshold, the main control computer waits and updates the MSI without triggering the injection action.

[0091] This implementation establishes an objective method for monitoring the movement status of restrained pigs by constructing a Motion Stability Index (MSI) based on the mean cross-joint ratio of continuous frame masks. By triggering the injection action only when the MSI reaches a preset stability threshold, it effectively addresses the interference of uncontrollable behaviors such as twisting and lying down in the pen separator channel of group-housed pigs on the injection operation, reduces the risk of injection failure or accidental injury to pigs by the robotic arm due to pig movement, and improves injection accuracy and operational safety.

[0092] Furthermore, this embodiment, based on the aforementioned embodiments, further explains how to shorten the total injection time by controlling the robotic arm to position itself in advance based on timing prediction. This embodiment also includes the following steps: Step 310: Based on the temporal features extracted from consecutive multi-frame images, predict the movement stability index of the restrained pigs in the future period.

[0093] Specifically, the main control computer first constructs an artificial intelligence model for predicting the temporal stability of pig movement based on a long short-term memory neural network.

[0094] The input layer of the long short-term memory neural network receives a temporal feature vector with the motion stability index sequence of historical frames as its core. The temporal feature vector also includes auxiliary temporal features such as the displacement of the centroid of the pig mask and the rate of change of the mask area extracted from multiple consecutive frames of images.

[0095] The Long Short-Term Memory (LSTM) neural network consists of two LSM layers. The first LSM layer has a hidden state dimension of 128, and the second LSM layer has a hidden state dimension of 64. A Dropout layer with a dropout rate of 0.2 is placed between the two LSM layers to prevent overfitting. The output of the second LSM layer is mapped to the prediction output through a fully connected layer, and the output dimension of the fully connected layer corresponds to the number of future prediction frames.

[0096] The training data for the artificial intelligence model for predicting the temporal stability of pig movement based on long short-term memory neural network comes from the historical data of pig movement actually collected in the pen separator. The input sequence length during training is 15 frames, corresponding to a duration of 15 seconds. The prediction target is the movement stability index at each moment in the next 30 frames, i.e., the next 30 seconds.

[0097] The training optimizer is the Adam optimizer, with an initial learning rate set to 0.001 and a mean squared error loss function. The main control computer uses the temporal features of the motion stability index from the 15 frames prior to the current moment as input. Through an artificial intelligence model for predicting the temporal prediction of pig motion stability based on a long short-term memory neural network, it predicts the motion stability index of the restrained pigs at various moments in the future.

[0098] In other implementations, the temporal prediction AI model can also be constructed using a temporal Transformer model or a gated recurrent unit network, by adjusting the number of network layers, hidden dimensions, and training parameters accordingly.

[0099] Step 320: Determine the stabilization time window for the restrained pigs based on the predicted motion stability index.

[0100] Based on the predicted motion stability index sequence for each future moment, the main control computer identifies continuous periods in which the motion stability index consistently meets a preset stability threshold, and defines these continuous periods as the stable time window for the restrained pigs. The starting time of the stable time window is the moment when the motion stability index in the predicted sequence first reaches and remains above the preset stability threshold.

[0101] Step 330: Before the stabilization time window arrives, control the robotic arm to move to a preparatory position at a preset distance from the injection point.

[0102] Before the stabilization time window arrives, the main control computer sends a coarse positioning command to the robotic arm control system in advance, controlling the robotic arm to move the syringe to a preparatory position at a preset distance above the injection point. This process corresponds to the first stage of injection control, namely the coarse positioning stage.

[0103] By starting the first stage of movement in advance, the movement time of the robotic arm is parallelized with the time for the pigs to stabilize. When the pigs enter the stabilization window, the robotic arm is already in the ready position, thus significantly shortening the total injection time.

[0104] Step 340: After entering the stable time window, control the robotic arm to drive the syringe from the preparatory position to the injection point position to perform the injection.

[0105] When the measured motion stability index (MSI) enters the stable time window, the main control computer triggers the robotic arm to continue the precise alignment and rapid injection phase from the preparatory position, controlling the robotic arm to drive the syringe from the preparatory position to the injection point to complete the injection.

[0106] This implementation method introduces a time-series prediction method based on long short-term memory neural networks to predict the motion stability time window of the restrained pigs in advance, and uses the prediction results to start the first stage of coarse positioning of the robotic arm in advance. The preparation time of the robotic arm and the stability waiting time are parallelized. When the restrained pigs enter the stability time window, the robotic arm has already completed the pre-positioning, thereby significantly shortening the overall injection time and improving the system's operating efficiency.

[0107] Furthermore, this embodiment, based on the aforementioned embodiments, further describes the specific implementation of the three-stage vertical injection control method for controlling the robotic arm to drive the syringe to the injection point position to perform the injection. The steps of controlling the robotic arm to drive the syringe to the injection point position to perform the injection include: Step 151: Control the robotic arm to move to a coarse positioning position that is a first preset distance away from the injection point.

[0108] After identifying the injection point location on the back of the pig being controlled, the main control computer calculates the target value of the joint angle required for the end of the robotic arm to reach the coarse positioning position, and sends a motion command to the robotic arm control system to control the robotic arm to move along the planned path to the coarse positioning position at the first preset distance directly above the injection point location.

[0109] The first preset distance is set to 20cm, meaning the robotic arm's end effector stops 20cm vertically from the injection point during the coarse positioning phase. During this phase, the robotic arm moves rapidly based on the known injection point coordinates to reduce overall injection time.

[0110] Step 152: Obtain point cloud data within the neighborhood of the injection point location, perform planar fitting on the point cloud data to obtain the normal vector of the pig's body surface at the injection point location, and adjust the end-effector posture of the robotic arm to align the syringe axis with the normal vector.

[0111] The main control computer then retrieves the latest depth image captured by the visual servo camera and extracts all the 3D point cloud data within a circular neighborhood with a radius of 10 pixels centered on the injection point.

[0112] The main control computer uses the least squares method to perform plane fitting on the acquired point cloud data, fitting a local tangent plane on the pig's back surface at the injection point location, and calculating the normal vector of the local tangent plane. Next, a rotation matrix transformation is used to transform the normal vector from the camera coordinate system to the robot arm's base coordinate system, obtaining the target posture of the robot arm's end effector during the injection action, ensuring that the syringe axis is perpendicularly aligned with the normal vector on the pig's body surface at the injection point.

[0113] The main control computer updates the target position of the robotic arm's end effector to 20cm above the injection point and sends an attitude adjustment command to the robotic arm control system based on the target posture. This command controls the robotic arm's end effector to adjust its posture while maintaining the vertical distance from the injection point, aligning the syringe axis with the normal vector. This vertical alignment of the syringe axis with the normal vector of the injection point ensures that the direction of drug delivery is perpendicular to the body surface, improving the efficacy of intradermal injection and reducing drug loss.

[0114] Step 153: Control the syringe to move linearly along the axis toward the injection point to trigger the injection.

[0115] The main control computer acquires the latest frame image from the visual servo camera, updates the injection point coordinates, and sends a rapid linear motion command to the robotic arm control system. This commands the syringe to move linearly along its axis towards the injection point until the syringe tip extends 0.2 cm beyond the injection point surface. At this point, the proximity switch at the syringe tip is triggered, and the veterinary electric needleless injector automatically performs the injection, completing the vaccine administration. After injection, the robotic arm control system quickly returns the robotic arm to a safe position, and the main control computer controls the exit gate to open rapidly, allowing the injected pig to leave the Baoding area.

[0116] This implementation method decouples rapid movement from precise posture adjustment through a three-stage control strategy involving coarse positioning, posture adjustment, and rapid injection. While ensuring injection efficiency, it calculates the surface normal vector in real time by fitting the point cloud plane and controls the syringe axis to be perpendicularly aligned with it. This solves the problem of injection angle deviation caused by the curvature of the pig's back and ensures the accuracy of intradermal injection.

[0117] Furthermore, this embodiment, based on the aforementioned embodiments, further explains how to predict the movement trend of the restrained pigs in real time and implement active avoidance and pausing strategies during the injection process. This embodiment also includes the following steps: Step 410: During the process of adjusting the end posture and linear motion, predict the displacement of the restrained pig in the future time period in real time.

[0118] Throughout the entire process of the robotic arm's posture adjustment and rapid injection linear motion phases, the main control computer continuously uses consecutive image frames captured by the visual servo camera as input. It then calls upon an artificial intelligence model based on a long short-term memory neural network to predict the temporal stability of pig movement, predicting the position coordinates of the restrained pigs at various points in the future and calculating the predicted future displacement Δ. P Displacement Δ P Includes the coordinate system of the robotic arm base X Component Δ in the axial direction x and along Y Component Δ in the axial direction y The preset displacement threshold includes X Axial component threshold 20mm and Y The threshold for the axial component is 20mm.

[0119] Step 420: If the robotic arm is adjusting its end effector posture and the displacement exceeds the preset displacement threshold, then control the robotic arm to pause its movement and maintain the current posture.

[0120] During the attitude adjustment phase, if the main control computer detects the predicted future displacement Δ x More than 20mm or Δ yIf the movement exceeds 20mm, it is determined that the restrained pig is about to undergo significant movement. The main control computer immediately sends a pause command to the robotic arm control system. The robotic arm pauses its movement at the current position and maintains its current posture, waiting for the restrained pig's movement trend to return to a safe range before resuming movement. This pause strategy at this stage can prevent the robotic arm from forcibly advancing when the pig is undergoing significant movement, thus avoiding collisions between the syringe and the pig.

[0121] Step 430: If the syringe is in a linear motion and the displacement exceeds the preset displacement threshold, control the robotic arm to retract to a position at a preset safe distance from the pig's body surface.

[0122] During the rapid linear injection phase, the distance between the syringe and the pig's skin has been reduced to the millimeter level. If a large movement occurs at this point, continued injection would damage the pig's skin. Therefore, if the main control computer detects that the predicted future displacement exceeds a preset displacement threshold during the linear motion phase, it immediately sends an emergency retraction command to the robotic arm control system. This command causes the robotic arm to rapidly retract along the syringe axis until the distance between the syringe tip and the pig's skin exceeds a preset safe distance of 5 cm. This prevents hard contact between the syringe and the pig's skin from causing skin damage.

[0123] Step 440: After the pigs in the control room have stabilized, control the robotic arm to continue the interrupted injection process; if the cumulative time since the start of the injection process exceeds the preset time, terminate the current injection.

[0124] After the robotic arm pauses or retracts, the main control computer continuously monitors the Motion Stability Index (MSI). When the MSI recovers to above the preset stability threshold, it determines that the restrained pig has stabilized. The main control computer then controls the robotic arm to restart from the interrupted stage and continue the interrupted injection process. Simultaneously, the main control computer accumulates the total time elapsed from the start of the injection process to the current moment. When the accumulated total time exceeds the preset duration of 60 seconds, the main control computer determines that the injection cannot be completed within the effective time, sends a termination command to the robotic arm control system, and the robotic arm retracts to a safe position. The main control computer records the injection failure and controls the exit gate to open, releasing the restrained pig and entering the next cycle.

[0125] This implementation constructs an active avoidance and pause control strategy based on motion trajectory prediction. It designs two differentiated emergency response mechanisms, namely pause and hold and active retreat, for the posture adjustment phase and the linear motion phase, respectively. Throughout the syringe approach process, it dynamically monitors and actively intervenes in the movement trend of the restrained pig, effectively preventing accidental collisions between the robotic arm and the pig or causing damage to the body surface. At the same time, the timeout termination mechanism ensures that the system will not fall into a deadlock state due to abnormal pig behavior, significantly improving the active safety of the injection operation.

[0126] Furthermore, this embodiment further explains the method of achieving force-position coordinated stress suppression using an end force sensor, based on the aforementioned embodiment.

[0127] The robotic arm's end effector is equipped with a force sensor, specifically a six-dimensional force sensor with a force measurement resolution of 0.1 N. This embodiment also includes the following steps: Step 510: During the linear motion, acquire the force value along the axis of the syringe collected by the force sensor.

[0128] During the linear motion phase of the syringe, the main control computer continuously reads the six-dimensional force and torque data output by the six-dimensional force sensor at a high frequency, and extracts the data along the syringe axis, i.e., the end effector of the robotic arm, from the output data of the six-dimensional force sensor. Z The force value in the axial direction reflects the actual contact force between the syringe tip and the pig's body surface.

[0129] Step 520: When the force exceeds the preset force threshold, control the robotic arm to stop linear motion and retract.

[0130] The main control computer will acquire in real time Z The axial force value is compared with a preset force threshold, which is set to -5N. Z When the axial force exceeds -5N, it indicates that the syringe tip is applying pressure beyond the safe range to the pig's body surface. The main control computer immediately sends a stop command to the robotic arm control system. The robotic arm immediately stops its linear movement and quickly retracts to a safe position along the syringe axis to prevent the syringe from causing excessive squeezing damage to the pig's body surface and triggering an excessive stress response.

[0131] The real-time force feedback from the six-dimensional force sensor forms the last line of defense for injection safety control. Even if the visual prediction and positioning correction in the preceding stage fails to completely eliminate the movement error of the restrained pig, the force protection can still ensure the safety of the injection operation at the physical contact level.

[0132] This embodiment integrates a six-dimensional force sensor at the end of the robotic arm and sets... Z The axial force threshold establishes a safety protection mechanism based on physical contact force feedback during the linear motion phase. This mechanism can effectively prevent excessive pressure from the syringe on the pig's body surface even when there are deviations or delays in visual perception, ensuring the safety of the injection operation and reducing the risk of excessive stress response in pigs caused by mechanical contact.

[0133] Furthermore, this embodiment, based on the aforementioned embodiments, further explains the specific implementation method of determining the surface condition of the restrained pig based on the image and performing target spray cleaning. This embodiment also includes the following steps: Step 610: Determine the surface condition of the restrained pigs based on the image.

[0134] After the main control computer completes the restraint of a single pig, it acquires the current frame color image captured by the visual servo camera, inputs the current frame color image into the individual pig segmentation artificial intelligence model, and the individual pig segmentation artificial intelligence model outputs the instance segmentation result and body surface state classification result of the restrained pig.

[0135] The artificial intelligence model for individual pig segmentation categorizes pigs into three types: those with dirty skin, standing pigs, and lying pigs. The main control computer determines whether a restrained pig's skin condition is dirty or normal based on the classification results. A dirty skin condition refers to the area on the pig's back to be injected being covered with feces and other contaminants. This dirt interferes with visual recognition of the injection point and the effectiveness of the veterinary electric needleless injector.

[0136] Step 620: When the body surface is dirty, determine the area to be cleaned based on the injection point location, control the spray device to adjust the nozzles to spray the area to be cleaned, and control the exit gate to open after spraying to release the pigs.

[0137] When the main control computer determines that the surface of the pig being restrained is dirty, it first obtains the image coordinates of two candidate injection points according to the injection point positioning method. Taking the two candidate injection points as the center, a circular area with a radius of 20 pixels is taken in the image coordinate system. The union of the two circular areas constitutes the area to be cleaned.

[0138] The main control computer combines the image coordinates of the area to be cleaned with the depth image and the hand-eye calibration matrix to transform them into the physical coordinate system, obtaining the three-dimensional spatial coordinates of the area to be cleaned. Subsequently, the main control computer issues control commands to the two-degree-of-freedom rotation platform of the spray device, driving the platform to adjust the nozzle orientation in both the horizontal and vertical directions, aligning the nozzles with the corresponding three-dimensional spatial position of the area to be cleaned. This controls the spray device to perform a spray cleaning operation on the area to be cleaned, removing dirt from the area to be cleaned.

[0139] After the spray cleaning is completed, the main control computer opens the exit gate to release the restrained pigs. After being released, the pigs continue to the feeding area or return to the resting area. The system does not administer injections to pigs that have been sprayed and released. The pigs' body condition is reassessed when they pass through the pen separator again. If their body condition has returned to normal, the injection is then administered.

[0140] When the main control computer determines that the body surface condition of the restrained pig is normal, the main control computer enters the subsequent motion stability monitoring and injection control process and executes the normal immunization injection operation.

[0141] This implementation method uses real-time assessment of the surface condition of the restrained pigs to accurately determine the area to be cleaned based on candidate injection points when dirt is detected. It then controls a two-degree-of-freedom rotating platform to guide the nozzle to spray the area to be cleaned in a targeted manner, thus removing dirt that affects injection quality. This eliminates the interference of surface dirt on the visual recognition accuracy of injection points and the risk of clogging the nozzle of the veterinary electric needleless injector, effectively improving the success rate of injection and the accuracy of drug administration.

[0142] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. An automated immunization injection system for pigs based on a pen separator, characterized in that, include: The components include a column divider, an identification device, a visual servo camera, a robotic arm, a syringe, and a main control computer. The pen separator is equipped with an entrance door and an exit door, and a restraining area for accommodating live pigs is formed between the entrance door and the exit door; The identification device is installed on the pen separator and is used to read the identification information of live pigs located in the Baoding area; The visual servo camera is used to acquire images of live pigs within the Baoding area; The syringe is mounted at the end of the robotic arm, which is mounted on the divider, and the working range of the robotic arm covers the Baoding area; The main control computer is communicatively connected to the entrance gate, the exit gate, the identification device, the visual servo camera, and the robotic arm; the main control computer is used to: control the entrance gate and the exit gate to close after the pigs enter the restraining area, so as to restrain the pigs within the restraining area; The immunization record is queried based on the identity information to determine the immunization status of the pigs in Baoding; When the immunization status is not immunized, the injection point location on the body surface of the restrained pig is determined according to the image, and the robotic arm is controlled to drive the syringe to move to the injection point location to perform the injection; after the injection is completed, the immunization record associated with the identity information is updated, and the exit gate is controlled to open to release the pig.

2. The system according to claim 1, characterized in that, The system also includes a spraying device, which includes a rotating platform and nozzles mounted on the rotating platform. The rotating platform is used to adjust the orientation of the nozzles. The main control computer is also communicatively connected to the spraying device and is used to control the spraying device to spray the area containing the injection point when it is determined from the image that there is dirt on the body surface of the restrained pig.

3. A method for controlling automated immunization injection in pigs based on a pen separator, characterized in that, The method is applied to a main control computer, which is communicatively connected to the entrance and exit gates of the pig pen, an identification device, a visual servo camera, and a robotic arm with a syringe installed at its end. A restraining area for accommodating live pigs is formed between the entrance and exit gates. The method includes: When a live pig is detected entering the restraining area, the entrance gate and the exit gate are controlled to be closed in order to restrain the live pig within the restraining area; Obtain the identity information of the detained pigs read by the identity recognition device; The immunization record is queried based on the identity information to determine the immunization status of the pigs in Baoding; When the immune status is non-immunized, the image of the restrained pig captured by the visual servo camera is acquired, and the injection point location on the body surface of the restrained pig is determined based on the image. The robotic arm is controlled to drive the syringe to the injection point to perform the injection. After the injection is completed, the immunization record associated with the identity information is updated, and the exit gate is opened to release the pigs.

4. The method according to claim 3, characterized in that, The images include mutually aligned color images and depth images; determining the injection point locations on the surface of the restrained pig based on the images includes: The color image is segmented to obtain a mask of the restrained pigs; Obtain the horizontal midpoint of each row of pixels in the mask, fit each horizontal midpoint to obtain the back ridge line of the restrained pig; Obtain the contour points on both sides of the mask in the color image that are at the same horizontal level as the target point on the back ridge line; Based on the target point and the two side contour points, two candidate injection points located on both sides of the back ridge line are determined; By combining the depth values ​​corresponding to the candidate injection points in the depth image, the two candidate injection points are transformed to the robot arm base coordinate system; The candidate injection point with the smallest distance between the two transformed candidate injection points and the preset coordinate axis of the robot arm base coordinate system is determined as the injection point location.

5. The method according to claim 3, characterized in that, Before controlling the robotic arm to drive the syringe to the injection point position to perform the injection, the procedure also includes: The system acquires multiple consecutive frames of images of the restrained pigs captured by the visual servo camera, segments each frame, and obtains the mask of the restrained pig in each frame. Calculate the mean value of the cross-union ratio between the masks of adjacent frames within a preset time window, and use the mean value as the movement stability index of the restrained pigs. When the motion stability index reaches a preset stability threshold, the step of controlling the robotic arm to drive the syringe to move to the injection point position to perform the injection is executed.

6. The method according to claim 5, characterized in that, Also includes: Based on the temporal features extracted from the consecutive multi-frame images, the movement stability index of the restrained pigs in the future period is predicted. Based on the predicted motion stability index, the stabilization time window for the restrained pigs is determined. Before the arrival of the stabilization time window, the robotic arm is controlled to move to a preparatory position at a preset distance from the injection point position; After entering the stable time window, the robotic arm is controlled to drive the syringe from the preparatory position to the injection point position to perform the injection.

7. The method according to claim 3, characterized in that, The control of the robotic arm to drive the syringe to the injection point position to perform the injection includes: Control the robotic arm to move to a coarse positioning position that is a first preset distance away from the injection point; Obtain point cloud data within the neighborhood of the injection point location, perform plane fitting on the point cloud data to obtain the normal vector of the pig's body surface at the injection point location, and adjust the end posture of the robotic arm to align the axis of the syringe with the normal vector. The syringe is controlled to move linearly along the axis toward the injection point to trigger the injection.

8. The method according to claim 7, characterized in that, Also includes: During the adjustment of the end posture and the linear motion, the displacement of the restrained pig in the future time period is predicted in real time. If the robotic arm is adjusting the end effector posture and the displacement exceeds a preset displacement threshold, then the robotic arm is controlled to pause its movement and maintain the current posture. If the syringe is in the process of linear motion and the displacement exceeds the preset displacement threshold, then the robotic arm is controlled to retract to a position at a preset safe distance from the pig's body surface. After the pigs in Baoding have stabilized, the robotic arm is controlled to continue the interrupted injection process; if the cumulative time since the start of the injection process exceeds a preset time, the injection is terminated.

9. The method according to claim 7, characterized in that, The robotic arm is equipped with a force sensor at its end; the method further includes: During the linear motion, the force value along the axial direction of the syringe is acquired by the force sensor; When the force value exceeds the preset force threshold, the robotic arm is controlled to stop the linear motion and retract.

10. The method according to claim 3, characterized in that, The main control computer is also communicatively connected to the sprinkler system; controlling the inlet and outlet gates to be closed to restrain the pigs within the restraining area includes: When a live pig is detected entering the Baoding area, the entrance gate is controlled to close. The visual servo camera captures images of the Baoding area, and the number of pigs in the Baoding area is determined based on the images. If the number is greater than one, the exit gate is opened and the spraying device is sprayed to drive away the pigs in the Baoding area until the number of pigs in the Baoding area is one. If the quantity is one, then the exit gate is closed to restrain a single pig within the restraint area; The method further includes: The surface condition of the restrained pigs is determined based on the images; When the body surface is dirty, the area to be cleaned is determined based on the location of the injection point, the spraying device is controlled to adjust the nozzle direction to spray the area to be cleaned, and after spraying, the exit gate is controlled to open to release the pigs.