View on GitHub

Flight Software & Embedded Systems Framework

Adding Telemetry

In this Section

In this section of the tutorial, you will add a telemetry channel to report the number of math operations the MathReceiver has performed.

Before reading these steps, do your best to look at the existing files in this tutorial and implement a telemetry channel on your own.

  1. Add a telemetry channel to MathReceiver.fpp:
# In: MathReceiver.fpp, under the Telemetry section
@ Number of math operations 
    telemetry NUMBER_OF_OPS: U32 

Explanation: Here you defined a telemetry channel which you arbitrarily named NUMBER_OF_OPS which carries a 32 bit unsigned integer.

  1. Add a member variable to MathReceiver.hpp:
// In: MathReceiver.hpp
// Under: PRIVATE
U32 numMathOps; 
  1. Update the constructor so that it initializes numMathOps to zero:
// In: MathReceiver.cpp 
// Under: Construction, Initialization, and Destruction 
MathReceiver ::
        const char *const compName
    ) : MathReceiverComponentBase(compName),

  1. Increment numMathOps:
// In: MathReceiver.cpp 
// Within mathOpIn_handler
  1. Emit telemetry:
    // In: MathReceiver.cpp 
    // Within: mathOpIn_handler
    // After: numMathOps++

    Note: This function will get autocoded by FPP since we defined the telemetry channel.

  2. Add the channel to the pre-existing MathReceiver packet in MathDeploymentPackets.xml:
    <!-- In: MathDeploymentPackets.xml -->
    <packet name="MathReceiver" id="22" level="3">
        <channel name = "mathReceiver.OPERATION"/>
        <channel name = "mathReceiver.FACTOR"/>
        <channel name = "mathReceiver.NUMBER_OF_OPS"/>  <!-- Add this line -->
  1. Build and test:
# In: MathProject
fprime-util build -j4 

Send a command and verify that the channel gets value 1.

Write some unit tests to prove that this channel is working.


In this section you defined a telemetry channel and implemented a new variable, that will be sent through the channel.

Next: Error handling 1