RSVP required: The code that drives the Mars Curiosity rover
NASA engineers not only drive the the Curiosity rover, they also write the code used to tell it where to go and what to do each day
The big Consumer Electronics Show is going on this week in Las Vegas and one of the many cool technologies on display are self-driving cars. A number of different companies have been developing autonomous vehicles for a while now. But while these vehicles are still in the development stage here on Earth, up on Mars unmanned vehicles have been cruising around for years.
Of course, the Curiosity rover (as well as the still-functioning Opportunity rover) aren’t truly autonomous, meaning they don't decide where to go on their own. They’re really driven by a team engineers on the ground at NASA’s Jet Propulsion Laboratory (JPL). They also do a lot more than just drive around the surface of Mars; they also conduct all sorts of scientific experiments and analysis. In order to tell the rovers where to go and what to do each day, the team of rover drivers use sophisticated ground-based software.
I’ve written previously about the software onboard the Mars Curiosity rover and I recently had the opportunity to interview Brian Cooper, the rover’s lead driver and lead developer of the ground-based control software, about the code that makes Curiosity go. Cooper has been involved in developing the code used to drive all of the rovers that have operated on Mars to date, from the Pathfinder Rover Sojourner, to Spirit and Opportunity (the Mars Exploration Rovers) to the Mars Science Laboratory (MSL), better known as Curiosity. In addition to developing the control software, Cooper has also driven all four.
The software that drives Curiosity and controls its robotic arm is called the Robot Sequencing and Visualization Program (RSVP). RSVP consists of about 1 million lines of Java and C++ code. The main component used to plan, simulate and specify commands to dictate the rover’s actions each day is called HyperDrive. HyperDrive is a system for viewing images and terrain in 3D, which uses NVIDIA Quadro cards that support goggle stereo viewing.
Running RSVP on high-end Linux workstations and using NVIDIA 3D Vision glasses, rover drivers evaluate Curiosity’s surroundings each day and generate instructions for the next day’s activities. Command output is XML which gets compiled into binary code that’s sent to the rover for execution. On any given day, hundreds of commands are sent to Curiosity.
“The MSL command dictionary has thousands of commands that allow us to control all rover motion, manage power, communications with Earth, and tons of low level maintenance issues like data management on board,” said Cooper.
RSVP was completely developed in-house, by a small (8 people or so) team of developers who also drive the rover. “RSVP has a proud heritage,” Cooper said, and it grew out of the code written for the first Mars rover, Sojourner (of which Cooper was the first driver), called the Rover Control Workstation (RCW), which consisted of 80,000 lines of C++ code. Subsequently, the first version of RSVP was written for the Spirit and Opportunity rovers.
While Opportunity continues to be driven based on an earlier version of RSVP (the JPL team uses SVN to manage the code base), the basic architecture has remained the same for Curiosity, though it has been enhanced in a number of ways. For example, the HyperDrive component has been completely rewritten so it can support multiple missions. As Cooper puts it, “We separated the mission specific code (for Curiosity for example) from the code that would be applicable for any current or future mission. This will allow us to adapt it to future mission for much less work.”
They’ve also used lessons learned from Spirit and Opportunity to make driving Curiosity more efficient and less risky. All in all the team spent four years enhancing RSVP in preparation for Curiosity, though improvements and enhancement to the software continue as they learn more about the environment and terrain on which the rover is operating. “We have implemented many new graphics features in HyperDrive for instance after landing that help us drive safely on rough terrain and help use contact the ground with our arm mounted instruments,” Cooper said.
NASA, of course, is famous for developing “perfect” software for the space shuttle. RSVP, however, being software that is neither onboard the spacecraft nor involved in a manned mission, need not be perfect. However, before commands are sent to the rover, they go through a “carefully crafted process,” said Cooper, that includes human review (and simulation via HyperDrive) and automated checks. Any bugs in the code are logged and tracked via Jira.
As for their software development practices, the fact that the the development team members are, ultimately, also the end users makes project management a bit simpler. Cooper said that the team uses a mix of traditional software development practices and Agile methods, including pair programming (“More like small group programming,” according to Cooper) and daily standups.
While the RSVP code already has a long and distinguished history operating Mars rovers, it’s not being sunsetted anytime soon. Cooper said that RSVP has already been chosen as the control software for the InSight Lander, scheduled to reach Mars in 2016. He also hopes it will be chosen to drive another rover planned to launch in 2020.
Who knows? Maybe someday humans will go actually go to Mars and drive rovers directly (while, ironically, the cars on Earth may all be self-driving). In the meantime, the smart cookies at JPL will keep writing the code to keep those rovers moving and busy.