Driving the Mars Rovers

Linux is the desktop platform for the team driving NASA's Mars rovers, Spirit and Opportunity.

At 8:30 PM PST on January 3, 2004, a thousand pounds of metal sent from Earth blazed through the sky of Mars. Six minutes later, after sprouting a parachute and airbags, this chunk of metal slammed into the red planet, bounced 28 times over 300 meters and slowly rolled to a stop. The airbags deflated, revealing the metal pyramid they protected, which in turn unfolded to reveal a six-wheeled robotic geologist named Spirit.

So began a three-month exploration of Mars. For a team of hundreds of scientists and engineers at NASA's Jet Propulsion Laboratory, Spirit is serving as our eyes—and our toolbox, using the tools at the tip of its foldaway arm—during a new chapter in the exploration of our neighbor planet. As is Spirit's twin, Opportunity, which duplicated Spirit's performance three weeks later on the opposite side of Mars. And what are all those scientists and engineers using to drive the rovers? They are using Linux.

The Mars Exploration Rover (MER) mission marks a turning point for use of Linux in the space program. Linux has been used on space missions before—a Debian laptop rode the Space Shuttle on STS-83, for instance, as long ago as 1997. But the Mars Exploration Rover Project is the first JPL mission to use Linux systems for critical mission operations. On MER, Linux is being used for high-level science planning and for low-level command sequencing, visualization and simulation.

How We Got Here

As odd as this may seem, Linux originally was not intended to be our primary development platform. Our software initially was intended for use on the Mars '01 mission, which essentially would have been a repeat of JPL's 1997 Mars Pathfinder mission. The plan was to do all rover commanding on a single Silicon Graphics workstation, as had been done on Mars Pathfinder. Our Linux support was, at that time, mainly a hedge against SGI's fortunes.

After the failure of JPL's Mars '98 missions, however, JPL re-planned its Mars strategy. The Mars '01 plans were scrapped in favor of a later launch, the mission that eventually became MER. The upshot was we got two more years of development time than we had planned, albeit for a different spacecraft than we had planned. The MER rovers are larger, smarter and more complex than Pathfinder's Sojourner rover, and each one sports a robotic arm.

In those two years, Linux and the generic x86 hardware it runs on made enormous strides in both CPU and graphics speeds, thanks in no small part to graphics chip-maker NVIDIA and its strong Linux support. As a result, we increasingly came to favor the faster, better, cheaper solution that was Linux. We eventually purchased two high-end SGIs to add to our Linux boxes during flight operations, but it is unclear whether we will end up using them; the Linux boxes now give us equal, if not better, performance. As a result, the MER rovers are being commanded by multiple teams working in parallel on the dozens of Linux systems we've purchased for the mission.

The RSVP System

Our software, a suite of applications called the Rover Sequencing and Visualization Program (RSVP), was developed, tested and deployed on Linux. RSVP gives MER's engineers and scientists sophisticated tools for commanding Mars rovers. Because of the lengthy light-time delays, which amounted to nearly a 20-minute round-trip on Spirit's landing day, it's not possible to drive the rovers interactively. Instead, RSVP provides an immersive environment that accurately displays the rover's environment and simulates its behavior. Throughout the Martian night, we Earthlings use RSVP to plan a day's activities at the command level and then uplink the resulting commands to the rover. The rover executes those commands during the following Martian day.

The two main components of RSVP are the Rover Sequence Editor (RoSE), which provides text-oriented commanding for all spacecraft commands, and HyperDrive, which provides advanced three-dimensional graphics for driving, arm motion and imaging commands. Each of the individual applications can run in a standalone mode, but they are more powerful when used together. In combined mode, the applications are run under the control of the parallel virtual machine (PVM) software developed by Oak Ridge National Laboratories. PVM provides a data bus, a way for the RSVP component applications to synchronize their work by passing messages to one another.

The content of most of our messages is based on RML, an XML-based specification designed specifically for representing rover command sequences. This message-passing approach has a number of benefits, not the least of which is that we can implement individual tools in different languages. As long as the tool can send PVM messages, it can be part of the suite. RoSE, our message-passing hub, and our message logger are written in Java; HyperDrive, our image viewer, and our sequence flow browser are written in C++ and C. For the next mission, we may try adding tools written in scripting languages such as Perl and Python.