SpaceX’s Self-Landing Rocket is a Flying Robot Great at Math

SpaceX

Landing spacecraft is fundamental to exploring our solar system.

What you’re seeing in the video below is a 40-meter tall SpaceX rocket booster, weighing more than 20 tons, fly itself back to Earth from space and land precisely on a target at Cape Canaveral.

What you may be wondering is, how did it do that?

The first thing to know is that a rocket booster is in fact a large robot, steering itself back to Earth without help from anyone else but its internal computers. The challenge SpaceX CEO Elon Musk set for his reusable rocket team, led by MIT-trained aerospace engineer Lars Blackmore, was to teach the rocket how to fly itself back to earth.

Landing spacecraft is fundamental to exploring our solar system, as it’s the only effective way to bring heavy scientific equipment or people to a planetary surface. Scientists have been thinking about this since NASA began planning the moon landing in the 1960s. In 2007, Blackmore started working on similar problems at Caltech’s Jet Propulsion Laboratory, thinking about how to improve the landing ability of spacecraft being sent to explore the surface of Mars.

In 2009, Blackmore and two colleagues observed in a paper the inability to land precisely on Mars meant that scientific exploration was taking a backseat to the realities of getting a spacecraft to land at a specific location. When planning these trips, engineers visualize landing precision as an imaginary ellipse on the surface of the planet, where the spacecraft has a 99 percent chance of landing.

In 1997, when NASA sent a rover called Mars Pathfinder to the red planet, it was expected to land within an ellipse 150 kilometers across its major axis, which is not exactly what you want to hear if you’re scientist with a specific destination in mind. By the time the Mars Curiosity rover landed in 2012, JPL’s engineers had the landing ellipse shrunk to 20 kilometers across. That’s still a lot of uncertainty—imagine if you were taking a plane somewhere and you were told you’d land within 20 kilometers of your destination.

But SpaceX has its rockets landing within ellipses of 30- and 10-meters across, on a Cape Canaveral landing pad and on sea-going landing barges, respectively—an order of magnitude in improvement.

A big reason for the uncertainty in most Mars rovers is the use of parachutes to land, because engineers are still learning how to use rockets to slow a spacecraft’s descent through a planet’s atmosphere at hypersonic speeds. SpaceX, in developing its reusable rocket, is the only organization to have brought a rocket back from space by actually flying it to Earth at that velocity, and it has shared its groundbreaking work on this aerodynamics problem with NASA to help scientists there plan future Martian missions. But once the physics are mastered of maneuvering a rocket-powered spacecraft in for landing, the rocket still needs to be taught to fly itself down.

Using rocket thrust to control descent allows companies like SpaceX and Blue Origin, whose smaller suborbital rocket has successfully landed and been reused several times, to hit their landing targets precisely by eliminating the parachute drift normally associated with spacecraft falling to earth.

There aren’t human pilots on most spacecraft these days, and it can be difficult to communicate with spacecraft as they land, either because of the distances involved with planetary exploration, or on Earth, because friction with the atmosphere as a rocket flies back down can create an ionization field (a static shock on a grand scale) capable of blocking radio signals.

The computing challenge is simple to describe and hard to execute: Plot the most optimal path down to the target without running out of fuel. That’s complicated enough, but also consider the time constraint: The rocket’s computers need to solve this problem before they run out of fuel or crash into Earth—in a “fraction of a second,” according to Blackmore. He and his colleagues developed one of the first algorithms to do this in three dimensions in that 2009 paper on Mars landings, receiving a patent on their ideas in 2013.

The solution involves solving a “convex optimization problem,” a common challenge in modern machine learning. In wildly reductive layman’s terms, it involves considering all the possible answers to the question of “what’s the best way to get from here to the landing pad without running out of fuel” as a geometric shape, and uses mathematical tools developed first by John non Neumann, the father of game theory, and refined by Indian mathematician Narendra Karmarkar in the 1980s, to quickly choose the best way down from that set.

A visualization of the rocket booster's path back to earth.
A visualization of the rocket booster’s path back to earth. (NAE Bridge/Lars Blackmore)

At SpaceX, Blackmore and his team have updated the landing algorithms, using software developed by Stanford computer scientists “to generate customized flight code, which enables very high speed onboard convex optimization.”

As the rocket reacts to changes in the environment that alter its course—known as “dispersions”—the on-board computers recalculate its trajectory to ensure that it will still be 99 percent sure to land within its target.

So far, it has: SpaceX has landed eight boosters since its first successful attempt in December 2015, including its last four flights. The three failures to land in that time period were caused by hardware issues, not a failure to navigate successfully to the landing area. SpaceX executives are reluctant to say they now expect landings to succeed, preferring to keep their focus on the primary mission of launching cargo for clients, but it’s clear that reliability is improving.

The company plans to fly the first of its “flight-proven” stages in a March mission for the European satellite operator SES. Should they succeed and be able to regularly fly previously-used rockets, Musk has said the cost of launch could drop by 30 percent.