In this study, the process of designing a motion optimization algorithm for swarm quadrotor robots is presented. Motions equations of swarm are written based on Lagrangian energy equations. A potential function is applied on the equations to optimize the swarm motion. The applied potential function enables each of the swarm members to move toward an independent target coordinate as motion starts and simultaneously connecting with other members. As a result, the necessity of having the members aggregated within an area close to the swarm center is eliminated. This algorithm is supposed to act on swarm of quadrotors; therefore a validated dynamic model of quadrotor and a designed controller are introduced to discuss the possible applications. The designed algorithm is then applied to grasp an object. In order to establish grasping, particle swarm optimization method is used. Finally, the algorithm is simulated in MATLAB for a two-member swarm of quadrotors for grasping the object. Simulation results indicate increased work space for the members along the motion path and reduced mission time.