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

Base app class for derived implementation. More...

#include <App.h>

Inheritance diagram for warpos::App:

Public Member Functions

 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.
virtual int16 activate ()
 Activate the app. The app will step when active.
virtual int16 deactivate ()
 Deactivate the app. The app will not step when deactivated.
virtual int16 command (uint16 apid, uint8 *buffer, uint16 size)
 Process commands issued to the app.
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

clockwerk::DataIO< bool > active = clockwerk::DataIO<bool>(this, "active", true)
 The active flag for the task – set to true by default.

Protected Member Functions

virtual int16 start ()
 Init the app. This is the specific call and should be overwritten in derived apps. Called from startup.
virtual int16 execute ()
 Step the app. This is the specific call and should be overwritten in derived apps. Called from step.
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

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

Base app class for derived implementation.

This is the base app class, which should be implemented in derived applications via class inheritence. It is designed to provide the same params/inputs/outputs functionality as WarpTwin models and tasks, but with the addition of access to flight executive utilities including commands, telemetry, and abstracted hardware/software.

PARAMETERS: Configuration flags which should be carefully controlled and only modified at few, select events (i.e. not every timestep) INPUTS: Input parameters to the app which may, but do not have to, change often. These will often be utilized in application level software such as GN&C applications. OUTPUTS: Output parameters from the app which are the result of an internal calculation in the app.

Functions are created in the base app class to be implemented in the derived app. Each of the following may be left unmodified, in which case they will do nothing. Functions should only be modified if the developer wants them to do something. Once implemented, the functions will be called automatically by the App and should not be invoked directly.

Constructor & Destructor Documentation

◆ App()

warpos::App::App ( FlightExecutive & executive,
const char * name,
uint16 apid,
uint8 instance = 0 )

Executive-based constructor for the task.

Parameters
executiveThe executive to set
m_nameThe name for the task
instanceInstance of the app, only incremented for 2 apps with the same APID

◆ ~App()

virtual warpos::App::~App ( )
inlinevirtual

Destructor. Doesn't really do anything.

Member Function Documentation

◆ activate()

int16 warpos::App::activate ( )
virtual

Activate the app. The app will step when active.

Returns
Flag indicating success/failure

Reimplemented in warpos::DeadReckon, warpos::GPSUpdate, warpos::LedBlinker, warpos::MagUpdate, warpos::PdAttitudeControl, warpos::StorageManager, warpos::TelemetryManager, and warpos::TwoAxisPointingGuidance.

◆ apid()

uint16 warpos::App::apid ( )
inline

Get the apid for this app.

Returns
The apid for this app

◆ command()

int16 warpos::App::command ( uint16 apid,
uint8 * buffer,
uint16 size )
virtual

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 in warpos::CommandManager, warpos::DeadReckon, warpos::GPSUpdate, warpos::LedBlinker, warpos::MagUpdate, warpos::PdAttitudeControl, warpos::StorageManager, warpos::TelemetryManager, and warpos::TwoAxisPointingGuidance.

◆ deactivate()

int16 warpos::App::deactivate ( )
virtual

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

Returns
Flag indicating success/failure

Reimplemented in warpos::DeadReckon, warpos::GPSUpdate, warpos::LedBlinker, warpos::MagUpdate, warpos::PdAttitudeControl, warpos::StorageManager, warpos::TelemetryManager, and warpos::TwoAxisPointingGuidance.

◆ execute()

int16 warpos::App::execute ( )
protectedvirtual

◆ instance()

uint8 & warpos::App::instance ( )
inline

Get the instance of this app (used to differentiate between multiple instances of the same app).

Returns
instance number of the app

◆ isStarted()

bool warpos::App::isStarted ( )
inline

Return whether task startup has been run.

Returns
Status of whether task startup has been run

◆ logLevel() [1/2]

log_level_e warpos::App::logLevel ( )
inline

Get the log level set for the executive.

Returns
Log level for the executive

◆ logLevel() [2/2]

void warpos::App::logLevel ( log_level_e log_level)
inline

Set the executive log level.

Parameters
log_levelThe level to set logging to

◆ start()

int16 warpos::App::start ( )
protectedvirtual

◆ startup()

int16 warpos::App::startup ( )

Initialize the app. Should be called once before step.

Returns
Flag indicating success/failure

◆ step()

int16 warpos::App::step ( )

Step the app by a single step. Maps params, inputs, etc. to outputs.

Returns
Flag indicating success/failure

Member Data Documentation

◆ _apid

uint16 warpos::App::_apid = 0
protected

Internal variable to hold the APID for this app.

◆ _app_children

GraphTreeObject* warpos::App::_app_children[MAXIMUM_APP_CHILDREN]
protected

Local storage for App children so it can live on the graph tree.

◆ _error

int16 warpos::App::_error = 0
protected

Internal variable to track and return error on app step through.

◆ _instance

uint8 warpos::App::_instance
protected

Instance number of this app. Used to differentiate between multiple instances of the same app.

◆ _is_started

bool warpos::App::_is_started = false
protected

Flag indicating whether app has been started or not.

◆ _local_log_level

log_level_e warpos::App::_local_log_level = log_level_e::LOG_WARNING
protected

The log level for this particular app.

◆ active

clockwerk::DataIO<bool> warpos::App::active = clockwerk::DataIO<bool>(this, "active", true)

The active flag for the task – set to true by default.

◆ exc

FlightExecutive& warpos::App::exc
protected

Override our executive to include the FlightExecutive instead.


The documentation for this class was generated from the following files:
  • /Users/mickey/Documents/Projects/warptwin/warpos/src/flight/App.h
  • /Users/mickey/Documents/Projects/warptwin/warpos/src/flight/App.cpp