In recent years, quadcopter unmanned aerial vehicles have demonstrated broad application prospects in fields such as reconnaissance, rescue, and aerial photography, owing to their exceptional vertical take-off and hovering capabilities. However, in practical applications, the flight trajectory planning problem for quadcopters has become a critical issue that requires immediate attention. Traditional flight trajectory planning methods often suffer from high computational complexity and poor real-time performance, making it difficult to meet the demands of rapid planning in complex environments. Therefore, developing an efficient and fast flight trajectory planning method is of great significance for enhancing the application performance of quadcopter drones. To address the shortcomings of existing methods, such as low flight efficiency, we propose a fast trajectory planning approach for quadcopters based on the k-sums algorithm. The k-sums algorithm, as a clustering analysis method, is widely used in data processing and pattern recognition. By applying the k-sums algorithm to the flight trajectory planning of quadcopters, rapid segmentation and optimization of the flight space can be achieved, thereby reducing computational complexity and providing robust support for practical applications of quadcopter drones.
Our method involves modeling the flight space environment, generating feasible waypoints using the k-sums algorithm, and globally planning the flight trajectory. First, we initialize the flight space environment by dividing it into grids of equal size, calculating the gravitational field function experienced by the quadcopter, and modeling the environment based on inter-grid distances. This prepares for the generation of feasible waypoints. Next, we decompose the motion process of the quadcopter to obtain its state equation, use the k-sums algorithm to cluster environmental data segments, and compute the heading angle at different flight times to generate waypoints. Finally, we perform equal time interval sampling on the generated waypoints to obtain trajectory control points, optimize the control points using a cost function that considers trajectory smoothness and collision safety, and derive the optimized flight trajectory for the quadcopter. Experimental results show that our method effectively shortens the flight path length and improves the operational efficiency of quadcopters.
Flight Space Environment Modeling
Flight trajectory planning for quadcopters involves computing and planning the optimal or suboptimal flight path based on flight requirements, target positions, and the flight space environment model. This process not only considers the take-off point, landing point, and flight path but also incorporates motion elements such as speed and acceleration along the path to ensure smooth motion curves and controllable motion speeds during flight. In complex environments where quadcopters perform actual missions, various obstacles of different shapes and irregular characteristics are present, which can lead to suboptimal flight trajectories. Therefore, we first model the quadcopter’s flight environment by dividing the finite environment space into grids of equal dimensions, superimposing obstacle models, and constructing a spatial environment model.
Assuming the quadcopter maintains a constant speed while flying from the start point to the target point, and ignoring height variations in the mission area, we simplify the complex three-dimensional environment by slicing it, resulting in an initialized spatial environment. The space environment is divided into $a \times a \times a$ grids of equal size, where cubes represent obstacles. Considering the three-dimensional spatial characteristics of quadcopter flight, we define two parallel planes tilted along the tangent direction of the flight trajectory: the upper boundary plane of flight, based on the $y$-$O$-$z$ plane, and the lower boundary plane of flight, based on the $x$-$O$-$z$ plane. The distance between these two planes is given by:
$$d_m = \frac{h_0 \times a}{\beta_0 / n_1},$$
where $h_0$ represents the distance between the flight start point and target point, $a$ denotes the grid side length, and $\beta_0$ is the maximum curvature of flight.
Setting the current position of the quadcopter as $X = (x, y)$ and the target position as $Y = (b, c)$, the gravitational field function experienced by the quadcopter in the spatial environment is:
$$U(t) = \frac{1}{2} d_m (X – Y).$$
By traversing the grids containing three-dimensional obstacles and performing dimensionality reduction, we use Euclidean distance to calculate the distance between grids, resulting in the following formula:
$$s_t = \frac{U(t) \times \delta_0}{2 \sum_{i=1}^n h_r},$$
where $\delta_0$ is the reward function from the start point to the first node, $n$ is the number of grids, and $h_r$ is the maximum flight distance of the quadcopter.
Thus, the model of the quadcopter flight space environment is obtained as:
$$A = s_t \times \vartheta_0 \times \sin \gamma,$$
where $\vartheta_0$ is the flight simulation parameter, and $\gamma$ is the angle between the initial flight direction and the turned flight direction.
Based on the principles of quadcopter flight trajectory planning, we use the grid division method to initialize the flight space environment, compute the gravitational field function experienced by the quadcopter, and model the flight space environment using inter-grid distances, thereby preparing for the generation of feasible waypoints.
Generation of Feasible Waypoints Based on k-sums Algorithm
To enhance the connections between flight environment data and improve quadcopter flight path planning, we employ the k-sums algorithm to segment clustered environmental data and generate feasible waypoints in combination with the quadcopter’s heading angle.
First, we decompose the motion process of the quadcopter to obtain its state equation:
$$B = A \times \exp \left( -\frac{\rho_0}{f_y \times b_v} \right),$$
where $A$ is the spatial environment model, $\rho_0$ is the pitch angle of the quadcopter, $f_y$ is the scalar speed of the quadcopter, and $b_v$ is the distance between the quadcopter and the obstacle.
We segment the environmental information into $k$ data segments and initialize the mean values of these $k$ segments. The sum of variances for the entire dataset is calculated as:
$$E_0 = \sum_{j=0}^k j \times B,$$
where $j$ represents the distance matrix.
Using the kinematic factors of the quadcopter as variables for clustering, we adjust the boundaries of the data segments using the standard coordinate descent optimization algorithm, expressed as:
$$q_c = E_0 \left( 1 + \frac{h_p}{r_w \times v_p} \right),$$
where $h_p$ is the intra-segment sum, $r_w$ is the starting point of the data segment, $v_p$ is the end index factor of the data segment, and $q_c$ is the boundary neighbor distance.
When the distance between the quadcopter and the target point is less than the boundary neighbor distance, the boundary force experienced by the quadcopter is:
$$F_d = \frac{m_l}{D_c} \times \frac{q_c}{t_0},$$
where $D_c$ is the boundary coefficient of the target point, $t_0$ is the flight time of the quadcopter, and $m_l$ is the number of obstacles.
Based on the quadcopter’s state transition equation, we discretely and uniformly partition the environmental data to obtain feasible waypoints reachable by the quadcopter:
$$c_l = \frac{m F_d}{\lambda_c} q_r,$$
where $\lambda_c$ is the state transition matrix, $q_r$ is the time constant, $m$ is the number of feasible waypoints, and $c_l$ represents the flight heading angle of the quadcopter at the next time instance.
Using the quadcopter’s starting point as a reference, we compute the heading angle at different flight times using the above equation to determine the quadcopter’s motion point at the next moment, thereby generating waypoints for subsequent flight trajectory planning.
Global Flight Trajectory Planning for Quadcopters
Based on the generated flight waypoints, we employ the B-spline method to optimize the waypoints, resulting in an optimal and smooth flight trajectory for the quadcopter.
We perform equal time interval sampling on the generated flight waypoints to obtain control points for the start and target points:
$$z_1 = c_l \times t,$$
$$z_2 = \frac{c_l}{T_r / k_\gamma},$$
where $c_l$ is the flight heading angle of the quadcopter, $t$ is the distance between adjacent waypoints, $T_r$ is the sampling interval, $k_\gamma$ is the discrete coefficient, and $z_1$ and $z_2$ are the control points for the start and target points, respectively.
We sample points from the suboptimal path and construct a cost function that considers trajectory smoothness and collision safety:
$$F_1 = \iota_0 \times (z_1 + z_2),$$
$$F_2 = \sigma_c \times \frac{z_1}{z_2},$$
where $\iota_0$ is the weight of quadcopter acceleration, and $\sigma_c$ is the coordination gain coefficient.
The B-spline formula is given by:
$$S(t) = \sum_{g=1}^\mu Q_g \times R^*,$$
where $\mu$ is the number of B-spline basis functions, $Q_g$ is the length of the trajectory within the obstacle influence area, and $R^*$ is the Dirac function.
We then optimize the control points to obtain a smooth and optimal flight trajectory:
$$N = \frac{S(t) F_2}{1 \times F_2^2} \xi_0 \times \tau_0,$$
where $\xi_0$ is the actual flight path of the quadcopter, $\tau_0$ is a variable constant greater than zero, and $N$ represents the optimized flight trajectory.
By performing equal time interval sampling on the generated flight waypoints to obtain trajectory control points, and combining the cost function for trajectory smoothness and collision safety, we derive the optimized flight trajectory for the quadcopter, thereby achieving efficient flight trajectory planning.
Experimental Analysis
To validate the practical effectiveness of our proposed k-sums algorithm-based fast flight trajectory planning method for quadcopters, we applied it to a Qball-X4 model quadcopter and performed flight trajectory planning. Based on the experimental results, we analyzed the planning performance of our method.
Experimental Setup
To verify the performance of our method, we designed a multi-obstacle environment map for the quadcopter flight space, simulating complex scenarios that a quadcopter might encounter in real flight. We performed a pruning process with a 2 m expansion operation on the obstacles in the map to ensure the safe operation of the quadcopter. During the experiment, both the clockwise and counterclockwise angles of the environment map were set to 15°, the maximum yaw angle of the quadcopter was 75°, and the maximum pitch angle was 90°. The simulation environment map is shown below.

The experiment was conducted using a Qball-X4 model quadcopter for testing. The performance parameters of the quadcopter are summarized in Table 1.
| Parameter Category | Performance Indicator | Parameter Value |
|---|---|---|
| Body Dimensions | Length × Width × Height | 40 cm × 40 cm × 15 cm |
| Weight | — | |
| Unloaded Weight | 1.5 kg | |
| Maximum Take-off Weight | 2.5 kg | |
| Power System | Number of Rotors | 4 |
| Rotor Diameter | 20 cm | |
| Maximum Thrust | 5 N per rotor | |
| Battery | Battery Type | Lithium Battery |
| Battery Capacity | 5000 mAh | |
| Endurance Time | 20 min | |
| Flight Performance | Maximum Flight Speed | 50 km/h |
| Maximum Climb Speed | 5 m/s | |
| Maximum Descent Speed | 3 m/s | |
| Maximum Flight Altitude | 500 m | |
| Hovering Accuracy | Vertical: ±0.5 m; Horizontal: ±1 m | |
| Communication Distance | Remote Control Distance | 1000 m |
| Payload Capacity | Maximum Effective Payload | 500 g |
To ensure computational efficiency and real-time performance during the experiment, the experimental platform utilized a high-performance computer with a Windows 10 operating system, equipped with an Intel Core i7 processor, 32 GB RAM, and an NVIDIA GeForce GTX 4060ti graphics card. The quadcopter flight simulator software was Dronekit Python, used for programming and controlling the quadcopter flight trajectory. We employed the Dronekit Python library to write the flight control program for the quadcopter and implemented the trajectory planning using the k-sums algorithm.
Experimental Description
In the k-sums algorithm, we set the value of $k$ to 5, meaning that trajectory planning is performed based on the information from the last 5 sampling points. We used MATLAB software to process and analyze the experimental data, and plotted the flight trajectory graphs.
In the experiment, the start coordinates were set to $Q_a(0, 0, 0)$, the end coordinates to $Q_b(100, 70, 20)$, and 8 obstacles were placed in the environment. The quadcopter started from the origin and used the k-sums algorithm for flight trajectory planning. We recorded the quadcopter’s flight data, including real-time position, velocity, and attitude information, and repeated the experiment 30 times. The experimental results were statistically analyzed to evaluate the performance of our method.
Quadcopter Flight Trajectory Planning Results and Analysis
Based on the above experimental setup and parameter settings, we applied our method to the quadcopter flight space environment map shown in the figure. For comparison, we introduced the A-star algorithm (Method 1) and the artificial potential field algorithm (Method 2) as benchmark methods. We used these three methods to plan the flight path of the quadcopter, and the experimental results are summarized below.
Analysis of the results indicates that applying our method to plan the flight trajectory of the quadcopter resulted in a planned path with fewer redundant waypoints. Compared to the trajectories generated by Method 1 and Method 2, our trajectory is smoother, and during the flight from the start to the end point, it completely avoids various types of obstacles, resulting in fewer sampling points in invalid spaces. In contrast, the trajectories obtained by Method 1 and Method 2 require extensive sampling within the space and contain numerous redundant points, leading to suboptimal planned trajectories. This demonstrates that our method effectively reduces useless sampling points in quadcopter flight trajectory planning, resulting in a shorter optimal flight path.
Comparative Experiment and Analysis
Based on the above experiment, we statistically analyzed the path lengths of the quadcopter trajectory planning obtained by the three methods. The results are presented in Table 2.
| Simulation Iteration | Path Length (cm) – Method 1 | Path Length (cm) – Method 2 | Path Length (cm) – Our Method |
|---|---|---|---|
| 5 | 187.3 | 156.9 | 123.6 |
| 10 | 201.9 | 175.2 | 147.5 |
| 15 | 221.7 | 170.6 | 169.3 |
| 20 | 157.9 | 130.8 | 122.0 |
| 25 | 114.6 | 102.6 | 98.5 |
| 30 | 167.0 | 114.7 | 96.7 |
Analysis of Table 2 shows that the flight trajectory length planned by our method is significantly shorter than those of Method 1 and Method 2. This indicates that using our method for quadcopter trajectory planning can effectively shorten the flight path length while maintaining good obstacle avoidance performance, thereby improving the operational efficiency of the quadcopter.
Conclusion
We propose a fast trajectory planning method for quadcopters based on the k-sums algorithm. By optimizing processes such as data segmentation and trajectory generation, we achieve efficient flight trajectory planning for quadcopters, and through practical examples, we verify the reliability of the method. Our research results not only help enhance the intelligence level of quadcopters, enabling them to perform tasks more autonomously and efficiently in complex environments, but also reduce the risks that quadcopters may encounter during flight, ensuring their safe and stable operation. Simultaneously, this method provides strong support for the application of quadcopters in fields such as aerial photography, reconnaissance, and rescue. In the future, we will further optimize this method to expand its application scope in the field of quadcopters.
