The drones weaved through the twists and turns of the warehouse obstacle course at speeds reaching as high as 40 miles per hour.

Behind one set of controls, Ken Loo pushed his drone to go faster, taking risks with aerial stunts and aggressive movements. His opponent, an artificial intelligence designed by NASA’s Jet Propulsion Laboratory and funded by Google, wasn’t flashy, but its movements were consistent, always hitting the same racing line every lap.

So who won?

The A.I. was more accurate and took fewer risks. However, the more cautious flights cost the computer precious time. After dozens of laps, Loo emerged victorious and exhausted. He averaged 11.1 seconds per lap, compared to the autonomous drone, which averaged 13.9 seconds.

“This is definitely the densest track I’ve ever flown,” Loo said in a statement. “One of my faults as a pilot is I get tired easily. When I get mentally fatigued, I start to get lost, even if I’ve flown the course 10 times.”

Loo, nicknamed “Flying Bear,” is a senior product design engineer at Google and a competitive pilot in the national Drone Racing League. Loo piloted using “first-person view” goggles, a live camera feed that lets him see from the drone’s perspective.

The race followed two years of research into drone autonomy funded by Google. The company wanted to see how JPL’s work with vision-based navigation could apply to drones, according to NASA. What better way to test the technology than to put it against a human in a time trial race?

JPL built three custom drones — named Batman, Joker and Nightwing, after the comic characters — and developed a complex algorithm so the drones could fly at high speeds while still avoiding obstacles. The drone uses cameras to track its position against a pre-loaded map.

“We pitted our algorithms against a human, who flies a lot more by feel,” said Rob Reid, the project’s task manager at JPL. “You can actually see that the A.I. flies the drone smoothly around the course, whereas the human pilots tend to accelerate more aggressively, so their path is jerkier.”

The algorithm, which is still being worked on, sometimes struggled with the speeds, causing the drones to lose track of their surroundings, according to NASA. Still, where Loo’s times varied from lap to lap, the A.I. stayed consistent.

A drone flies through a NASA obstacle course (Courtesy of NASA/JPL)

With the drones able to reach up to 80 miles per hour in a straight line, Reid believes the A.I. pilots will only get better.

“One day, you might seem them racing professionally,” he said.

Most drones rely on GPS, but visual-based navigation would allow drones to work indoors and in dense urban areas, according to NASA. The technology could have applications for autonomous cars as well. Drones that navigate by camera can check inventory in warehouses, or help in search and rescue operations.

For NASA, that means they might someday navigate space stations, though, likely, at much slower speeds.

Jason Henry is an investigative reporter with the Southern California News Group. Raised in Ohio, Jason began his career at a suburban daily near Cleveland before moving to California in 2013. He is a self-identified technophile, data nerd and wannabe drone pilot.