To address the nonlinearities and external disturbances in unstructured and complex agricultural environments, this paper investigates an autonomous trajectory tracking control method for agricultural ground vehicles. Firstly, this paper presents the design and implementation of a lightweight, modular two-wheeled differential drive vehicle equipped with two drive wheels and two caster wheels. The vehicle comprises drive wheel modules, passive wheel modules, battery modules, a vehicle frame, a sensor system, and a control system. Secondly, a novel robust trajectory tracking method was proposed, utilizing an improved pure pursuit algorithm. Additionally, an Online Particle Swarm Optimization Continuously Tuned PID (OPSO-CTPID) controller was introduced to dynamically search for optimal control gains for the PID controller. Simulation results demonstrate the superiority of the improved pure pursuit algorithm and the OPSO-CTPID control strategy. To validate the performance, the vehicle was integrated with a seeding and fertilizing machine to realize autonomous wheat seeding in an agricultural environment. Experimental outcomes reveal that the vehicle of this study completed a seeding operation exceeding 1 km in distance. The proposed method can robustly and smoothly track the desired trajectory with an accuracy of less than 10 cm for the root mean square error (RMSE) of the curve and straight lines, given a suitable set of parameters, meeting the requirements of agricultural applications. The findings of this study hold significant reference value for subsequent research on trajectory tracking algorithms for ground-based agricultural robots.