Multiple drones do not takeoff in parallel
Dear all,
I'm using the HelloDrone C++ example code und adapted the settings.json + the example code to 10 drones.
Now, for the takeoff: the original file uses
std::cout << "Press Enter to takeoff" << std::endl; std::cin.get();
float takeoffTimeout = 5;
client.takeoffAsync(takeoffTimeout)->waitOnLastTask();
I adapted the code (for each drone "Drone1" to "Drone10") to:
client.takeoffAsync(takeoffTimeout, "Drone1")->waitOnLastTask();
Now, in the simulation each drone takes off after takeOffTimeout from the previous drone, is there a possibility to start them all in parallel?
I already tried (all options not working):
client.takeoffAsync(0, "Drone1")->waitOnLastTask();
client.takeoffAsync(takeoffTimeout, "Drone1");
Thank you and best regards, MelSoS
You don't need the ->waitOnLastTask(), it basically waits to proceed to next command until the takeoff is complete.
This should work
int num_drones = 10;
takeoffTimeout = 5;
for (int drone_idx = 0; drone_idx<num_drones; drone_idx++)
{
client.takeoffAsync(takeoffTimeout, "Drone"+std::to_string(drone_idx));
}