The importance of software in space missions

by Andrea Di Mauro


Margaret Hamilton with the source code of the Apollo Guidance Program  (Source: Wikimedia Commons)

The fascination of space exploration lies not only in the immensity of discoveries and knowledge offered, but also due to the variety of disciplines and fields of study that it requires. From an early age, when we think of space, images of satellites, spacecraft, and/or rockets may often come to mind. Those of us who even dream of building some of these spacecraft in the near future cannot help but venture into the arduous but rewarding world of aerospace engineering. Quoting a famous piece from a Kennedy speech: “We choose to go to the moon in this decade and do the other things, not because they are easy, but because they are hard“. But the world of aerospace is the result of the cooperation of many equally complicated sectors, including software engineering.


From the computer to the stars

One of the first success stories of software in space missions is linked to the famous Apollo program and the landing on the Moon. At that time, there was still little to no talk in the public arena about software engineering, and even the C programming language was still only a newly born project in the AT&T laboratories. In fact, behind the success of the first Moon landing there are two components that proved crucial to preventing the mission from being abandoned at the last minute: the Apollo Guidance Computer and the process management software designed by computer scientist Margaret Hamilton. Due to a configuration error during the landing, the AGC received more data to process than it should have received at that time; thanks to the software, the on-board computer was able to recognize the anomalous situation and to interrupt the excess processes, thus allowing the lander to continue in the mission.


The importance of failure

The Mars Climate Orbiter (Credit: NASA/JPL-Caltech)

In the history that links the world of software with that of space there are not only success stories but also tales of failures that sometimes led to the loss of an entire spacecraft or the end of a mission. Two significant events are the loss of the Mars Climate Orbiter in 1999 and the explosion of an Ariane V rocket during launch in 1996.

The Mars Climate Orbiter was one of the two probes that were part of the Mars Surveyor program (together with the Mars Polar Lander), and their mission which aimed to study the meteorology, climate, and quantities of water and carbon dioxide of the planet Mars. The spacecraft was launched by a Delta II 7425 vector on December 11, 1998 from Cape Canaveral in Florida and reached Mars in September 1999. After an initial maneuver that would have allowed for insertion into orbit, the spacecraft was supposed to re-establish radio contact with Earth a few minutes later, but that never happened. 

The investigation that followed determined that the probe crashed into the Martian surface during its entry into the atmosphere due to an incorrect conversion factor for a velocity change value. The on-board and ground software used two different measurement systems (the British imperial system and the metric system).

The disaster of the Ariane V on the 4th of June, 1996 (Credit: ESA)

Perhaps less tragic but equally disastrous was the loss of an Ariane V rocket due to a software defect causing an error in computing the position and speed of the launcher some 30 seconds after launch. The wrong position value caused the onboard computer to send commands to the engines to change the direction of the launcher so swiftly that the structure was subject to high tensions. The software module indicted in this case was the IRS (Inertial Reference System), which was not designed specifically for the Ariane V but taken from the Ariane IV. The value of horizontal bias used to represent the rocket’s pointing direction would never exceed values that cannot be represented in a 16-bit variable in the Ariane IV. This was not true for the Ariane V where a 64-bit variable was needed and representing the latter in a 16-bit one would have led to an incorrect interpretation of error by the onboard computer and consequently to the sending of incorrect commands to the motors for the correction of the trajectory. The wrong choice in this case was the reuse of an Ariane IV module which was therefore unable to process the characteristics and physical variables of the Ariane V route, much more powerful than its predecessor. Attempting to save money in the testing phase resulted in the loss of millions of dollars.

The stories of the Apollo mission, the Mars Climate Orbiter, and the Ariane V demonstrate how software is a critical factor in the success of a space mission, but also how this discipline is extremely difficult to operate correctly. Software engineering is in fact a world where preparation and collaboration play fundamental roles. However, precisely because perfection does not exist in the computer world and the phrase “making mistakes you learn” will never stop being true, errors and defects will never cease to exist. Taking a more recent example, the inaugural launch of the Falcon Heavy on February 6, 2018 was only a success thanks to numerous failed tests by SpaceX in previous years.

Falcon Heavy boosters landing (Credit: SpaceX)

An open source future

The Github badge for Ingenuity software contributions (Credit: github.blog)

For some years now, the universe of open source software has also built its foundations within projects and missions concerning space. On more than one occasion, open source projects born from the passion and effort of space enthusiasts have been chosen as the basis for building the core of a guidance or flight system for a rover or nanosatellite. And this is the case of one of the most interesting and spectacular landings of a planetary mission carried out last February — NASA’s Mars 2020 mission with the Mars Perseverance rover and its travel companion Ingenuity (the first aircraft to perform a controlled flight on another planet). 

Ingenuity mounts on-board the F Prime software framework developed a few years ago by JPL and later made open source thus allowing anyone to propose and implement improvements. On April 14, 2021, the hosting platform for open source projects GitHub decided to promote with a special badge dedicated to the mission all users who have contributed with their work to the creation and improvement of the libraries and projects used for Ingenuity’s on-board software.


Conclusions

Although the events described above are strongly linked exclusively to control software, software engineering is widespread within aerospace thanks to its variety and its possibilities of applications in various fields — ranging from robotics and artificial intelligence to increasing use in satellite image processing contexts. It is hard to think about the future of space exploration without computer science, which is why any one of us who is passionate in this field can contribute in their own way to reach the stars!


References

Open source on Mars
The worst computer bugs in history: the disaster of the Ariane V
Meet the Open-Source Software Powering NASA’s Ingenuity Mars Helicopter
In Depth: Mars Climate Orbiter
Margaret Hamilton Wikipedia Page


Andrea Di Mauro is a Computer Science Engineering student at Polytechnic University of Turin/PoliTO with specialization in Software development and Research Associate for the BMSIS Young Scientist Program.