WarpTwin
Documentation for WarpTwin models and classes.
Loading...
Searching...
No Matches
TelemetryManager.h
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (c) ATTX INC 2025. All Rights Reserved.
3 *
4 * This software and associated documentation (the "Software") are the
5 * proprietary and confidential information of ATTX, INC. The Software is
6 * furnished under a license agreement between ATTX and the user organization
7 * and may be used or copied only in accordance with the terms of the agreement.
8 * Refer to 'license/attx_license.adoc' for standard license terms.
9 *
10 * EXPORT CONTROL NOTICE: THIS SOFTWARE MAY INCLUDE CONTENT CONTROLLED UNDER THE
11 * INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) OR THE EXPORT ADMINISTRATION
12 * REGULATIONS (EAR99). No part of the Software may be used, reproduced, or
13 * transmitted in any form or by any means, for any purpose, without the express
14 * written permission of ATTX, INC.
15 ******************************************************************************/
16/*
17Telemetry Manager header file
18
19Author: Alex Reynolds
20*/
21#ifndef FLIGHT_TELEMETRYMANAGER_H
22#define FLIGHT_TELEMETRYMANAGER_H
23
24#include "architecture/Time.h"
26#include "flight/App.h"
27#include "flight/flighterrors.h"
29
30namespace warpos {
31
32class FlightExecutive;
33
35enum tlm_priority_e : uint8 {
36 NORMAL = 0,
37 HIGH = 1
38};
39
52
56struct PacketInfo {
57 uint32 size;
58 uint16 apid;
60 uint8 instance;
61};
62
84class TelemetryManager : public App {
85 public:
91 SIGNAL(max_bytes_per_step, uint32, TLM_NORMAL_PRI_QUEUE_SIZE_BYTES + TLM_HIGH_PRI_QUEUE_SIZE_BYTES)
93
99 virtual ~TelemetryManager();
100
105 int16 addTlmToQueue(const cmd_tlm_base& pkt, uint8 instance);
106
113 int16 writeQueues(void *tlm_ptr, uint32 size, const PacketInfo &tlminfo, tlm_priority_e priority);
114
119 int16 registerTlmPacket(uint16 tlm_apid, uint8 instance);
120
124 int16 configureTlmPacket(const PacketTypeInfo& info);
125
128 uint32 queueCountNormalPri() { return _tlm_normal_info_queue.valsHeld(); }
129
132 uint32 queueCountHighPri() { return _tlm_high_info_queue.valsHeld(); }
133
136 int16 activate() override;
137
140 int16 deactivate() override;
141
147 int16 command(uint16 apid, uint8* buffer, uint16 size) override;
148
152
156
160
164
168
172 protected:
173 int16 start() override;
174 int16 execute() override;
175
178 uint32 _sendNextTlmPacket();
179
184 int32 _findPktIndex(uint16 apid, uint8 instance);
185
188
191
192 PacketTypeInfo _tlm_table[MAX_TLM_TABLE_SIZE];
193
194 char _print_buff[200];
195
196 // Output Telemetry Items
197 uint16 _tlm_table_idx = 0;
199 uint8 _ccsds_failure = 0;
203
205 uint8 _tlm_packet[sizeof(_status_tlm)];
206
207 uint8 _packetized_data[CMD_TLM_PKT_MAX_SIZE_BYTES];
208};
209} // namespace warpos
210
211#endif
#define SIGNAL(NAME, TYPE, INITIAL_VALUE)
Definition appmacros.h:27
#define START_PARAMS
Definition appmacros.h:42
#define END_PARAMS
Definition appmacros.h:47
Simple first in, first out queue for data storage.
Definition Queue.hpp:38
Wrapper to manage and convert time as timespce.
Definition Time.h:53
App(FlightExecutive &executive, const char *name, uint16 apid, uint8 instance=0)
Executive-based constructor for the task.
Definition App.cpp:21
uint8 & instance()
Get the instance of this app (used to differentiate between multiple instances of the same app).
Definition App.h:109
uint16 apid()
Get the apid for this app.
Definition App.h:105
FlightExecutive & exc
Override our executive to include the FlightExecutive instead.
Definition App.h:120
Executive derivation specifically to run flight systems.
Definition FlightExecutive.h:46
uint16 _tlm_table_idx
Current index in the telemetry table.
Definition TelemetryManager.h:197
clockwerk::Queue< uint8, TLM_HIGH_PRI_QUEUE_SIZE_BYTES > _tlm_high_byte_queue
Normal priority queue of telemetry packet metadata structs.
Definition TelemetryManager.h:189
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.
Definition TelemetryManager.cpp:109
PacketTypeInfo _tlm_table[MAX_TLM_TABLE_SIZE]
High priority queue of telemetry packet metadata structs.
Definition TelemetryManager.h:192
uint8 _successful_packets
Count of successfully sent packets.
Definition TelemetryManager.h:202
clockwerk::Queue< PacketInfo, TLM_HIGH_PRI_QUEUE_SIZE_PKTS > _tlm_high_info_queue
High priority queue of telemetry packets.
Definition TelemetryManager.h:190
uint32 queueCountHighPri()
Get the number of packets in the high priority queue.
Definition TelemetryManager.h:132
int16 deactivate() override
Deactivate the app. The app will not step when deactivated.
Definition TelemetryManager.cpp:421
uint8 _byte_queue_error
Count of dropped packets due to queueing errors.
Definition TelemetryManager.h:198
tlm_tlm_mngr_status _status_tlm
Definition TelemetryManager.h:204
int16 execute() override
Definition TelemetryManager.cpp:338
uint8 _ccsds_failure
Count of dropped packets due to CCSDS failures.
Definition TelemetryManager.h:199
char _print_buff[200]
Table of telemetry packet metadata.
Definition TelemetryManager.h:194
uint16 numRegisteredPackets()
Get the number of registered telemetry packets.
Definition TelemetryManager.h:151
clockwerk::Queue< uint8, TLM_NORMAL_PRI_QUEUE_SIZE_BYTES > _tlm_normal_byte_queue
Definition TelemetryManager.h:186
uint32 queueCountNormalPri()
Get the number of packets in the standard queue.
Definition TelemetryManager.h:128
clockwerk::Queue< PacketInfo, TLM_NORMAL_PRI_QUEUE_SIZE_PKTS > _tlm_normal_info_queue
Normal priority queue of telemetry packets.
Definition TelemetryManager.h:187
TelemetryManager(FlightExecutive &exc)
Only available flight executive constructor.
Definition TelemetryManager.cpp:28
int16 registerTlmPacket(uint16 tlm_apid, uint8 instance)
Register a telemetry packet by adding it to the table.
Definition TelemetryManager.cpp:159
uint8 _tlm_packet[sizeof(_status_tlm)]
Telemetry manager status telemetry packet.
Definition TelemetryManager.h:205
int16 addTlmToQueue(const cmd_tlm_base &pkt, uint8 instance)
Add a telemetry packet to the queue.
Definition TelemetryManager.cpp:46
uint8 _telem_write_error
Count of dropped packets due to interface error.
Definition TelemetryManager.h:200
clockwerk::Queue< uint8, TLM_HIGH_PRI_QUEUE_SIZE_BYTES > & tlmHighPriByteQueue()
Handle to _tlm_high_byte_queue used for unit testing.
Definition TelemetryManager.h:167
uint32 _sendNextTlmPacket()
Send the next telemetry packet.
Definition TelemetryManager.cpp:210
clockwerk::Queue< uint8, TLM_NORMAL_PRI_QUEUE_SIZE_BYTES > & tlmNormalPriByteQueue()
Handle to _tlm_normal_byte_queue used for unit testing.
Definition TelemetryManager.h:159
PacketTypeInfo * registeredPackets()
Get the telemetry table.
Definition TelemetryManager.h:155
int16 command(uint16 apid, uint8 *buffer, uint16 size) override
Process commands issued to the app.
Definition TelemetryManager.cpp:357
int16 start() override
Definition TelemetryManager.cpp:311
int16 configureTlmPacket(const PacketTypeInfo &info)
Register a telemetry packet by adding its metadata to the table.
Definition TelemetryManager.cpp:195
int16 activate() override
Activate the app. The app will step when active.
Definition TelemetryManager.cpp:416
clockwerk::Queue< PacketInfo, TLM_NORMAL_PRI_QUEUE_SIZE_PKTS > & tlmNormalPriInfoQueue()
Handle to _tlm_normal_info_queue used for unit testing.
Definition TelemetryManager.h:163
int32 _findPktIndex(uint16 apid, uint8 instance)
Find index of packet in tlm table matching apid.
Definition TelemetryManager.cpp:33
clockwerk::Queue< PacketInfo, TLM_HIGH_PRI_QUEUE_SIZE_PKTS > & tlmHighPriInfoQueue()
Handle to _tlm_high_info_queue used for unit testing.
Definition TelemetryManager.h:171
uint8 _buffer_overwrite
Count of dropped packets due to overwitten packets.
Definition TelemetryManager.h:201
uint8 _packetized_data[CMD_TLM_PKT_MAX_SIZE_BYTES]
Buffer to hold packetization of status packet.
Definition TelemetryManager.h:207
Definition DeadReckon.cpp:20
tlm_priority_e
Enumeration of valid telemtry queue priorities.
Definition TelemetryManager.h:35
@ NORMAL
Definition TelemetryManager.h:36
@ HIGH
Definition TelemetryManager.h:37
Base struct in definition of command and telemetry packets.
Definition Telemetry.h:48
LED Blinker count packet definition.
Definition tlm_TelemetryManager.h:41
Telemetry packet metadata struct.
Definition TelemetryManager.h:56
clockwerk::Time timestamp
Packet APID.
Definition TelemetryManager.h:59
uint16 apid
Size of the packet in bytes.
Definition TelemetryManager.h:58
uint8 instance
Timestamp of when the packet was added to the queue.
Definition TelemetryManager.h:60
uint32 size
Definition TelemetryManager.h:57
Telemetry packet type metadata struct.
Definition TelemetryManager.h:43
tlm_priority_e priority
Packet counter, rolls over at 0xFFFF.
Definition TelemetryManager.h:48
uint8 target
Instance of APID used.
Definition TelemetryManager.h:50
uint16 apid
The last time this packet was sent.
Definition TelemetryManager.h:46
clockwerk::Time rate_sec
Definition TelemetryManager.h:44
uint8 instance
Priority ranking of the packet.
Definition TelemetryManager.h:49
clockwerk::Time last_sent
Time interval between transmissions of this packet.
Definition TelemetryManager.h:45
uint16 count
Packet APID.
Definition TelemetryManager.h:47
clockwerk::DataIO< uint32 > max_bytes_per_step
Definition TelemetryManager.h:91