Struct nyx_space::cosmic::Spacecraft
source · pub struct Spacecraft {
pub orbit: Orbit,
pub dry_mass_kg: f64,
pub fuel_mass_kg: f64,
pub srp: SrpConfig,
pub drag: DragConfig,
pub thruster: Option<Thruster>,
pub mode: GuidanceMode,
pub stm: Option<OMatrix<f64, Const<9>, Const<9>>>,
}
Expand description
A spacecraft state, composed of its orbit, its dry and fuel (wet) masses (in kg), its SRP configuration, its drag configuration, its thruster configuration, and its guidance mode.
Optionally, the spacecraft state can also store the state transition matrix from the start of the propagation until the current time (i.e. trajectory STM, not step-size STM).
Fields§
§orbit: Orbit
Initial orbit the vehicle is in
dry_mass_kg: f64
Dry mass, i.e. mass without fuel, in kg
fuel_mass_kg: f64
Fuel mass (if fuel mass is negative, thrusting will fail, unless configured to break laws of physics)
srp: SrpConfig
Solar Radiation Pressure configuration for this spacecraft
drag: DragConfig
§thruster: Option<Thruster>
§mode: GuidanceMode
Any extra information or extension that is needed for specific guidance laws
stm: Option<OMatrix<f64, Const<9>, Const<9>>>
Optionally stores the state transition matrix from the start of the propagation until the current time (i.e. trajectory STM, not step-size STM)
Implementations§
source§impl Spacecraft
impl Spacecraft
sourcepub fn new(
orbit: Orbit,
dry_mass_kg: f64,
fuel_mass_kg: f64,
srp_area_m2: f64,
drag_area_m2: f64,
cr: f64,
cd: f64
) -> Self
pub fn new( orbit: Orbit, dry_mass_kg: f64, fuel_mass_kg: f64, srp_area_m2: f64, drag_area_m2: f64, cr: f64, cd: f64 ) -> Self
Initialize a spacecraft state from all of its parameters
sourcepub fn from_thruster(
orbit: Orbit,
dry_mass_kg: f64,
fuel_mass_kg: f64,
thruster: Thruster,
mode: GuidanceMode
) -> Self
pub fn from_thruster( orbit: Orbit, dry_mass_kg: f64, fuel_mass_kg: f64, thruster: Thruster, mode: GuidanceMode ) -> Self
Initialize a spacecraft state from only a thruster and mass. Use this when designing guidance laws while ignoring drag and SRP.
sourcepub fn from_srp_defaults(
orbit: Orbit,
dry_mass_kg: f64,
srp_area_m2: f64
) -> Self
pub fn from_srp_defaults( orbit: Orbit, dry_mass_kg: f64, srp_area_m2: f64 ) -> Self
Initialize a spacecraft state from the SRP default 1.8 for coefficient of reflectivity (fuel mass and drag parameters nullified!)
sourcepub fn from_drag_defaults(
orbit: Orbit,
dry_mass_kg: f64,
drag_area_m2: f64
) -> Self
pub fn from_drag_defaults( orbit: Orbit, dry_mass_kg: f64, drag_area_m2: f64 ) -> Self
Initialize a spacecraft state from the SRP default 1.8 for coefficient of drag (fuel mass and SRP parameters nullified!)
pub fn with_dv(self, dv: Vector3<f64>) -> Self
sourcepub fn with_dry_mass(self, dry_mass_kg: f64) -> Self
pub fn with_dry_mass(self, dry_mass_kg: f64) -> Self
Returns a copy of the state with a new dry mass
sourcepub fn with_fuel_mass(self, fuel_mass_kg: f64) -> Self
pub fn with_fuel_mass(self, fuel_mass_kg: f64) -> Self
Returns a copy of the state with a new fuel mass
sourcepub fn with_srp(self, srp_area_m2: f64, cr: f64) -> Self
pub fn with_srp(self, srp_area_m2: f64, cr: f64) -> Self
Returns a copy of the state with a new SRP area and CR
sourcepub fn with_srp_area(self, srp_area_m2: f64) -> Self
pub fn with_srp_area(self, srp_area_m2: f64) -> Self
Returns a copy of the state with a new SRP area
sourcepub fn with_cr(self, cr: f64) -> Self
pub fn with_cr(self, cr: f64) -> Self
Returns a copy of the state with a new coefficient of reflectivity
sourcepub fn with_drag(self, drag_area_m2: f64, cd: f64) -> Self
pub fn with_drag(self, drag_area_m2: f64, cd: f64) -> Self
Returns a copy of the state with a new drag area and CD
sourcepub fn with_drag_area(self, drag_area_m2: f64) -> Self
pub fn with_drag_area(self, drag_area_m2: f64) -> Self
Returns a copy of the state with a new SRP area
sourcepub fn with_cd(self, cd: f64) -> Self
pub fn with_cd(self, cd: f64) -> Self
Returns a copy of the state with a new coefficient of drag
sourcepub fn with_orbit(self, orbit: Orbit) -> Self
pub fn with_orbit(self, orbit: Orbit) -> Self
Returns a copy of the state with a new orbit
sourcepub fn rss(&self, other: &Self) -> (f64, f64, f64)
pub fn rss(&self, other: &Self) -> (f64, f64, f64)
Returns the root sum square error between this spacecraft and the other, in kilometers for the position, kilometers per second in velocity, and kilograms in fuel
sourcepub fn enable_stm(&mut self)
pub fn enable_stm(&mut self)
Sets the STM of this state of identity, which also enables computation of the STM for spacecraft navigation
sourcepub fn with_guidance_mode(self, mode: GuidanceMode) -> Self
pub fn with_guidance_mode(self, mode: GuidanceMode) -> Self
Returns a copy of the state with the provided guidance mode
pub fn mode(&self) -> GuidanceMode
pub fn mut_mode(&mut self, mode: GuidanceMode)
Trait Implementations§
source§impl Add<Matrix<f64, Const<6>, Const<1>, <DefaultAllocator as Allocator<f64, Const<6>>>::Buffer>> for Spacecraft
impl Add<Matrix<f64, Const<6>, Const<1>, <DefaultAllocator as Allocator<f64, Const<6>>>::Buffer>> for Spacecraft
source§impl Add<Matrix<f64, Const<9>, Const<1>, <DefaultAllocator as Allocator<f64, Const<9>>>::Buffer>> for Spacecraft
impl Add<Matrix<f64, Const<9>, Const<1>, <DefaultAllocator as Allocator<f64, Const<9>>>::Buffer>> for Spacecraft
source§impl Clone for Spacecraft
impl Clone for Spacecraft
source§fn clone(&self) -> Spacecraft
fn clone(&self) -> Spacecraft
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl ConfigRepr for Spacecraft
impl ConfigRepr for Spacecraft
source§fn load<P>(path: P) -> Result<Self, ConfigError>
fn load<P>(path: P) -> Result<Self, ConfigError>
source§fn load_many<P>(path: P) -> Result<Vec<Self>, ConfigError>
fn load_many<P>(path: P) -> Result<Vec<Self>, ConfigError>
source§fn load_named<P>(path: P) -> Result<HashMap<String, Self>, ConfigError>
fn load_named<P>(path: P) -> Result<HashMap<String, Self>, ConfigError>
source§fn loads_many(data: &str) -> Result<Vec<Self>, ConfigError>
fn loads_many(data: &str) -> Result<Vec<Self>, ConfigError>
source§impl Configurable for Spacecraft
impl Configurable for Spacecraft
§type IntermediateRepr = Spacecraft
type IntermediateRepr = Spacecraft
Self
or to serialize Self.source§fn from_config(
cfg: Self::IntermediateRepr,
_cosm: Arc<Cosm>
) -> Result<Self, ConfigError>where
Self: Sized,
fn from_config(
cfg: Self::IntermediateRepr,
_cosm: Arc<Cosm>
) -> Result<Self, ConfigError>where
Self: Sized,
self
from the configuration.source§fn to_config(&self) -> Result<Self::IntermediateRepr, ConfigError>
fn to_config(&self) -> Result<Self::IntermediateRepr, ConfigError>
fn from_yaml<P: AsRef<Path>>( path: P, cosm: Arc<Cosm> ) -> Result<Self, ConfigError>
source§impl Debug for Spacecraft
impl Debug for Spacecraft
source§impl Default for Spacecraft
impl Default for Spacecraft
source§impl<'de> Deserialize<'de> for Spacecraft
impl<'de> Deserialize<'de> for Spacecraft
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl Display for Spacecraft
impl Display for Spacecraft
source§impl EstimateFrom<Spacecraft, RangeDoppler> for Orbit
impl EstimateFrom<Spacecraft, RangeDoppler> for Orbit
source§fn extract(from: Spacecraft) -> Self
fn extract(from: Spacecraft) -> Self
source§fn sensitivity(
msr: &RangeDoppler,
receiver: Self,
transmitter: Self
) -> OMatrix<f64, <RangeDoppler as Measurement>::MeasurementSize, Self::Size>
fn sensitivity( msr: &RangeDoppler, receiver: Self, transmitter: Self ) -> OMatrix<f64, <RangeDoppler as Measurement>::MeasurementSize, Self::Size>
source§impl EstimateFrom<Spacecraft, RangeDoppler> for Spacecraft
impl EstimateFrom<Spacecraft, RangeDoppler> for Spacecraft
source§fn extract(from: Spacecraft) -> Self
fn extract(from: Spacecraft) -> Self
source§fn sensitivity(
_msr: &RangeDoppler,
_receiver: Self,
_transmitter: Orbit
) -> OMatrix<f64, <RangeDoppler as Measurement>::MeasurementSize, Self::Size>
fn sensitivity( _msr: &RangeDoppler, _receiver: Self, _transmitter: Orbit ) -> OMatrix<f64, <RangeDoppler as Measurement>::MeasurementSize, Self::Size>
source§impl EventEvaluator<Spacecraft> for Event
impl EventEvaluator<Spacecraft> for Event
source§fn eval(&self, state: &Spacecraft) -> f64
fn eval(&self, state: &Spacecraft) -> f64
fn epoch_precision(&self) -> Duration
fn value_precision(&self) -> f64
source§fn eval_string(&self, state: &Spacecraft) -> String
fn eval_string(&self, state: &Spacecraft) -> String
fn eval_crossing(&self, prev_state: &S, next_state: &S) -> bool
source§impl EventEvaluator<Spacecraft> for PenumbraEvent
impl EventEvaluator<Spacecraft> for PenumbraEvent
source§fn epoch_precision(&self) -> Duration
fn epoch_precision(&self) -> Duration
Stop searching when the time has converged to less than 0.1 seconds
source§fn value_precision(&self) -> f64
fn value_precision(&self) -> f64
Finds the slightest penumbra within 2%(i.e. 98% in visibility)
source§fn eval(&self, sc: &Spacecraft) -> f64
fn eval(&self, sc: &Spacecraft) -> f64
source§fn eval_string(&self, state: &Spacecraft) -> String
fn eval_string(&self, state: &Spacecraft) -> String
fn eval_crossing(&self, prev_state: &S, next_state: &S) -> bool
source§impl EventEvaluator<Spacecraft> for UmbraEvent
impl EventEvaluator<Spacecraft> for UmbraEvent
source§fn epoch_precision(&self) -> Duration
fn epoch_precision(&self) -> Duration
Stop searching when the time has converged to less than 0.1 seconds
source§fn value_precision(&self) -> f64
fn value_precision(&self) -> f64
Finds the darkest part of an eclipse within 2% of penumbra (i.e. 98% in shadow)
source§fn eval(&self, sc: &Spacecraft) -> f64
fn eval(&self, sc: &Spacecraft) -> f64
source§fn eval_string(&self, state: &Spacecraft) -> String
fn eval_string(&self, state: &Spacecraft) -> String
fn eval_crossing(&self, prev_state: &S, next_state: &S) -> bool
source§impl Interpolatable for Spacecraft
impl Interpolatable for Spacecraft
source§fn interpolate(self, epoch: Epoch, states: &[Self]) -> Result<Self, NyxError>
fn interpolate(self, epoch: Epoch, states: &[Self]) -> Result<Self, NyxError>
source§fn export_params() -> Vec<StateParameter>
fn export_params() -> Vec<StateParameter>
source§impl LowerExp for Spacecraft
impl LowerExp for Spacecraft
source§impl LowerHex for Spacecraft
impl LowerHex for Spacecraft
source§impl PartialEq for Spacecraft
impl PartialEq for Spacecraft
source§impl Serialize for Spacecraft
impl Serialize for Spacecraft
source§impl State for Spacecraft
impl State for Spacecraft
source§fn as_vector(&self) -> Result<OVector<f64, Const<90>>, NyxError>
fn as_vector(&self) -> Result<OVector<f64, Const<90>>, NyxError>
The vector is organized as such: [X, Y, Z, Vx, Vy, Vz, Cr, Cd, Fuel mass, STM(9x9)]
source§fn set(
&mut self,
epoch: Epoch,
vector: &OVector<f64, Const<90>>
) -> Result<(), NyxError>
fn set( &mut self, epoch: Epoch, vector: &OVector<f64, Const<90>> ) -> Result<(), NyxError>
Vector is expected to be organized as such: [X, Y, Z, Vx, Vy, Vz, Cr, Cd, Fuel mass, STM(9x9)]
source§fn stm(&self) -> Result<OMatrix<f64, Self::Size, Self::Size>, NyxError>
fn stm(&self) -> Result<OMatrix<f64, Self::Size, Self::Size>, NyxError>
diag(STM) = [X,Y,Z,Vx,Vy,Vz,Cr,Cd,Fuel] WARNING: Currently the STM assumes that the fuel mass is constant at ALL TIMES!
type VecLength = Const<90>
source§fn reset_stm(&mut self)
fn reset_stm(&mut self)
source§fn zeros() -> Self
fn zeros() -> Self
source§fn add(self, other: OVector<f64, Self::Size>) -> Self
fn add(self, other: OVector<f64, Self::Size>) -> Self
source§fn value(&self, param: StateParameter) -> Result<f64, NyxError>
fn value(&self, param: StateParameter) -> Result<f64, NyxError>
source§impl TrackingDeviceSim<Spacecraft, RangeDoppler> for GroundStation
impl TrackingDeviceSim<Spacecraft, RangeDoppler> for GroundStation
source§fn measure(
&mut self,
epoch: Epoch,
traj: &Traj<Spacecraft>,
rng: Option<&mut Pcg64Mcg>,
cosm: Arc<Cosm>
) -> Result<Option<RangeDoppler>, NyxError>
fn measure( &mut self, epoch: Epoch, traj: &Traj<Spacecraft>, rng: Option<&mut Pcg64Mcg>, cosm: Arc<Cosm> ) -> Result<Option<RangeDoppler>, NyxError>
Perform a measurement from the ground station to the receiver (rx).
source§fn location(&self, epoch: Epoch, frame: Frame, cosm: &Cosm) -> Orbit
fn location(&self, epoch: Epoch, frame: Frame, cosm: &Cosm) -> Orbit
fn measure_instantaneous( &mut self, rx: Spacecraft, rng: Option<&mut Pcg64Mcg>, cosm: Arc<Cosm> ) -> Result<Option<RangeDoppler>, NyxError>
source§impl UpperExp for Spacecraft
impl UpperExp for Spacecraft
source§impl UpperHex for Spacecraft
impl UpperHex for Spacecraft
impl Copy for Spacecraft
Auto Trait Implementations§
impl RefUnwindSafe for Spacecraft
impl Send for Spacecraft
impl Sync for Spacecraft
impl Unpin for Spacecraft
impl UnwindSafe for Spacecraft
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Printing<T> for Twhere
T: Display,
impl<T> Printing<T> for Twhere
T: Display,
§fn to_str(self) -> String
fn to_str(self) -> String
printing.rs
.§fn to_plainstr(self) -> String
fn to_plainstr(self) -> String
printing.rs
.§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.