# LSTM-DQN-APF Path Planning Algorithm Empowered by Twins in Complex Scenarios
## 4 Twin System Modeling and LSTM-DQN-APF Algorithm
### Algorithm Validation Test and Analysis  
#### 4.3.1 Test Ideas  
This paper is based on the technical framework of the digital twin platform \"Twin Empowerment--Prediction-Driven--Decision Optimization\" and designs a three-level progressive experimental validation of the performance of the LSTM-DQN-APF algorithm. Experiment 1 focuses on verifying the consistency of the virtual-physical mapping and the  
Figure 4: **(a)** Twin platform monitoring interface and (**b**) diagram of the digital-realistic system.  
Figure 5: Digital twin platform communication map.  
effectiveness of the interface communication. A twin city model is generated through virtual space simulation, and real-time perception data from the physical UAV is synchronized, thereby constructing an accurate data foundation for twin empowerment. Experiment 2 builds upon the previous research, performing a horizontal comparison of the trajectory prediction errors on the x, y, and z axes between the LSTM-DQN-APF model and the LSTM, BP, and CNN models. This is combined with an analysis of the axis-by-axis matching degree of the actual trajectory of the physical UAV to validate the proposed algorithm's advantage in trajectory prediction in multi-dimensional space. It also reveals how the twin data-driven LSTM module improves the accuracy of dynamic obstacle trajectory prediction, thus supporting the collaborative decision-making ability of Qn-Apf. Experiment 3 further simulates scenes of static obstacles, dynamic obstacles with random motion, and wind field intensity gradient changes within the twin system. The algorithm's adaptability in urban environments is comprehensively evaluated in terms of average flight time, average path, task completion rate, and other dimensions. Through the three-level experimental loop, the feasibility and robustness of the \"Prediction-Decision\" link under twin platform empowerment in complex urban scenarios are comprehensively verified.  
3.2 Experiment 1: Verification of Consistency Between Virtual and Real Environments and Verification of Interface Interoperability  
Regarding the consistency between the virtual and real aspects established in the UAV digital twin verification platform and the availability of communication interfaces between the real and virtual domains, this paper will conduct experiments designed to reflect reality through virtual simulations. The designed scenario is a single UAV cruising in a quadrilateral, with waypoints being (0,0,4), (0,5,4), (5,5,4), (5,0,4), and (0,0,0) in sequence. The experiment will control the flight of the virtual UAV in AirSim 1.5.0 [28] using the control functions of the physical UAV and send waypoint information to the virtual UAV via a socket communication protocol. By comparing the flight trajectory data of the real and virtual UAVs, a consistency evaluation and analysis of the alignment between the virtual and real UAV flight conditions will be conducted. As shown in Figure 6, (a) represents a comparison of the three-dimensional flight trajectories of both UAVs, and (b) shows the comparison of the two-dimensional trajectories.  
Using the actual UAV's flight trajectory as the reference, the average errors of the virtual UAV's position data in the X, Y, and Z directions were calculated to be 0.24 m, 0.27 m, and 0.23 m, respectively. The mean error is relatively small, and the trajectory closely aligns with the preset one, which meets the simulation requirements of the virtual UAV on the UAV real-virtual integrated verification platform. Based on the consistency of the virtual-real mapping and the effectiveness of the interface communication, subsequent tests were conducted.  
Figure 6: (a) 3D and (b) 2D trajectory diagrams of physical and virtual UAVs flying a quadrilateral.