Autonomous cars are already cruising down the streets of the real world. Self-driving vehicles from Waymo, for example, are picking up riders in Phoenix, Arizona, and a company called Drive.ai is running an autonomous car system that carries people around a part of Frisco, Texas.
Time on the actual road is valuable. But engineers who work on self-driving cars have another tool at their disposal: they can test their software by running simulations, throwing scenarios at their cars in the digital world to see how they might perform on the asphalt of the real world.
For example, Drive.ai recently announced that they had simulated a million miles of travel involving their route in Frisco, Texas. A million miles sounds like a lot, but it pales in comparison to Waymo, which is Google’s self-driving project. It’s done five billion simulated miles in total. (Drive.ai hasn’t disclosed its total number.)
But what is a simulated mile, and what does it mean to have a million of them under your belt?
There are two types of simulation, says Kah Seng Tay, a VP of engineering at Drive.ai. The first involves engineers freshly creating the scenario they want the driving software to handle. Think of it like making a video game, says Tay. “You can essentially hand-craft an entire scenario for simulation,” he says. That means you can set a car’s speed, and add a pedestrian jaywalking across the road at a specific angle. Then they let the scenario play out and see how the driving system handles it.
These simulations don’t involve any physical cars. It happens on laptops, desktops, and using cloud computing. The software driving the virtual car in the simulation is essentially the same as what drives the company’s cars in the real world; the digital sandbox is an ideal place to test out new versions of that software.
For the other type of simulation, Drive.ai uses data from real-world trips that the self-driving cars have already ingested, in the physical world, using their sensors. “We just take that logged data, and convert it into a scenario,” he says. That lets the researchers test several versions of their algorithms to see how each performs. For example, sometimes in the real world a self-driving car system will disengage—the human has to take over. In simulation, they can play that scenario over, and then try tweaking the software with the goal of the autonomous system handling that situation without disengaging.
Simulation also means the researchers can “fuzz” the system, meaning they can tweak variables and see what happens. Let’s say that the scenario they’re modeling includes a moment in which the self-driving car is trying to go around a parked sedan. Why not change things up and make this situation a little harder for the autonomous car? “We could then modify the length of the sedan and make it a pickup truck, or a bus,” Tay says. Or maybe they could just move the car so that it sticks out into the road more, presenting more of an obstacle.
Simulation has other benefits. Time is flexible. A car driving in the real world takes two minutes to cover a mile if it’s consistently driving 30 mph. But if the journey isn’t actually happening, they can control how long it takes. They call that concept “sim time.”
“Ultimately, we try to make it as fast as possible,” he says. Or they can slow it down. “We do all this by bending that sim-time dimension.” They also want to make sure that what they see in simulation is an accurate reflection of what would actually happen in the real world.
And there’s no need to run one simulation at a time; they can do thousands. “We can do a million miles a week,” he says. This isn’t to say that simulation is more important than the real-world cruising, but driving the route virtually allows the car’s software to experience something that it might not encounter in the 2-mile-long route in Frisco, Texas, where Drive.ai is conducting its self-driving pilot.
“The main purpose is to make sure that we can test the edge cases, and the boundaries of our system,” he says, “and ensure we can safely handle all these scenarios before they appear in the real world.” Since self-driving cars are likely to play a bigger role in our lives—even doing things like delivering groceries—it’s important for them to get all the experience they can, whether it’s simulated or real.
There’s another way to test a self-driving car: force it to encounter something in the real world, but in a controlled way in a non-public place. In California, Waymo—whose autonomous cars have on the whole has racked up more than 8 million physical, non-simulated miles—uses a former Air Force base for testing. “There, our team has thrown stacks of paper and dumped tons of boxes onto a closed course track in front of our vehicles,” a Waymo spokesperson said by email. “We’ve even had actors simulate skateboard accidents and jump out of porta-potties to make sure we account for those rare happenings, too.”