# parallel_simulation **Repository Path**: ma_lan/parallel_simulation ## Basic Information - **Project Name**: parallel_simulation - **Description**: 基于XTDrone的平行仿真实验,任务场景:13架四旋翼无人机的编队飞行,涉及到无人机加入和退出队伍和集群队形变换。其中3架实物无人机,10架虚拟无人机 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 6 - **Forks**: 0 - **Created**: 2021-06-22 - **Last Updated**: 2025-09-12 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Parallel Simulation To simulate UAVs both in simulation and reality ## Introduction Before your work, do as follows: ### 1.configure before catkin_make 1.move launch files to PX4_Firmware/launch ```bash cd parallel-simulation cp launch/* ~/PX4_Firmware/launch/ ``` 2.set parameter in qnode.hpp ```bash int real_num = 0; //when run simulation,make sure real_num=0 ``` ### 2.compile workspace ```bash cd parallel-simulation/src catkin_init_workspace cd .. catkin_make source devel/setup.bash ``` ### 3.set multi-instance port number (for simulation) ```bash roscd px4 cd ROMFS/px4fmu_common/init.d-posix gedit rcS ``` modify the port as follows: ```bash # multi-instance setup # shellcheck disable=SC2154 param set MAV_SYS_ID $((px4_instance+1)) simulator_tcp_port=$((4560+px4_instance)) udp_offboard_port_local=$((34580+px4_instance)) udp_offboard_port_remote=$((24540+px4_instance)) # [ $px4_instance -gt 9 ] && udp_offboard_port_remote=14549 # use the same ports for more than 10 instances to avoid port overlaps udp_onboard_payload_port_local=$((14280+px4_instance)) udp_onboard_payload_port_remote=$((14030+px4_instance)) udp_gcs_port_local=$((18570+px4_instance)) ``` ### 4.simulation start 1.start simulation environment ```bash roslaunch px4 iris3_parallel_simulation.launch # 3 UAVs in simulation roslaunch px4 iris10_parallel_simulation.launch # 10 UAVs in simulation ``` 2.run main framework of control ```bash mpiexec -n 3 python px4_control_sim.py # 3 UAVs in simulation mpiexec -n 10 python px4_control_sim.py # 10 UAVs in simulation ``` 3.run gcs ```bash rosrun xtdrone_qt xtdrone_qt ```