Faced with complex and ever-changing environmental conditions in the agricultural field, efficient agricultural information gathering is crucial for optimising agricultural output. Therefore, a new path planning algorithm combining ant colony algorithm and particle swarm optimization is proposed in this study. The aim is to achieve fast and accurate path planning for agricultural information gathering robots in diverse agricultural environments. The global search ability of particle swarm optimization algorithm in finding optimal paths and the local search advantage of ant colony algorithm in obstacle avoidance are used to optimise the movement strategy of robots in agricultural environments. The research results showed that the global path planning distance of this method was 19.328m. The execution time was 0.97s. In local path planning, the proposed algorithm had a fitness function value of 30.123 when the number of iterations reached 53. In mixed path planning, the proposed algorithm reduced the movement time by 3.2s. The conclusion shows that the algorithm proposed in this study has high applicability and efficiency in practical applications, providing an effective strategy for path planning of agricultural information gathering robots. It has important practical significance for promoting the development of intelligent agriculture.