WarpTwin
Documentation for WarpTwin models and classes.
Loading...
Searching...
No Matches
warptwin::VisualsModel Class Reference

Class for managing WarpTwin visuals. More...

#include <VisualsModel.h>

Inheritance diagram for warptwin::VisualsModel:

Classes

struct  Params
struct  Inputs
struct  Outputs

Public Member Functions

int addFrame (Frame *new_frame_ptr, const std::string &visual_model_dir="")
 Add frame to visuals for logging.
int addGroundStation (clockwerk::GraphTreeObject *new_gs_ptr)
 Add gs to visuals for logging.
int addLink (clockwerk::GraphTreeObject *new_scl_pointer)
 Create a link between two spacecraft (one primary and one secondary) for logging.
 VisualsModel (warpos::FlightExecutive &e, const std::string &m_name="visuals_model")
virtual ~VisualsModel ()
void forceWrite ()
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.
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

Params params = Params(this, "params")
Inputs inputs = Inputs(this, "inputs")
Outputs outputs = Outputs(this, "outputs")
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
void _runAppProcess ()
 Kick off the python server application.
std::string _slurpFile (std::ifstream &in)
 Load an entire file into a std::string.
void _generateCzmlString (std::string czml_template)
 Generate a CZML file string from a given CZML template.
void _writeCzmlFile ()
 Write out CZML file once all model stuff is done.
void _sendCzmlSocket ()
 Write out CZML file over socket.
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

Frame_planet_inertial_ptr = nullptr
Frame_planet_fixed_ptr = nullptr
SimulationExecutive_smex
 Handle to the simulation executive – should be used in place of exc.
std::ofstream _fout
 Stream variable to write file to.
int _sock_fd = 0
 Socket stream variable to write out live updates.
std::string _sim_start_time
 Ephemeris time of simulation start.
std::vector< Frame * > _sc_frames
std::vector< std::string > _sc_frame_models
std::vector< double > _sc_times
std::vector< std::vector< clockwerk::CartesianVector< 3 > > > _sc_positions
std::vector< std::vector< clockwerk::Quaternion > > _sc_attitudes
clockwerk::CartesianVector< 3 > _pos_f_planet_frame
RateMonitor * _sc_rate_monitor
std::vector< GroundStationModel * > _gs_models
std::vector< std::vector< std::string > > _gs_sign_times_et
std::vector< std::vector< bool > > _gs_sign_after_time
RateMonitor * _gs_rate_monitor
std::vector< SpacecraftLinkModel * > _scl_models
std::vector< std::string > _link_names
std::vector< std::vector< std::string > > _scl_sign_times_et
std::vector< std::vector< bool > > _scl_sign_after_time
std::string _czml_file_template
 String to hold CZML file template.
std::string _socket_template
 String to hold socket template.
std::string _sat_template
 Templates for individual components.
std::string _gs_template
std::string _fl_template
std::string _link_template
std::string _sc_link_template
std::string _generated_json
 String to hold generated json.
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

Class for managing WarpTwin visuals.

This model manages high quality 3D visuals for WarpTwin by writing data to a cesium output file and managing the cesium application.

CZML is the Cesium output file, which is defined per https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/CZML-Guide This class writes out a .czml file which can be used to visualize WarpTwin output in the Cesium ion/SatVis toolkit.

Author: Alex Reynolds alex..nosp@m.reyn.nosp@m.olds@.nosp@m.attx.nosp@m..tech

Constructor & Destructor Documentation

◆ VisualsModel()

warptwin::VisualsModel::VisualsModel ( warpos::FlightExecutive & e,
const std::string & m_name = "visuals_model" )

◆ ~VisualsModel()

warptwin::VisualsModel::~VisualsModel ( )
virtual

Member Function Documentation

◆ _generateCzmlString()

void warptwin::VisualsModel::_generateCzmlString ( std::string czml_template)
protected

Generate a CZML file string from a given CZML template.

Parameters
czml_templateThe template to use for output generation
Note
Implicitly returns json to _generated_json

◆ _runAppProcess()

void warptwin::VisualsModel::_runAppProcess ( )
protected

Kick off the python server application.

◆ _sendCzmlSocket()

void warptwin::VisualsModel::_sendCzmlSocket ( )
protected

Write out CZML file over socket.

◆ _slurpFile()

std::string warptwin::VisualsModel::_slurpFile ( std::ifstream & in)
protected

Load an entire file into a std::string.

Parameters
inThe file to read as text
Returns
std::string containing whole file contents

◆ _writeCzmlFile()

void warptwin::VisualsModel::_writeCzmlFile ( )
protected

Write out CZML file once all model stuff is done.

◆ addFrame()

int warptwin::VisualsModel::addFrame ( Frame * new_frame_ptr,
const std::string & visual_model_dir = "" )

Add frame to visuals for logging.

Parameters
new_frameThe frame to add to logging
Returns
Error code corresponding to success/failure

◆ addGroundStation()

int warptwin::VisualsModel::addGroundStation ( clockwerk::GraphTreeObject * new_gs_ptr)

Add gs to visuals for logging.

Parameters
new_gs_ptrThe gs to add to logging. Passed as void pointer but cast to GS
Returns
Error code corresponding to success/failure

◆ addLink()

int warptwin::VisualsModel::addLink ( clockwerk::GraphTreeObject * new_scl_pointer)

Create a link between two spacecraft (one primary and one secondary) for logging.

Parameters
link_nameThe name of the link
primary_sc_ptrThe primary spacecraft frame
secondary_sc_ptrThe secondary spacecraft frame
Returns
Error code corresponding to success/failure

◆ execute()

int16 warptwin::VisualsModel::execute ( )
overrideprotectedvirtual

Reimplemented from warpos::App.

◆ forceWrite()

void warptwin::VisualsModel::forceWrite ( )
inline

◆ start()

int16 warptwin::VisualsModel::start ( )
overrideprotectedvirtual

Reimplemented from warpos::App.

Member Data Documentation

◆ _czml_file_template

std::string warptwin::VisualsModel::_czml_file_template
protected

String to hold CZML file template.

◆ _fl_template

std::string warptwin::VisualsModel::_fl_template
protected

◆ _fout

std::ofstream warptwin::VisualsModel::_fout
protected

Stream variable to write file to.

◆ _generated_json

std::string warptwin::VisualsModel::_generated_json
protected

String to hold generated json.

◆ _gs_models

std::vector<GroundStationModel*> warptwin::VisualsModel::_gs_models
protected

◆ _gs_rate_monitor

RateMonitor* warptwin::VisualsModel::_gs_rate_monitor
protected

◆ _gs_sign_after_time

std::vector<std::vector<bool> > warptwin::VisualsModel::_gs_sign_after_time
protected

◆ _gs_sign_times_et

std::vector<std::vector<std::string> > warptwin::VisualsModel::_gs_sign_times_et
protected

◆ _gs_template

std::string warptwin::VisualsModel::_gs_template
protected

◆ _link_names

std::vector<std::string> warptwin::VisualsModel::_link_names
protected

◆ _link_template

std::string warptwin::VisualsModel::_link_template
protected

◆ _planet_fixed_ptr

Frame* warptwin::VisualsModel::_planet_fixed_ptr = nullptr
protected

◆ _planet_inertial_ptr

Frame* warptwin::VisualsModel::_planet_inertial_ptr = nullptr
protected

◆ _pos_f_planet_frame

clockwerk::CartesianVector<3> warptwin::VisualsModel::_pos_f_planet_frame
protected

◆ _sat_template

std::string warptwin::VisualsModel::_sat_template
protected

Templates for individual components.

◆ _sc_attitudes

std::vector<std::vector<clockwerk::Quaternion> > warptwin::VisualsModel::_sc_attitudes
protected

◆ _sc_frame_models

std::vector<std::string> warptwin::VisualsModel::_sc_frame_models
protected

◆ _sc_frames

std::vector<Frame*> warptwin::VisualsModel::_sc_frames
protected

◆ _sc_link_template

std::string warptwin::VisualsModel::_sc_link_template
protected

◆ _sc_positions

std::vector<std::vector< clockwerk::CartesianVector<3> > > warptwin::VisualsModel::_sc_positions
protected

◆ _sc_rate_monitor

RateMonitor* warptwin::VisualsModel::_sc_rate_monitor
protected

◆ _sc_times

std::vector<double> warptwin::VisualsModel::_sc_times
protected

◆ _scl_models

std::vector<SpacecraftLinkModel*> warptwin::VisualsModel::_scl_models
protected

◆ _scl_sign_after_time

std::vector<std::vector<bool> > warptwin::VisualsModel::_scl_sign_after_time
protected

◆ _scl_sign_times_et

std::vector<std::vector<std::string> > warptwin::VisualsModel::_scl_sign_times_et
protected

◆ _sim_start_time

std::string warptwin::VisualsModel::_sim_start_time
protected

Ephemeris time of simulation start.

◆ _smex

SimulationExecutive* warptwin::VisualsModel::_smex
protected

Handle to the simulation executive – should be used in place of exc.

◆ _sock_fd

int warptwin::VisualsModel::_sock_fd = 0
protected

Socket stream variable to write out live updates.

◆ _socket_template

std::string warptwin::VisualsModel::_socket_template
protected

String to hold socket template.

◆ inputs

Inputs warptwin::VisualsModel::inputs = Inputs(this, "inputs")

◆ outputs

Outputs warptwin::VisualsModel::outputs = Outputs(this, "outputs")

◆ params

Params warptwin::VisualsModel::params = Params(this, "params")

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