WarpTwin
Documentation for WarpTwin models and classes.
Loading...
Searching...
No Matches
warpos::TelemetryManager Class Reference

App which manages all telemetry output from the flight system. More...

#include <TelemetryManager.h>

Inheritance diagram for warpos::TelemetryManager:

Classes

struct  Params

Public Member Functions

 TelemetryManager (FlightExecutive &exc)
 Only available flight executive constructor.
virtual ~TelemetryManager ()
int16 addTlmToQueue (const cmd_tlm_base &pkt, uint8 instance)
 Add a telemetry packet to the queue.
int16 writeQueues (void *tlm_ptr, uint32 size, const PacketInfo &tlminfo, tlm_priority_e priority)
 Function to add telem packets to queue while checking for space.
int16 registerTlmPacket (uint16 tlm_apid, uint8 instance)
 Register a telemetry packet by adding it to the table.
int16 configureTlmPacket (const PacketTypeInfo &info)
 Register a telemetry packet by adding its metadata to the table.
uint32 queueCountNormalPri ()
 Get the number of packets in the standard queue.
uint32 queueCountHighPri ()
 Get the number of packets in the high priority queue.
int16 activate () override
 Activate the app. The app will step when active.
int16 deactivate () override
 Deactivate the app. The app will not step when deactivated.
int16 command (uint16 apid, uint8 *buffer, uint16 size) override
 Process commands issued to the app.
uint16 numRegisteredPackets ()
 Get the number of registered telemetry packets.
PacketTypeInforegisteredPackets ()
 Get the telemetry table.
clockwerk::Queue< uint8, TLM_NORMAL_PRI_QUEUE_SIZE_BYTES > & tlmNormalPriByteQueue ()
 Handle to _tlm_normal_byte_queue used for unit testing.
clockwerk::Queue< PacketInfo, TLM_NORMAL_PRI_QUEUE_SIZE_PKTS > & tlmNormalPriInfoQueue ()
 Handle to _tlm_normal_info_queue used for unit testing.
clockwerk::Queue< uint8, TLM_HIGH_PRI_QUEUE_SIZE_BYTES > & tlmHighPriByteQueue ()
 Handle to _tlm_high_byte_queue used for unit testing.
clockwerk::Queue< PacketInfo, TLM_HIGH_PRI_QUEUE_SIZE_PKTS > & tlmHighPriInfoQueue ()
 Handle to _tlm_high_info_queue used for unit testing.
Public Member Functions inherited from warpos::App
 App (FlightExecutive &executive, const char *name, uint16 apid, uint8 instance=0)
 Executive-based constructor for the task.
virtual ~App ()
 Destructor. Doesn't really do anything.
int16 startup ()
 Initialize the app. Should be called once before step.
int16 step ()
 Step the app by a single step. Maps params, inputs, etc. to outputs.
log_level_e logLevel ()
 Get the log level set for the executive.
void logLevel (log_level_e log_level)
 Set the executive log level.
bool isStarted ()
 Return whether task startup has been run.
uint16 apid ()
 Get the apid for this app.
uint8 & instance ()
 Get the instance of this app (used to differentiate between multiple instances of the same app).
Public Member Functions inherited from clockwerk::GraphTreeObject
 GraphTreeObject (const char *gt_nme="", GraphTreeObject **storage_array=nullptr, uint32 storage_size=0)
 Name-based constructor for GraphTreeObject which will have no children by default.
virtual ~GraphTreeObject ()
 Destructor.
GraphTreeObjectparent ()
 Functions to get object's parent/children.
GraphTreeObject ** children ()
GraphTreeObjectchildAtIndex (uint8 i) const
int16 parent (GraphTreeObject *new_parent)
 Function to assign the node's parent via pointer.
int16 parent (GraphTreeObject &new_parent)
 Function to assign the node's parent via reference.
uint8 nChildren () const
 Getters for number of children and descendants.
uint16 nDescendants () const
uint8 capacity () const
const char * name () const
 Getter and setter for object name.
int16 name (const char *new_name)
uint8 rank ()
 Getter for the object rank.
int8 type ()
 Function to indicate type – -1 by default unless implemented downstream.
bool loggable ()
 Getter for object logability flag – note no setter because should only be set by this or a derived class in its definition.
GraphTreeObjectgetRootDataPointer ()
 Get the pointer to the highest object in the graph tree.
virtual int16 str (char *output, size_t size) const
 Get object represented as string.
virtual int16 fromStr (const char *val)
 Set value of graphtreeobject from string.

Public Attributes

Params params = Params(this, "params")
Public Attributes inherited from warpos::App
clockwerk::DataIO< bool > active = clockwerk::DataIO<bool>(this, "active", true)
 The active flag for the task – set to true by default.

Protected Member Functions

int16 start () override
int16 execute () override
uint32 _sendNextTlmPacket ()
 Send the next telemetry packet.
int32 _findPktIndex (uint16 apid, uint8 instance)
 Find index of packet in tlm table matching apid.
Protected Member Functions inherited from clockwerk::GraphTreeObject
int16 _setStorage (GraphTreeObject **storage_array, uint8 storage_size)
 Getter for object's string address.
void _recalculateDescendants ()
 Function to recursively re-calculate the number of descendants of a given node on the tree.
void _recalculateRank ()
 Function to recursively re-calculate the rank of a given node on the tree.
int16 _addChild (GraphTreeObject *child)
 Function to decompose a string into a series of substrings via indexing.
int16 _removeChild (GraphTreeObject *child)
 Function to remove a child from the graph node's children.

Protected Attributes

clockwerk::Queue< uint8, TLM_NORMAL_PRI_QUEUE_SIZE_BYTES > _tlm_normal_byte_queue
clockwerk::Queue< PacketInfo, TLM_NORMAL_PRI_QUEUE_SIZE_PKTS > _tlm_normal_info_queue
 Normal priority queue of telemetry packets.
clockwerk::Queue< uint8, TLM_HIGH_PRI_QUEUE_SIZE_BYTES > _tlm_high_byte_queue
 Normal priority queue of telemetry packet metadata structs.
clockwerk::Queue< PacketInfo, TLM_HIGH_PRI_QUEUE_SIZE_PKTS > _tlm_high_info_queue
 High priority queue of telemetry packets.
PacketTypeInfo _tlm_table [MAX_TLM_TABLE_SIZE]
 High priority queue of telemetry packet metadata structs.
char _print_buff [200]
 Table of telemetry packet metadata.
uint16 _tlm_table_idx = 0
 Current index in the telemetry table.
uint8 _byte_queue_error = 0
 Count of dropped packets due to queueing errors.
uint8 _ccsds_failure = 0
 Count of dropped packets due to CCSDS failures.
uint8 _telem_write_error = 0
 Count of dropped packets due to interface error.
uint8 _buffer_overwrite = 0
 Count of dropped packets due to overwitten packets.
uint8 _successful_packets = 0
 Count of successfully sent packets.
tlm_tlm_mngr_status _status_tlm
uint8 _tlm_packet [sizeof(_status_tlm)]
 Telemetry manager status telemetry packet.
uint8 _packetized_data [CMD_TLM_PKT_MAX_SIZE_BYTES]
 Buffer to hold packetization of status packet.
Protected Attributes inherited from warpos::App
FlightExecutiveexc
 Override our executive to include the FlightExecutive instead.
int16 _error = 0
 Internal variable to track and return error on app step through.
uint16 _apid = 0
 Internal variable to hold the APID for this app.
bool _is_started = false
 Flag indicating whether app has been started or not.
log_level_e _local_log_level = log_level_e::LOG_WARNING
 The log level for this particular app.
GraphTreeObject_app_children [MAXIMUM_APP_CHILDREN]
 Local storage for App children so it can live on the graph tree.
uint8 _instance
 Instance number of this app. Used to differentiate between multiple instances of the same app.
Protected Attributes inherited from clockwerk::GraphTreeObject
GraphTreeObject_parent = nullptr
GraphTreeObject ** _children_ptr = nullptr
uint32 _max_num_children = 0
uint16 _num_descendants = 0
char _name [MAXIMUM_NAME_CHARS] = ""
 String name for object.
uint8 _num_children = 0
 Number of direct children of the tree (not including the tree itself).
uint8 _rank = 0
int8 _graph_tree_type = BASE_GRAPH_TREE
 Variable to store graph tree object type.
bool _loggable = false
 Variable to indicate whether the selected object is loggable. Set to false by default.
uint32 _index = 0
 Index pointing to the next write location for the graph tree children.

Detailed Description

App which manages all telemetry output from the flight system.

The telemetry manager is a specialized app which is provided as part of the Flight Executive and manages all telemetry output from the flight system. The telemetry manager acts as a collector for all packets defined in the system and a single interface with the hardware for communication. The hardware interface is abstracted and may be redirected to any output source.

Telemetry manager manages two telemetry queues, high priority and normal priority. The normal priority queue should be used for almost all telemetry, including errors and other important (but not time critical) items. The high priority queue should be reserved for time-critical tasks. Internally, the normal priority queue is cleared only after the high priority queue is empty.

Note
Usage CONOPS:
Register telemetry type by creating a PacketTypeInfo struct and calling registerTlmPacket
Add telemetry packets to the queue by calling addTlmToQueue
Telemetry packets will be added to the queue if they are due per their prescribed rates
// TODO Rework app to be a bit cleaner and more readable

Constructor & Destructor Documentation

◆ TelemetryManager()

warpos::TelemetryManager::TelemetryManager ( FlightExecutive & exc)

Only available flight executive constructor.

Parameters
excPointer to executive object
setupHandle to hardware setup for writeTelemetry
Note
Implicitly names task "telemetry". Cannot have any other name

◆ ~TelemetryManager()

warpos::TelemetryManager::~TelemetryManager ( )
virtual

Member Function Documentation

◆ _findPktIndex()

int32 warpos::TelemetryManager::_findPktIndex ( uint16 apid,
uint8 instance )
protected

Find index of packet in tlm table matching apid.

Parameters
apidThe apid to seek
instancethe instance of the apid to seek
Returns
The (always positive) table index of the packet. -1 if not found

◆ _sendNextTlmPacket()

uint32 warpos::TelemetryManager::_sendNextTlmPacket ( )
protected

Send the next telemetry packet.

Returns
The number of bytes sent

◆ activate()

int16 warpos::TelemetryManager::activate ( )
overridevirtual

Activate the app. The app will step when active.

Returns
Flag indicating success/failure

Reimplemented from warpos::App.

◆ addTlmToQueue()

int16 warpos::TelemetryManager::addTlmToQueue ( const cmd_tlm_base & pkt,
uint8 instance )

Add a telemetry packet to the queue.

Parameters
pktAn command/telemetry packet object with apid, size, and packetize function
instancethe instance of the apid
Note
The error code return is for testability, but might not be checked within apps

◆ command()

int16 warpos::TelemetryManager::command ( uint16 apid,
uint8 * buffer,
uint16 size )
overridevirtual

Process commands issued to the app.

Parameters
apidThe apid of the command to execute
bufferThe buffer of command data
sizeThe size of the command data buffer
Returns
Flag indicating success/failure

Reimplemented from warpos::App.

◆ configureTlmPacket()

int16 warpos::TelemetryManager::configureTlmPacket ( const PacketTypeInfo & info)

Register a telemetry packet by adding its metadata to the table.

Parameters
tlm_infoPacketTypeInfo instance containing data to add to table
Returns
Error code corresponding to success/failure

◆ deactivate()

int16 warpos::TelemetryManager::deactivate ( )
overridevirtual

Deactivate the app. The app will not step when deactivated.

Returns
Flag indicating success/failure

Reimplemented from warpos::App.

◆ execute()

int16 warpos::TelemetryManager::execute ( )
overrideprotectedvirtual

Reimplemented from warpos::App.

◆ numRegisteredPackets()

uint16 warpos::TelemetryManager::numRegisteredPackets ( )
inline

Get the number of registered telemetry packets.

Returns
Number of registered telemetry packets

◆ queueCountHighPri()

uint32 warpos::TelemetryManager::queueCountHighPri ( )
inline

Get the number of packets in the high priority queue.

Returns
The number of packets currently stored in the queue

◆ queueCountNormalPri()

uint32 warpos::TelemetryManager::queueCountNormalPri ( )
inline

Get the number of packets in the standard queue.

Returns
The number of packets currently stored in the queue

◆ registeredPackets()

PacketTypeInfo * warpos::TelemetryManager::registeredPackets ( )
inline

Get the telemetry table.

Returns
Pointer to the first item in the tlm table

◆ registerTlmPacket()

int16 warpos::TelemetryManager::registerTlmPacket ( uint16 tlm_apid,
uint8 instance )

Register a telemetry packet by adding it to the table.

Parameters
tlm_apidThe apid of the telemetry to register
instanceInstance of the telemetry apid
Returns
Error code corresponding to success/failure

◆ start()

int16 warpos::TelemetryManager::start ( )
overrideprotectedvirtual

Reimplemented from warpos::App.

◆ tlmHighPriByteQueue()

clockwerk::Queue< uint8, TLM_HIGH_PRI_QUEUE_SIZE_BYTES > & warpos::TelemetryManager::tlmHighPriByteQueue ( )
inline

Handle to _tlm_high_byte_queue used for unit testing.

Returns
Handle to _tlm_high_byte_queue

◆ tlmHighPriInfoQueue()

clockwerk::Queue< PacketInfo, TLM_HIGH_PRI_QUEUE_SIZE_PKTS > & warpos::TelemetryManager::tlmHighPriInfoQueue ( )
inline

Handle to _tlm_high_info_queue used for unit testing.

Returns
Handle to _tlm_high_info_queue

◆ tlmNormalPriByteQueue()

clockwerk::Queue< uint8, TLM_NORMAL_PRI_QUEUE_SIZE_BYTES > & warpos::TelemetryManager::tlmNormalPriByteQueue ( )
inline

Handle to _tlm_normal_byte_queue used for unit testing.

Returns
Handle to _tlm_normal_byte_queue

◆ tlmNormalPriInfoQueue()

clockwerk::Queue< PacketInfo, TLM_NORMAL_PRI_QUEUE_SIZE_PKTS > & warpos::TelemetryManager::tlmNormalPriInfoQueue ( )
inline

Handle to _tlm_normal_info_queue used for unit testing.

Returns
Handle to _tlm_normal_info_queue

◆ writeQueues()

int16 warpos::TelemetryManager::writeQueues ( void * tlm_ptr,
uint32 size,
const PacketInfo & tlminfo,
tlm_priority_e priority )

Function to add telem packets to queue while checking for space.

Parameters
tlm_ptrpointer to the telemetry packet
sizesize of the telemetry packet
tlminfoinformation struct for the packet
priorityPriority of the packet (high or normal)
Returns
Error code corresponding to success/failure

Member Data Documentation

◆ _buffer_overwrite

uint8 warpos::TelemetryManager::_buffer_overwrite = 0
protected

Count of dropped packets due to overwitten packets.

◆ _byte_queue_error

uint8 warpos::TelemetryManager::_byte_queue_error = 0
protected

Count of dropped packets due to queueing errors.

◆ _ccsds_failure

uint8 warpos::TelemetryManager::_ccsds_failure = 0
protected

Count of dropped packets due to CCSDS failures.

◆ _packetized_data

uint8 warpos::TelemetryManager::_packetized_data[CMD_TLM_PKT_MAX_SIZE_BYTES]
protected

Buffer to hold packetization of status packet.

◆ _print_buff

char warpos::TelemetryManager::_print_buff[200]
protected

Table of telemetry packet metadata.

Buffer for printing error/warning/debug statements

◆ _status_tlm

tlm_tlm_mngr_status warpos::TelemetryManager::_status_tlm
protected

◆ _successful_packets

uint8 warpos::TelemetryManager::_successful_packets = 0
protected

Count of successfully sent packets.

◆ _telem_write_error

uint8 warpos::TelemetryManager::_telem_write_error = 0
protected

Count of dropped packets due to interface error.

◆ _tlm_high_byte_queue

clockwerk::Queue<uint8, TLM_HIGH_PRI_QUEUE_SIZE_BYTES> warpos::TelemetryManager::_tlm_high_byte_queue
protected

Normal priority queue of telemetry packet metadata structs.

◆ _tlm_high_info_queue

clockwerk::Queue<PacketInfo, TLM_HIGH_PRI_QUEUE_SIZE_PKTS> warpos::TelemetryManager::_tlm_high_info_queue
protected

High priority queue of telemetry packets.

◆ _tlm_normal_byte_queue

clockwerk::Queue<uint8, TLM_NORMAL_PRI_QUEUE_SIZE_BYTES> warpos::TelemetryManager::_tlm_normal_byte_queue
protected

◆ _tlm_normal_info_queue

clockwerk::Queue<PacketInfo, TLM_NORMAL_PRI_QUEUE_SIZE_PKTS> warpos::TelemetryManager::_tlm_normal_info_queue
protected

Normal priority queue of telemetry packets.

◆ _tlm_packet

uint8 warpos::TelemetryManager::_tlm_packet[sizeof(_status_tlm)]
protected

Telemetry manager status telemetry packet.

◆ _tlm_table

PacketTypeInfo warpos::TelemetryManager::_tlm_table[MAX_TLM_TABLE_SIZE]
protected

High priority queue of telemetry packet metadata structs.

◆ _tlm_table_idx

uint16 warpos::TelemetryManager::_tlm_table_idx = 0
protected

Current index in the telemetry table.

◆ params

Params warpos::TelemetryManager::params = Params(this, "params")

The documentation for this class was generated from the following files: