Beer Bottle Pass is a 1.5-mile section of dirt road that snakes through the Lucy Gray Mountains of southwestern Nevada's Mojave high desert. On one side of the narrow track is a rock face; on the other, a 100-ft. drop-off. The pass demands respect from off-road drivers navigating the twists, turns and hairpin switchbacks. But this past October a blue 2005 Volkswagen Touareg with a strange array of rooftop sensors showed no hesitation rolling into the first turn, and it wasn't because the driver had nerves of steel. It was because the driver had "nerves" of silicon and the brain power of two laptops.

A team of 65 students, professors, engineers, designers and programmers from Stanford University and its private-sector partners (Volkswagen, Intel and other companies) had spent a year transforming the Touareg, nicknamed Stanley, into a robot--a vehicle capable of driving itself without a human at the wheel or at a remote-control console. Stanley was one of 23 autonomous finalists entered in the 2005 DARPA Grand Challenge race, a 132-mile course laid out near Primm, Nev., 40 miles south of Las Vegas. The goal for the teams: $2 million, glory for their institution or company, maybe a defense contract. The goal for DARPA, the Defense Advanced Research Projects Agency: Spur development of unmanned vehicles to meet a congressional mandate to make one-third of the military's land vehicles autonomous by 2015.

During the first Grand Challenge, in March 2004, which Stanford did not enter, none of the vehicles made it beyond Mile 8. This time around, Stanley was one of five robot vehicles to cross the finish line. Stanley did it without a scratch, in a winning time of 6 hours, 53 minutes, with an average speed of 19.1 mph. (Not all its competitors finished within the 10-hour time limit.)

How did Stanford's designers get a bunch of silicon chips to pass a road test in a production SUV? By making ingenious use of hardware, certainly--some invented for the race, some borrowed from industrial robots and some already found in the Touareg. But the artificial intelligence at the heart of the navigation system made the biggest difference. "It's all in the algorithms," Stanford team co-leader Sebastian Thrun says. And learning from previous competitors' mistakes.

The Eyes: For Stanley to complete the course, it had to see the road--and understand it. While studying the 2004 race, the Stanford crew noticed that GPS units alone couldn't handle all the off-road hazards. Additional guidance was needed. So the team installed five roof-rack-mounted light detection and ranging (LIDAR) units to reflect lasers off the ground. With data from LIDAR, computers created a 3D map of the terrain in front of the Touareg, pointing out obstacles to Stanley's guidance program.

The team also installed an inertial guidance system with three gyroscopes and three accelerometers to help Stanley determine its orientation. The system soon proved its worth. Before dawn on race day, the Stanford team uploaded 2935 DARPA-provided GPS way points into Stanley's computers, providing rough driving directions. But when the Touareg wheeled out of the starting gates, the GPS stopped receiving data. The VW swerved to the left. For a moment, it looked like a quick "game over" for Stanford. But the guidance system responded, and the VW turned gently to the right. "If we used GPS alone," Thrun says, "we would have driven off a cliff." The GPS soon came back online.

The Wheels: Early in the design stage, Stanford joined forces with Palo Alto-based Volkswagen of America Electronics Research Lab, which provided a European-model diesel Touareg. "We didn't want to build a car from scratch," Thrun says. "And the Touareg is as good off-road as it is on the highway."

Since drive-by-wire comes standard on the SUV (the gas pedal is merely a sensor that controls the engine electronically), VW designed computer-controlled circuits that mimicked throttle and brake sensor inputs. "Essentially, we just hacked into the system," says Thrun's co-leader, Mike Montemerlo.

Under the dash, VW bolted a DC motor that turned the steering column with a motorcycle chain. An electronically controlled hydraulic piston dropped the shifter into gear. Now Stanley had to learn to drive.

The Brain: Stanley's software, designed by the Stanford School of Engineering, consists of 100,000 lines of code--"a medium-size software project," Montemerlo says. DARPA Grand Challenge manager Ron Kurjanowicz called it "the secret sauce." The programs used a common robot hierarchy: Low-level modules fed raw data from LIDAR, the camera, GPS sets and inertial sensors into software programs that controlled the vehicle's speed, direction and decision making.

Stanley's optical cortex was the Mapper program, which interpreted the 3D LIDAR map and compressed it into a manageable 2D map divided into a grid of 30 x 30-centimeter cells. The cells were designated as free (driveable), occupied (obstacle) or unknown. At first, Stanley interpreted shadows and other harmless features as obstacles, causing false positives at a rate of 12 percent. "Every 20 miles something catastrophic would occur," Montemerlo says. "Stanley would see an obstacle that wasn't there and drive into the bushes."

The team helped Stanley learn how to tell good roads from bad by creating a computer log of the reactions and decisions made by human drivers. The data was fed into a learning algorithm and incorporated into Stanley's control programs. This cut false positives to 0.00002 percent, allowing the VW to drive hundreds of miles between errors.

But Stanley was still slow. The LIDAR's short 100-ft. range meant the Touareg couldn't top 25 mph safely--not fast enough to win the race. A color video camera, however, could recognize features up to 160 ft. away. By comparing the road to samples of video the LIDAR map defined as driveable, Stanley saw far enough ahead to boost top speed to 40 mph.

The Navigator: Early in testing, Stanley's Planner program, which plotted routes for the robot, proved especially buggy. Planner wanted to keep Stanley a uniform distance from every obstacle, creating erratic steering. "We called that Planner the Drunken Squirrel," Montemerlo says. The solution: Round out sharp corners in Planner's route, and redesign the program to generate optional, parallel paths in case of obstacles.

At Mile 102, the program smoothly guided the VW around Carnegie Mellon University's H1ghlander. Stanford's Thrun was following the leader board in the race tent when he heard the announcement: Stanley had just moved into first place.

A short time later, Thrun joined other roboticists crowding around a live video feed from Beer Bottle Pass. "The moment Stanley left the pass I knew the race was history," Thrun says. A few minutes later, he saw two helicopters tracking a dust cloud. Out of it emerged a familiar shape: a blue Touareg driving itself confidently across the finish line--and into the robot pantheon.