Spacecraft Software Basics

Key Points

  • Spacecraft software is the brains of the otherwise dead hardware.

  • You can’t always talk with your satellite as it circles the Earth, so your software needs to be able to run the spacecraft on its own, even when something goes wrong. Thinking about and programming all the way things can go wrong is a big job.

  • Space computers are usually older and slower than computers on the ground because they need to survive the harsh environment of space. Flight software programmers need to be efficient with their code.

Introduction

Spacecraft are a lot like robots on Earth. They both have things that move, they have sensors such as cameras, and they’ve got to operate without human help sometimes. Bringing in all the data, processing it, figuring out what to do, doing it, then making sure you did it correctly are all normal tasks for spacecraft. This is a big job.

In fact, flight software programmers are always in demand. A quick visit to any job board will usually list plenty of open positions. Programs are often behind schedule because there’s a backlog of flight software that needs to be written. (It’s worth pointing out that software can’t get written until the other engineers decide for sure which hardware they’re going to use.)

 

Programming Languages

Almost all flight software is written with C, C++, and (sometimes) Assembly. Some simple spacecraft run the code as embedded software on boards, like a Raspberry Pi or an Arduino. More complicated spacecraft run an operating system that the code is compiled to.

Most code uses libraries built up by companies over years. There’s been a push to get the industry on a few standards, though, such as the Core Flight Software system developed by NASA. Some subsystems, like control software, are written in a program like Simulink that can export C or C++ code.

Scripting languages like Python or Ruby are not typically used on spacecraft because the hardware needs to squeeze every bit of performance out of its code and scripting languages take too much overhead and are too slow.

 

Operating Systems

Spacecraft do better when they can control the timing in a real-time or near real-time operating system. Some companies use custom versions of Linux that are close enough to real-time. Other companies go with a commercial solution like VxWorks. Choosing the operating system is one of the first things that the software lead needs to do.

 

Dealing with Space

Radiation challenges flight computers in ways such as creating false signals, shorting circuits, or adding a bunch of noise to sensors. Flight software needs to be robust to these events. One way programmers do this is by using a watchdog timer. If this timer doesn’t get a signal at a certain time, it assumes something has crashed and it will automatically restart the flight computer. Another trick is to keep the critical flight software in protected memory that boots quickly. And another trick is to have multiple flight computers so if one fails, the mission operators can load the other computer. And one more trick is to have a “safe mode” where the computer will stop all non-critical work so the computer has plenty of processing power to figure out what went wrong.

 

Core Flight Software

For many years, every company and even every satellite had special flight software. Each new mission brought new requirements and programmers would write efficient, highly customized code. When a new mission started, the programming team would find they couldn’t reuse a lot of their hard work.

NASA Goddard decided it was time to do things differently and they started the Core Flight Software project, which you’ll see written as cFS. The cFS is an architecture and framework for how to structure code for spacecraft of all types. They also include libraries for things like handling communications, managing buffers, booting up, and more. And then NASA certified it, which can save programs working for the government many months. NASA is also working on certifying it for human-rated missions, which is a big deal.

 

Curated Videos

  1. https://www.youtube.com/c/FlightSoftwareWorkshop/videos
    Johns Hopkins hosts an annual flight software workshop and puts the content online. This link is for the YouTube channel. The link to the flight software page is in the curated links below.

  2. https://www.youtube.com/watch?v=N5faA2MZ6jY
    SpaceX has been changing the way flight software is written. This excellent video talks about the challenges they face and the solutions they’ve come up with.

  3. https://www.youtube.com/watch?v=gSsV6fDEcAc
    NASA’s Core Flight Software has tremendous potential to simplify software architecture development. The OpenSatKit team has bundled several open-source software packages for you to get started with and then backed them up with a series of YouTube videos, such as this one.



Curated Links

  1. https://pressbooks-dev.oer.hawaii.edu/epet302/chapter/6-7/
    The University of Hawaii maintains an online textbook for small satellites. Their page on software is excellent, although it does cover quite a bit more than just flight software.

  2. https://www.scielo.br/j/jatm/a/ZNY8mTKcbh8MT5xvbvyytqG/?format=pdf&lang=en
    The authors of this paper compare the various flight software frameworks. It’s a great resource if you’re starting a new program and are considering this decision.

  3. https://cfs.gsfc.nasa.gov/Introduction.html
    This is the home page for NASA’s Core Flight Software. If you click on the Publications tab, you can find their overview slides. There are several hundred slides packed with information.

  4. http://flightsoftware.jhuapl.edu/
    This is the page for the flight software workshops hosted by Johns Hopkins. They host a conference every year. It's a great place to learn from, and to network with, the developers writing code for space missions.