What is the App Layer?

We're working on a video! In the meantime, we hope this article helps.

 

Motivation

If you spend weeks and months creating a robust guidance, navigation, and control algorithm for reaction wheels, wouldn't you like to use that on a new spacecraft by just copying the folder over and installing it? Or if you've been clever about an encryption routine, wouldn't it be great to use it on drones, spacecraft, submarines, and more with zero modification? So, even if the hardware and operating system are wildly different between platforms, everything just works?

NASA's vision is simple: let you develop apps like you would for an iPhone or Android. An app from the Apple Store can be run on an iPhone, iPad, or MacBook. If a developer does something cool, they can trust that others can use it just by downloading and installing it.

 

The Application Layer

In the Core Flight System, the Application Layer is the highest layer. It's far away from the board and operating system and lower-level "guts" of the code. It has no idea what's happening below it, which is what makes it great for developers. You write your app to a common interface without having to worry about resources, fault tolerance, and so on.

There are two groups of things that live here:

1. Apps: Apps register and talk with the Core Flight Executive layer. Apps that want to talk with other apps communicate through the Software Bus of the Executive Layer. For instance, a popular app is Scheduler (SCH), which can turn your own app on and off, send data to it at regular intervals, and do other time-based actions.  Your app wouldn't call the Scheduler directly, it would send a message on the Software Bus with a header saying it's meant for the Scheduler, which would then be routed to it. This may seem like an extra step but it's what makes the system flexible and portable.

2. Libraries: Libraries are files with common functions and utilities. For example, unit conversion may be needed by many apps so you write a library they can call instead of duplicating code. Note, though, that libraries can only be called on to process data in some way and return a result. They don't get scheduled or linked to resources in the same way as Apps.

 

Quick Notes

- There are no functions or infrastructure in the Application Layer. Your apps plug into the sockets created by the Executive Layer.

- All apps have to have certain functions. NASA has created templates for you to help get things started correctly.