In order to optimize robot road planning, automation will increase production efficiency and reduce production costs. An improved ant colony algorithm based on a two-dimensional flat path planning study divided the three-dimensional space into planes, rasterized each plane, and replaced the original shape by storing a pheromone at the intersection. The pheromone storage space along the route will be reduced, and a three-dimensional space route planning study will be gradually conducted. As complex 3D environments and landscape features change, obstacle avoidance strategies have increased, road heuristics have improved, and new heuristic features have emerged. The initial value of the road node pheromone increases the efficiency of early ant search because of the uneven distribution of starting point, target point location information, and forward direction. After each iteration, the stuck ants that did not reach the target point are discarded according to the high-quality ant renewal rules, the iteration threshold is set, and the pheromone fluctuation coefficient is adjusted as the algorithm tends to merge. Compared with the basic ant colony algorithm, the convergence iteration times of the improved ant colony algorithm in this paper are reduced by about 40%, and the optimal path length is shortened by about 10. The duration of the algorithm increases. In terms of algorithm performance, it takes some time to improve the ant colony algorithm. Because of the complexity of the algorithm, some search strategies are added to the algorithm. The contribution of this article is the basis for the mobile robot to walk accurately from the initial position to the working position and perform various tasks independently.