This paper describes the organization of movement of unmanned aerial vehicles in a swarm based on modification of the potential field method. Collision prevention is carried out by the potential field method, and relatively uniform distribution of agents in the free space is provided by the control system component, which uses the change of the repulsion field radius depending on the number of neighbors and the distance to them. Averaging the value with neighbors is used to reach consensus on the value of the repulsion field radius. In addition, the results of modeling an algorithm demonstrating satisfactory work and low requirements to the speed of information exchange network are given.