perturb 1.0.0
A modern C++11 wrapper for the SGP4 orbit propagator
Loading...
Searching...
No Matches
perturb::Satellite Class Reference

Represents a specific orbital ephemeris for an Earth-centered trajectory. More...

#include <perturb.hpp>

Public Member Functions

 Satellite (sgp4::elsetrec sat_rec)
 Construct from a raw SGP4 orbital record. More...
 
 Satellite (const TwoLineElement &tle, GravModel grav_model=GravModel::WGS72)
 Construct and initialize from a pre-parsed TLE record. More...
 
Sgp4Error last_error () const
 Return the last recorded error in the internal SGP4 record.
 
JulianDate epoch () const
 Return the epoch of the orbital ephemeris, likely from a TLE.
 
Sgp4Error propagate_from_epoch (double mins_from_epoch, StateVector &sv)
 Propagate the SGP4 model based on time around the epoch. More...
 
Sgp4Error propagate (JulianDate jd, StateVector &sv)
 Propagate the SGP4 model to a specific time point. More...
 

Static Public Member Functions

static Satellite from_tle (char *line_1, char *line_2, GravModel grav_model=GravModel::WGS72)
 Construct and initialize a Satellite from a TLE record. More...
 
static Satellite from_tle (std::string &line_1, std::string &line_2, GravModel grav_model=GravModel::WGS72)
 Wrapper for Satellite::from_tle that accepts C++ style strings. More...
 

Public Attributes

sgp4::elsetrec sat_rec
 Internal SGP4 type.
 

Detailed Description

Represents a specific orbital ephemeris for an Earth-centered trajectory.

This is the primary type in this library. Wraps the internal SGP4 record type perturb::sgp4::elsetrec. Generally constructed via TLEs through Satellite::from_tle constructors. Of particular importance is the Satellite::last_error method which you can check to determine if there were any issues with TLE initialization or propagation. The primary method of running the SGP4 algorithm is the Satellite::propagate method.

Constructor & Destructor Documentation

◆ Satellite() [1/2]

perturb::Satellite::Satellite ( sgp4::elsetrec  sat_rec)
explicit

Construct from a raw SGP4 orbital record.

Parameters
sat_recPre-initialized SGP4 orbital record

◆ Satellite() [2/2]

perturb::Satellite::Satellite ( const TwoLineElement tle,
GravModel  grav_model = GravModel::WGS72 
)
explicit

Construct and initialize from a pre-parsed TLE record.

Does not require any string parsing, so aight for embedded. Does the same initialization steps as perturb::sgp4::twoline2rv and then uses perturb::sgp4::sgp4init to fully initialize.

You probably don't want to parse a TLE string into a TwoLineElement and then construct a Satellite via this. You should instead use the Satellite::from_tle constructor directly.

This is only useful if you don't want any IO (via the PERTURB_DISABLE_IO flag), because then this and the Satellite(sgp4::elsetrec) constructor are the only way of constructing a Satellite object. It's up to you how you wanna construct the parsed perturb::TwoLineElement object.

Precondition
The TLE must be valid and contain valid values.
Parameters
tleParsed and valid TLE
grav_modelGravity constants to use (default GravModel::WGS72)

Member Function Documentation

◆ from_tle() [1/2]

Satellite perturb::Satellite::from_tle ( char *  line_1,
char *  line_2,
GravModel  grav_model = GravModel::WGS72 
)
static

Construct and initialize a Satellite from a TLE record.

The strings are mutable because the underlying implementation in perturb::sgp4::twoline2rv may modify the string during parsing. Left as mutable instead of internally copying for efficiency reasons as this may be okay for the caller.

Parameters
line_1First line of TLE as C-string of length perturb::TLE_LINE_LEN
line_2Second line of TLE as C-string of length perturb::TLE_LINE_LEN
grav_modelGravity constants to use (default GravModel::WGS72)
Returns
An initialized Satellite

◆ from_tle() [2/2]

Satellite perturb::Satellite::from_tle ( std::string &  line_1,
std::string &  line_2,
GravModel  grav_model = GravModel::WGS72 
)
static

Wrapper for Satellite::from_tle that accepts C++ style strings.

Parameters
line_1First line of TLE
line_2Second line of TLE
grav_modelGravity constants to use (default GravModel::WGS72)
Returns
An initialized Satellite

◆ propagate()

Sgp4Error perturb::Satellite::propagate ( JulianDate  jd,
StateVector sv 
)

Propagate the SGP4 model to a specific time point.

Parameters
jdTime point in UTC or UT1
posvelReturned state vector in the TEME frame
Returns
Issues during propagation, should usually be Sgp4Error::NONE

◆ propagate_from_epoch()

Sgp4Error perturb::Satellite::propagate_from_epoch ( double  mins_from_epoch,
StateVector sv 
)

Propagate the SGP4 model based on time around the epoch.

Parameters
mins_from_epochOffset number of minutes around the epoch
posvelReturned state vector in the TEME frame
Returns
Issues during propagation, should usually be Sgp4Error::NONE

The documentation for this class was generated from the following files: