COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
avector Struct Reference

3 element attitude vector. More...

#include <vector.h>

Collaboration diagram for avector:

Public Member Functions

 avector ()
 
 avector (double th, double te, double tb)
 
json11::Json to_json () const
 Convert class contents to JSON object. More...
 
void from_json (const string &s)
 Set class contents from JSON string. More...
 

Public Attributes

double h = 0.
 Heading. More...
 
double e = 0.
 Elevation. More...
 
double b = 0.
 Bank. More...
 

Detailed Description

3 element attitude vector.

Uses Tait-Bryan representation in a zyx, right handed order of rotation

Constructor & Destructor Documentation

avector::avector ( )
inline
286 {}
avector::avector ( double  th,
double  te,
double  tb 
)
inline
287  {
288  h = th;
289  e = te;
290  b = tb;
291  }
double e
Elevation.
Definition: vector.h:282
double b
Bank.
Definition: vector.h:284
double h
Heading.
Definition: vector.h:280

Member Function Documentation

json11::Json avector::to_json ( ) const
inline

Convert class contents to JSON object.

Returns a json11 JSON object of the class

Returns
A json11 JSON object containing every member variable within the class
297  {
298  return json11::Json::object {
299  { "h" , h },
300  { "e" , e },
301  { "b" , b }
302  };
303  }
std::map< std::string, Json > object
Definition: json11.hpp:88
double e
Elevation.
Definition: vector.h:282
double b
Bank.
Definition: vector.h:284
double h
Heading.
Definition: vector.h:280
void avector::from_json ( const string &  s)
inline

Set class contents from JSON string.

Parses the provided JSON-formatted string and sets the class data. String should be formatted like the string returned from to_json()

Parameters
sJSON-formatted string to set class contents to
Returns
n/a
311  {
312  string error;
313  json11::Json parsed = json11::Json::parse(s,error);
314  if(error.empty()) {
315  if(!parsed["h"].is_null()) h = parsed["h"].number_value();
316  if(!parsed["e"].is_null()) e = parsed["e"].number_value();
317  if(!parsed["b"].is_null()) b = parsed["b"].number_value();
318  } else {
319  cerr<<"ERROR = "<<error<<endl;
320  }
321  return;
322  }
Definition: json11.hpp:79
double e
Elevation.
Definition: vector.h:282
static Json parse(const std::string &in, std::string &err, JsonParse strategy=JsonParse::STANDARD)
double b
Bank.
Definition: vector.h:284
double h
Heading.
Definition: vector.h:280

Member Data Documentation

double avector::h = 0.

Heading.

double avector::e = 0.

Elevation.

double avector::b = 0.

Bank.


The documentation for this struct was generated from the following file: