Notes /
CFETutorialcore Flight Executive TutorialAugust 11, 2014 NASA's core Flight Executive is open source and available at code.nasa.gov. It is a framework for writing flight software for embedded systems. Should show the layers of the system... rt-OS -> OSAL -> cFE -> Apps & Libs The applications form a Graph of nodes communicating by passing messages. For a starting example, I am going to create two applications; one to create and publish simulated sensor data and other to receive and process the data. This gives us a small enough problem to tackle while introducing most aspects of the system. I'll be using the pc-linux version. Part 1: sim_sensorWhy did no one tell me about the tree program?Need to update picture: msg.h has to be in a directory that is available to other programs. A) Basic Setup This is modeled after the sample_app, which has the following directories / files shown to the right. We'll follow this, but swapping "sample" for "sim_sensor" for the file names and within the files.
Creating 8 new files for every single new application is a pain, so I made a python script to automate it: new_app.tar.gz. It includes the python script (new_application.py), a text file for defining the name of the new application (var.table), and template files (Template/*) which are modified from the sample_app files. To use:
We are going to gut a lot of this to make an even simpler working example, and then add in functionality bit by bit once we have it building. B) Building and Running We should now have a sim_sensor application which is identical to the sample application in all but name. Soon we will modify it for our own example setup, but for now we can make sure that our build system is working.
$(MAKE) -C sample_lib $(MAKE) -C sample_app $(MAKE) -C sim_sensor_app
rm -rf sim_sensor_app mkdir sim_sensor_app cp ../../apps/sim_sensor_app/fsw/for_build/* ./sim_sensor_app/ cp ../../apps/sim_sensor_app/fsw/platform_inc/* ./inc/ cp ../../apps/sim_sensor_app/fsw/mission_inc/* ../mission_inc/
In the output, you should see a line that reads: This means that the new application has been loaded and initialized. App LifeAn application will only be started in cFE if Main run loop Cleanup Just run with printf()s. Pub / Sub / MessagesA simple graph with two applications and their communication. To do anything interesting, we need to set up communication between two different applications. We will add a control application that will receive data messages from the sensor application, as well as send commands to change the mode of the sensor. This will all be done with messages, although cFE also supports events. Messages are defined in a header which must be included in all applications that use that type (thus the `/fsw/public_inc/` directory). This header defines the data types. Look into automating this a bit, maybe even an Interface Description Language (but that would be a lot of work). In the SimSensor application we define the messages data, and in the main code we occasionally publish a message. To receive the message, an application must first create a "pipe" (more accurately a "queue"), which subscribes to those messages. This pipe can then be checked periodically for new messages, which cFE delivers magically. Part 2: sim_controlTo receive the data from the sensor, we can make a new application: sim_control. Common ErrorsUndefined symbol. Name of pipe was too long. Include error defines. |