Abstract:Weeds compete with crops for nutrients and negatively affect agricultural yield. Traditional chemical weeding, though efficient, tends to cause environmental pollution and herbicide resistance. To achieve green, high-precision, and non-contact weeding operations, a target-oriented control system for a laser weeding robot was designed based on visual perception and path control. The system consisted of a depth camera, galvanometer scanner, and high-power CO2 laser, enabling weed detection, spatial localization, and laser operation. A Teensy 3.2 microcontroller-based integrated control scheme for the galvanometer and laser was proposed, which combined with the XY2-100 communication protocol and TTL triggering mechanism, allowed precise galvanometer control and laser switching without the need for an additional control card. A camera-galvanometer extrinsic calibration method combining manual measurement and refinement optimization was established, and an attitude-error compensation algorithm based on geometric inverse solving was proposed to achieve automatic correction of aiming and firing under different pose conditions, followed by verification experiments. The results showed that the average aiming error of the system remained below 1cm at different heights and tilt angles, and the laser weeding hit rate reached 98.6%. The optimal operating parameters were determined as a working height of 80cm and a laser exposure time of 0.5s. This system can enable high-precision, low-energy autonomous weeding and provide a reference for the application of laser weeding technology in complex field environments.