pub struct Elements {Show 17 fields
pub object_name: Option<String>,
pub international_designator: Option<String>,
pub norad_id: u64,
pub classification: Classification,
pub datetime: NaiveDateTime,
pub mean_motion_dot: f64,
pub mean_motion_ddot: f64,
pub drag_term: f64,
pub element_set_number: u64,
pub inclination: f64,
pub right_ascension: f64,
pub eccentricity: f64,
pub argument_of_perigee: f64,
pub mean_anomaly: f64,
pub mean_motion: f64,
pub revolution_number: u64,
pub ephemeris_type: u8,
}
Expand description
General perturbations orbital data parsed from a TLE or OMM
Elements can be retrieved from either a Two-Line Element Set (TLE) or an Orbit Mean-Elements Message (OMM). See https://celestrak.com/NORAD/documentation/gp-data-formats.php for more information on the difference between the two formats.
The fields’ documentation is adapted from https://spaceflight.nasa.gov/realdata/sightings/SSapplications/Post/JavaSSOP/SSOP_Help/tle_def.html.
See sgp4::Elements::from_tle to parse a TLE.
serde_json
can be used to parse a JSON OMM object (into a sgp4::Elements
)
or a JSON list of OMM objects (into a Vec<sgp4::Elements>
).
Example
let elements: sgp4::Elements = serde_json::from_str(
r#"{
"OBJECT_NAME": "ISS (ZARYA)",
"OBJECT_ID": "1998-067A",
"EPOCH": "2020-07-12T01:19:07.402656",
"MEAN_MOTION": 15.49560532,
"ECCENTRICITY": 0.0001771,
"INCLINATION": 51.6435,
"RA_OF_ASC_NODE": 225.4004,
"ARG_OF_PERICENTER": 44.9625,
"MEAN_ANOMALY": 5.1087,
"EPHEMERIS_TYPE": 0,
"CLASSIFICATION_TYPE": "U",
"NORAD_CAT_ID": 25544,
"ELEMENT_SET_NO": 999,
"REV_AT_EPOCH": 23587,
"BSTAR": 0.0049645,
"MEAN_MOTION_DOT": 0.00289036,
"MEAN_MOTION_DDOT": 0
}"#,
)?;
Fields
object_name: Option<String>
alloc
only.The name associated with the satellite
international_designator: Option<String>
alloc
only.The satellite’s international designator
It consists of the launch year, the launch number of that year and a letter code representing the sequential identifier of a piece in a launch.
norad_id: u64
The catalog number USSPACECOM has designated for this object
classification: Classification
The elements’ classification
datetime: NaiveDateTime
The UTC timestamp of the elements
mean_motion_dot: f64
Time derivative of the mean motion
mean_motion_ddot: f64
Second time derivative of the mean motion
drag_term: f64
Radiation pressure coefficient in earth radii⁻¹
element_set_number: u64
A running count of all 2 line element sets generated by USSPACECOM for this object
inclination: f64
Angle between the equator and the orbit plane in deg
right_ascension: f64
Angle between vernal equinox and the point where the orbit crosses the equatorial plane in deg
eccentricity: f64
The shape of the orbit
argument_of_perigee: f64
Angle between the ascending node and the orbit’s point of closest approach to the earth in deg
mean_anomaly: f64
Angle of the satellite location measured from perigee in deg
mean_motion: f64
Mean number of orbits per day in day⁻¹ (Kozai convention)
revolution_number: u64
The orbit number at epoch
ephemeris_type: u8
NORAD internal use, always 0 in distributed data
Implementations
sourceimpl Elements
impl Elements
sourcepub fn from_tle(
object_name: Option<String>,
line1: &[u8],
line2: &[u8]
) -> Result<Elements>
pub fn from_tle(
object_name: Option<String>,
line1: &[u8],
line2: &[u8]
) -> Result<Elements>
Parses a Two-Line Element Set (TLE) with an optionnal title
Arguments
object_name
- The name of the satellite, usually given by a third line placed before the TLEline1
- The first line of the TLE composed of 69 ASCII charactersline2
- The second line of the TLE composed of 69 ASCII characters
Example
let elements = sgp4::Elements::from_tle(
Some("ISS (ZARYA)".to_owned()),
"1 25544U 98067A 08264.51782528 -.00002182 00000-0 -11606-4 0 2927".as_bytes(),
"2 25544 51.6416 247.4627 0006703 130.5360 325.0288 15.72125391563537".as_bytes(),
)?;
sourcepub fn epoch(&self) -> f64
pub fn epoch(&self) -> f64
Returns the number of years since UTC 1 January 2000 12h00 (J2000)
This is the recommended method to calculate the epoch
sourcepub fn epoch_afspc_compatibility_mode(&self) -> f64
pub fn epoch_afspc_compatibility_mode(&self) -> f64
Returns the number of years since UTC 1 January 2000 12h00 (J2000) using the AFSPC expression
This function should be used if compatibility with the AFSPC implementation is needed