The five swarm robotic quadcopters, created by researchers at the Georgia Institute of Technology in the US, zip back and forth in formation, then change their behaviours based on user commands.
The trick is to manoeuvre without smacking into each other or flying underneath another machine, researchers said.
If a robot cuts into the airstream of a higher flying quadcopter, the lower machine must quickly recover from the turbulent air or risk falling out of the sky.
"Our quadcopters must also include a cylindrical 'do not touch' area to avoid messing up the airflow for each other. They're basically wearing virtual top hats," said Egerstedt.
More From This Section
As long as the machines avoid flying in the two-foot space below their neighbour, they can swarm freely without a problem. That typically means they dart around each other rather than going low.
"We figured out the smallest amount of modifications a quadcopter must make to its planned path to achieve the new formation," said Li Wang, PhD student at Georgia Tech.
"Our skies will become more congested with autonomous machines, whether they're used for deliveries, agriculture or search and rescue," said Egerstedt.
"It's not possible for one person to control dozens or hundreds of robots at a time. That's why we need machines to figure it out themselves," he said.