X
Tech

Flying on Mars fueled with open-source software

For the first time in history, we've flown an aircraft, the mini-helicopter Ingenuity, on another planet. Open-source software backed up its engineering.
Written by Steven Vaughan-Nichols, Senior Contributing Editor

A small miracle happened at 3:31am ET on Monday morning. Ingenuity, a tiny NASA helicopter, became the first powered aircraft to fly on another planet, Mars. This engineering feat was done with Linux, open-source software, and a NASA-built program based on the Jet Propulsion Laboratory's (JPL) open-source (pronounced F prime) framework.

At 11-light minutes from Earth, there was nothing easy about this. True, Mars has only a third of Earth's gravity, but Mars' atmosphere has only one-hundredth of the density of Earth's air. 

Indeed, Ingenuity is purely a technology demonstration. It's not designed to support the Perseverance mission, which is searching for signs of ancient life and collecting rock and dirt samples for later missions to return to Earth. Its mission is to show that it's possible to fly on Mars using commercial off-the-shelf (COTS) hardware and open-source software. 

GitHub CEO Nat Friedman and his team and the JPL Ingenuity crew took a long hard look into the helicopter's code and found that "nearly 12,000 developers on GitHub contributed to Ingenuity's software via open source. And yet, much like the first image of a black hole, most of these developers are not even aware that they helped make the first Martian helicopter flight possible." 

They'll know now. Friedman wrote: "Today, we want to make the invisible visible. So, we have worked with JPL to place a new Mars 2020 Helicopter Mission badge on the GitHub profile of every developer who contributed to the specific versions of any open-source projects and libraries used by Ingenuity.

The developer list was created by JPL providing GitHub with a comprehensive list of every version of every open source project used by Ingenuity. GitHub could then identify all the contributors who made these projects and their dependencies.

Some of those honored, such as Linux's creator Linus Torvalds, are famous developers. Many others labor in obscurity -- but now their work is being recognized. As GitHub's senior director of Developer Relations, Martin Woodward, explained: "Many of the people who are getting a badge probably have no idea their software is being used to fly a helicopter on another planet. We wanted to make sure everyone was recognized for their contributions to this incredible human achievement."

Woodward continued: "What we find is that there's a hierarchy of dependencies. A single project might have 10 or fewer dependencies, but they spider out from there, with each dependency relying on something else. Before you know it, you have an incredibly large number of people who have contributed to a project."

While the result, in this case, is extraordinary, almost all shipping software today relies on open-source components. Carol Willing, a core contributor to Python, added: "Much like dropping a pebble in a lake, your small contribution then ripples out to have a much larger impact. That's one of the beauties of open source, someone else can take your good work and make it even more powerful and meaningful."

For many contributors, it's great to see their abstract work turned into something so tangible as a tiny helicopter flying on Mars. "After spending a lot of time on bug fixes and maintenance, it's refreshing to hear about all the cool things Python is enabling," says Benjamin Peterson, another core Python maintainer and the creator of the Python compatibility library Six.

GitHub didn't recognize just the programmers. The company also gave credit to other open-source contributors. For example, Python core team member Mariatta Wijaya focuses mostly on community management, documentation, and building workflow tools that help the Python team function and keep the code usable. "Just creating pull requests is not enough," Wijaya said. "We still need to review code, document changes, and work with the community to decide what to build and how."

JPL developers have long used and contributed back to open-source projects. But, with F', for the first time, JPL started its own open-source project. That's because, according to Jeff Levison, JPL's supervisor of the small-scale flight software group, there were few applications for JPL's flight software outside of NASA. "It didn't make much sense before because our software was so tightly paired with custom hardware," explains Levison. "There wasn't really a driving need or benefit in releasing it to the public."

That isn't the case, however, with Ingenuity. Timothy Canham, a JPL embedded flight software engineer, explained the helicopter's program is powered by a Qualcomm Snapdragon 801 running at  2.2GHz. 

While that may sound painfully slow and old, it's far faster than the Mars Perseverance's rover processors. That's because NASA-grade CPUs and chips must meet NASA's High-Performance Spaceflight Computing (HPSC) radiation standards. These customized processors take years of design work and testing before they're certified for spaceflight. For instance, NASA's newest general-purpose processor is an ARM A53 variant you may know from the Raspberry Pi 3. Ingenuity, however, as a demo project can use a more ordinary, and thus a more modern, CPU.

The flight control software itself runs at 500Hz. That's hertz, not megahertz, Canham explained to ZDNet. The flight software "is used to control the flight hardware and read sensors 500 times per second in order to keep the helicopter stable." Indeed, Canham explained: "We literally ordered parts from SparkFun [Electronics]. This is commercial hardware, but we'll test it, and if it works well, we'll use it." Clearly, as we saw this morning, it does. 

JPL developed the first version of F´ in 2013. The idea was to create a reusable software framework for a variety of spaceflight projects that could be adapted to practically any hardware, purpose, or destination.

F´ marked a shift in how JPL worked, explains Mars helicopter operations lead at JPL Timothy Canham. Historically, JPL's software had been difficult to repurpose. It often contained context-specific functionality embedded deep within its code. To be widely reusable, F´ had to be modular, not bespoke. For example, the framework doesn't assume that engineers will use a particular brand of onboard camera -- or any camera at all. If you need to take photos, for example, you can add or remove specific components and functionality as needed. The same applies to any sensor or hardware instrument.

F´ isn't meant to be a spacecraft system in a box, Canham explains. It's more like a starter kit. There's a ground control system for sending commands to a device, a sequencer for running those commands, and a component for sending responses back to ground control. Although there's a standard library of components, you'll need to write a lot of your own software.

It quickly became apparent that F´ wasn't just reusable inside of JPL, but outside of it as well. CubeSats, small satellites made with off-the-shelf commercial hardware typically deployed in Low Earth Orbit (LEO), are now being widely used. "We'd been giving some talks about it, and we had faculty at Carnegie Mellon and other organizations that wanted to use it for their own CubeSat projects," Canham said. "We eventually realized it was easier for us to open source F´ than try to put people through the lengthy process of licensing the software." The team combed through the code to make sure there weren't any trade secrets or technologies controlled by international treaties and released it under the Apache License in July 2017.

Today, all these projects enabled Ingenuity to fly into Mars's thin pinkish sky. But when Elon Musk's first robotic Starship, Heart of Gold, flies to Mars later this decade, it too will be guided by Linux and open-source software.

Related Stories:

Editorial standards