Skip to main content

Attempt of Drone Swarm

· 2 min read
🤖AI Summary

nova在文章中分享了他第一次尝试使用无人机集群的经历。首先,他提到了如何在settings.json文件中进行配置,以支持多架无人机同时操作。另外,他还详细描述了在使用Python获取无人机列表时遇到的问题,以及如何通过巧妙的编程思路解决这些问题。具体来说,nova通过检测最后一架无人机并将其加入到Future类中,确保无人机间的协同运行。这一解决方案使得无人机可以同步进行操作,而非依序进行。最终,nova成功实现了无人机集群的协同作业,并在文章中表达了他对此技术进展的兴奋与满意。

Configure settings.json file

Microsoft's documentation on Multi Vehicles

Configure the following fields in settings.json

  "Vehicles": {
"UAV1": {
"VehicleType": "SimpleFlight",
"X": 0,
"Y": 0,
"Z": 0,
"Yaw": 0
},
"UAV2": {
"VehicleType": "SimpleFlight",
"X": 2,
"Y": 0,
"Z": 0,
"Yaw": 0
},
"UAV3": {
"VehicleType": "SimpleFlight",
"X": -2,
"Y": 0,
"Z": 0,
"Yaw": 0
}
}

Get the list of drones in Python

drones = client.listVehicles()

As the drone swarm needs to operate collaboratively, we cannot use .join() method on all actions as in the previous sections. If we do so, the drones will perform actions one by one. However, if none of the drones have the .join() method, the subsequent actions will not run properly.

Here is the solution I came up with:

Check if it is the last drone, then add it to the Future class, so that all subsequent actions will wait for it to finish before proceeding.

for i in drones:
print(drones)
if i == drones[-1]:
client.takeoffAsync(vehicle_name=i).join()
else:
client.takeoffAsync(vehicle_name=i)

Now it's moving

Let's dive into the passion of NieR: Automata and make a thrilling purchase directly.

info

This Content is generated by ChatGPT and might be wrong / incomplete, refer to Chinese version if you find something wrong.

Loading Comments...