Linux on Mars!
Open-source software on the Perseverance mission is helping NASA explore a GNU world
On 19 April 2021, powered flight on another world took place for the first time. When a 1.8kg drone successfully lifted 3m from Mars’ dusty surface for less than a minute, it wasn’t simply another small step for humanity exploring the universe: it was also a giant leap for open-source software. For this tiny drone is powered by Linux.
The drone’s name is Ingenuity, although NASA also refers to it as the Mars Helicopter (for reasons that become obvious once you see it). The project is highly experimental, with future flights only expected to last for 90 seconds and the mission itself slated to run for 30 days, but the technology could lead to future Mars missions that deploy drones to explore and collect samples, covering a much vaster swathe of the planet’s surface than a ground-based rover could ever manage.
The flight was the culmination of years of preparation for the helicopter team who, like everyone else, had been forced to spend much of Perseverance’s nine-month journey to Mars working from home. “It’s been a little surreal to sit here in my [home] office, where you can see me executing commands on a spacecraft that’s right on the way to Mars,” said Tim Canham, Mars helicopter operations lead at NASA’s Jet Propulsion Laboratory (JPL), speaking exclusively to our sister publication PC Pro before the first flight.
“Every week or two, we would log on and basically send the commands to charge the helicopter and watch it as the battery would charge up.”
Now that the rover has landed, and the helicopter has completed its debut flights on Mars, the real work can begin.
“It was actually a fairly simple decision,” says Canham of the choice to use Linux for the craft. “We were looking for a particular processor board that would work for the helicopter. It had to be very small and compact, and have tons and tons of processing power. And so we did a big search around the web and found one that was designed by Qualcomm and built by a company called Intrinsic.”
The board was based on a Snapdragon 801 chip, as found on Earth inside older devices such as the HTC One and the Sony Xperia Z3 (released in 2013 and 2014 respectively). The age of the technology wasn’t a major concern to NASA; much more important was the fact that the whole thing was only around the size of a credit card. The craft needed to be as light and small as possible, since Mars has a much lower atmospheric density than Earth, making it harder for helicopter blades to provide lift.
The only real catch was that the proprietary VxWorks software platform used for the main rover wouldn’t work on the Qualcomm chip – so NASA was forced to look for an alternative operating system.
“Linux in some ways was selected for us, but we still like it a lot. It’s easy to work with and easy to reconfigure, and uses a lot of standard interfaces,” says Canham.
In fact, many of the required drivers and software had already been written for other open-source projects, saving JPL a lot of time and work. “There were lots of man-hours that went into developing the code before it ever got to the helicopter,” Canham explains. “We were able to just say, yeah, we know all that stuff works, we can concentrate on the part that’s specific to the helicopter and implement it.”
As a result, one of the most high-profile aspects of the $2.7 billion Perseverance mission was handled by a surprisingly small team. “At the peak of our development, we had about four or five developers working on the software,” says Canham of his helicopter colleagues.
This helicopter was also able to take advantage of commodity hardware components. “We took the cameras, which are little half-gram-square cameras that are very similar to the cameras that you find on your cellphone, and we just put them on the helicopter.” As a result, the small helicopter that’s currently on Mars can capture 13MP colour images that far outshine the 2MP main camera on Curiosity, NASA’s previous rover that landed on Mars in 2012.
Despite using tried-and-tested components, the team didn’t take reliability for granted. “We had a really extensive test programme,” says Canham. “We’ve actually been working on this particular iteration of the helicopter for almost four and a half years.”
He describes how JPL used a special pressure chamber to test spacecraft. The atmosphere inside was pumped down to Mars pressure, so the team could see if the helicopter could take off under such circumstances. “The processor and the OS really went through the wringer during that testing,” he says. “It was lots and lots and lots of testing.”
But the fact that the helicopter runs Linux definitely made life easier. When the helicopter was inside the pressure chamber, the team was able to update or tweak the software without having to remove the drone and re-pressurise. As with any other Linux machine, they could connect via SSH over Wi-Fi and make the changes required remotely.
“Really, it was just a drone development kit that you could buy and add your own drone hardware to it,” Canham explains. “So, yes, it most certainly saved us time, because we had all that code already in the bag.
“You can think of it like Tinkertoys or Lego, where you have these pieces and you know how they fit together, and you can just reuse them again and again, and not have to reinvest time and testing and all those other things,” he says. “That’s part of the strength of that whole component-based software framework.”
When the helicopter takes flight, it doesn’t directly communicate with the main Perseverance rover software. To manage flight communications, it speaks to a second Linux machine on the rover, which acts as a helicopter base station. Technologically speaking, the base station is almost identical to the helicopter, with the same processor and same radio communication hardware – so that’s a second Linux installation running on Mars.
But that’s not all. There’s actually a third Linux box on Mars too, and we’ve already seen it in action. Shortly after the Perseverence rover landed on the Martian surface, NASA released a stunning video of the descent, showing multiple views of what’s famously known as the “seven minutes of terror” – the period of time when, because of the time lag in communications, NASA engineers were unable to guide or control the rover on its final approach.
First, we see a view looking upwards at the parachute deploying. Then a downward view of the Martian surface as the heat shield is detached from the lander and falls to the ground. Finally – and most spectacularly – we watch the lander deploy the “sky crane”, a system that uses rocket thrusters to dangle the now-uncovered rover below and gently deposit it on the surface of the planet.
It wasn’t the first time such a method has been used – Curiosity employed a similar system, albeit on a significantly smaller rover – but it was the first time such a landing has been captured in such detail, in such high resolution, at a frame rate comparable to normal video. And this video was captured on a Linux machine that was included for that sole purpose.
“It’s basically an Intel Atom box,” says Canham. “They wrote software that would just frantically record all these video streams to storage.”
As with the helicopter, the team responsible for the box used fairly standardised parts. The six cameras were regular USB Chameleon3 cameras, made by FLIR. Five of them capture video at 1.3MP, while the sixth goes up to 3.2MP. “They just took a ruggedised PC, stuck it on [the rover] and ran USB all over the place on the rover,” says Canham.
As another illustration of the power of standard platforms, NASA later revealed that the video footage captured during the landing was processed by the open-source FFmpeg encoder before being sent back to Earth. This is the exact same app used by millions of people for transcoding video. It’s a remarkable thought that if you’ve ever submitted an update or a tweak to the FFmpeg project then your code may have run on Mars.
Forging new discoveries
Perseverance’s helicopter and landing cameras were an open-source first for the Red Planet, but JPL has been working with open source for much longer. In fact, one of the reasons the helicopter team was so small was because the agency had already created its own open-source flight software framework, known as F Prime.
This is an open-source toolkit that anyone can download from GitHub, and it takes care of many of the technical aspects of controlling a spacecraft. Consequently, the software has already been used by a number of instruments that are already in space.
The first of these was a module housed on the International Space Station (ISS) called RapidScat, a scatterometer used to monitor ocean winds in real-time. Launched in 2014 and in use until 2016, it proved a valuable device for weather forecasters, as it helped predict the emergence of hurricanes. It also served as a proving ground for F Prime in space, enabling NASA to subsequently decommission an old wind-monitoring satellite and replace it with a much cheaper design.
The open-source software is also now being used by several different universities that are developing their own CubeSats – a class of satellite pioneered in the early 2000s that takes advantage of the same commodity parts boom as the Ingenuity helicopter. CubeSats can be built much more cheaply than a traditional satellite, are physically much smaller and are relatively standardised in terms of shape, meaning multiple units can be packed tightly together and launched from a single rocket.
In November 2021, two CubeSats running F Prime code will be blasting off as part of the Artemis 1 mission, which is NASA’s first attempt at returning to the Moon since the 1970s. Part of the mission payload will be a CubeSat called Lunar Flashlight, which will attempt to map the Moon’s South Pole and look for signs of water and ice deposits. There’s also the Near Earth Asteroid Scout, a CubeSat that will attempt to get up close with a near-earth object called “1991 VG” and determine its origins.
Ultimately, open-source software could mean that future rovers, satellites and other space technologies can be iterated and developed more quickly and efficiently. Although Linux may still struggle to find a place on the desktop on Earth, the operating system might have just found its place among the stars.
The definitive guide to warehouse efficiency
Get your free guide to creating efficiencies in the warehouseFree download
The total economic impact™ of Datto
Cost savings and business benefits of using Datto Integrated SolutionsDownload now
Three-step guide to modern customer experience
Support the critical role CX plays in your businessFree download
The global state of the channelDownload now