Agricultural production has become a key factor for the stability of the world economy. The use of pesticides provides a more favorable environment for the crops in agricultural production. However, the uncontrolled and inappropriate use of pesticides affect the environment by polluting preserved areas and damaging ecosystems. In the precision agriculture literature, several authors have proposed solutions based on Unmanned Aerial Vehicles (UAVs) and Wireless Sensor Networks (WSNs) for developing spraying processes that are safer and more precise than the use of manned agricultural aircraft. However, the static configuration usually adopted in these proposals makes them inefficient in environments with changing weather conditions (e.g. sudden changes of wind speed and direction). To overcome this deficiency, this paper proposes a computer-based system that is able to autonomously adapt the UAV control rules, while keeping precise pesticide deposition on the target fields. Different versions of the proposal, with autonomously route adaptation metaheuristics based on Genetic Algorithms, Particle Swarm Optimization, Simulated Annealing and Hill-Climbing for optimizing the intensity of route changes are evaluated in this study. Additionally, this study evaluates the use of a ground control station and an embedded hardware to run the route adaptation metaheuristics. Experimental results show that the proposed computer-based system approach with autonomous route change metaheuristics provides more precise changes in the UAV’s flight route, with more accurate deposition of the pesticide and less environmental damage.