pub fn sgp4<T: TimeLike>(
sgp4source: &mut impl SGP4Source,
tm: &[T],
) -> Result<SGP4State>Expand description
Run Simplified General Perturbations (SGP)-4 propagator on Two-Line Element Set to output satellite position and velocity at given time in the “TEME” coordinate system
This is a shortcut to run sgp4_full with the WGS84 gravity model and IMPROVED ops mode
A detailed description is here
§Arguments
sgp4source- The source of SGP4 data, typically a TLE but could be a orbital mean-elements message (OMM) or other source implementing the SGP4Source trait. Note: this is a mutable reference SGP4 states are cached in the source object after first call to avoid re-initialization on subsequent callstm- The time at which to compute position and velocity Input as a slice for convenience.satkit::TimeLiketrait is used for time input, can besatkit::Instantor if chrono feature is enabled,chrono::DateTime<Utc>
§Return
Result object containing either an OK value containing a SGP4State struct with position (m) and velocity (m/s) Nx3 matrices (where N is the nuber of input times in the slice) and err codes at each time, or an Err value containing a description of the error
§Note:
This is a shortcut to run sgp4_full with the WGS84 gravity model and IMPROVED ops mode
§Example
// Compute the Geodetic position of a satellite at
// the TLE epoch time
use satkit::TLE;
use satkit::sgp4::{sgp4, GravConst, OpsMode};
use satkit::frametransform::qteme2itrf;
use satkit::itrfcoord::ITRFCoord;
let line0: &str = "0 INTELSAT 902";
let line1: &str = "1 26900U 01039A 06106.74503247 .00000045 00000-0 10000-3 0 8290";
let line2: &str = "2 26900 0.0164 266.5378 0003319 86.1794 182.2590 1.00273847 16981 9300.";
let mut tle = TLE::load_3line(&line0.to_string(),
&line1.to_string(),
&line2.to_string()
).unwrap();
let tm = tle.epoch;
// SGP4 runs on a slice of times
let result = sgp4(&mut tle,
&[tm]
).unwrap();
// rotate position to ITRF and create ITRFCoord
let pos = numeris::vector![result.pos[(0,0)], result.pos[(1,0)], result.pos[(2,0)]];
let pitrf = qteme2itrf(&tm) * pos;
let itrf = ITRFCoord::from_slice(pitrf.as_slice()).unwrap();
println!("Satellite position is: {}", itrf);