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

Quaternion Attitude. More...

#include <convertdef.h>

Collaboration diagram for qatt:

Public Member Functions

json11::Json to_json () const
 Convert class contents to JSON object. More...
 
void from_json (const string &js)
 Set class contents from JSON string. More...
 

Public Attributes

double utc = 0.
 
quaternion s
 0th derivative: Quaternion More...
 
rvector v
 1st derivative: Omega - angular velocity More...
 
rvector a
 2nd derivative: Alpha - acceleration More...
 
uint32_t pass = 0
 pass indicator: allows synchronization with other attitude and position values. More...
 

Detailed Description

Quaternion Attitude.

Full attitude structure (0th, 1st and 2nd derivative), using a Quaternion to present the 0th derivative.

Member Function Documentation

json11::Json qatt::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
491  {
492  return json11::Json::object {
493  { "utc" , utc },
494  { "s" , s },
495  { "v" , v },
496  { "a" , a },
497  { "pass" , static_cast<int>(pass) }
498  };
499  }
std::map< std::string, Json > object
Definition: json11.hpp:88
rvector a
2nd derivative: Alpha - acceleration
Definition: convertdef.h:483
rvector v
1st derivative: Omega - angular velocity
Definition: convertdef.h:481
double utc
Definition: convertdef.h:477
uint32_t pass
pass indicator: allows synchronization with other attitude and position values.
Definition: convertdef.h:485
quaternion s
0th derivative: Quaternion
Definition: convertdef.h:479
void qatt::from_json ( const string &  js)
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
507  {
508  string error;
509  json11::Json parsed = json11::Json::parse(js,error);
510  if(error.empty()) {
511  if(!parsed["utc"].is_null()) utc = parsed["utc"].number_value();
512  if(!parsed["s"].is_null()) s.from_json(parsed["s"].dump());
513  if(!parsed["v"].is_null()) v.from_json(parsed["v"].dump());
514  if(!parsed["a"].is_null()) a.from_json(parsed["a"].dump());
515  if(!parsed["pass"].is_null()) pass = parsed["pass"].int_value();
516  } else {
517  cerr<<"ERROR = "<<error<<endl;
518  }
519  return;
520  }
Definition: json11.hpp:79
rvector a
2nd derivative: Alpha - acceleration
Definition: convertdef.h:483
rvector v
1st derivative: Omega - angular velocity
Definition: convertdef.h:481
double utc
Definition: convertdef.h:477
void dump(std::string &out) const
static Json parse(const std::string &in, std::string &err, JsonParse strategy=JsonParse::STANDARD)
void from_json(const string &s)
Set class contents from JSON string.
Definition: vector.h:431
uint32_t pass
pass indicator: allows synchronization with other attitude and position values.
Definition: convertdef.h:485
quaternion s
0th derivative: Quaternion
Definition: convertdef.h:479
void from_json(const string &s)
Set class contents from JSON string.
Definition: vector.h:80

Member Data Documentation

double qatt::utc = 0.
quaternion qatt::s

0th derivative: Quaternion

rvector qatt::v

1st derivative: Omega - angular velocity

rvector qatt::a

2nd derivative: Alpha - acceleration

uint32_t qatt::pass = 0

pass indicator: allows synchronization with other attitude and position values.


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