pub struct BaseSpacecraft<X: SpacecraftExt> {
    pub orbit: Orbit,
    pub dry_mass_kg: f64,
    pub fuel_mass_kg: f64,
    pub srp_area_m2: f64,
    pub drag_area_m2: f64,
    pub cr: f64,
    pub cd: f64,
    pub thruster: Option<Thruster>,
    pub stm: Option<OMatrix<f64, Const<9>, Const<9>>>,
    pub ext: X,
}
Expand description

A spacecraft state

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_area_m2: f64

in m^2

§drag_area_m2: f64

in m^2

§cr: f64

coefficient of reflectivity, must be between 0.0 (translucent) and 2.0 (all radiation absorbed and twice the force is transmitted back).

§cd: f64

coefficient of drag; (spheres are between 2.0 and 2.1, use 2.2 in Earth’s atmosphere).

§thruster: Option<Thruster>§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)

§ext: X

Any extra information or extension that is needed for specific guidance laws

Implementations§

source§

impl<X: SpacecraftExt> BaseSpacecraft<X>

source

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

source

pub fn from_thruster( orbit: Orbit, dry_mass_kg: f64, fuel_mass_kg: f64, thruster: Thruster, ext: X ) -> Self

Initialize a spacecraft state from only a thruster and mass. Use this when designing guidance laws whilke ignoring drag and SRP.

source

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!)

source

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!)

source

pub fn with_dv(self, dv: Vector3<f64>) -> Self

source

pub fn with_dry_mass(self, dry_mass_kg: f64) -> Self

Returns a copy of the state with a new dry mass

source

pub fn with_fuel_mass(self, fuel_mass_kg: f64) -> Self

Returns a copy of the state with a new fuel mass

source

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

source

pub fn with_srp_area(self, srp_area_m2: f64) -> Self

Returns a copy of the state with a new SRP area

source

pub fn with_cr(self, cr: f64) -> Self

Returns a copy of the state with a new coefficient of reflectivity

source

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

source

pub fn with_drag_area(self, drag_area_m2: f64) -> Self

Returns a copy of the state with a new SRP area

source

pub fn with_cd(self, cd: f64) -> Self

Returns a copy of the state with a new coefficient of drag

source

pub fn with_orbit(self, orbit: Orbit) -> Self

Returns a copy of the state with a new orbit

source

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

source

pub fn enable_stm(&mut self)

Sets the STM of this state of identity, which also enables computation of the STM for spacecraft navigation

source

pub fn with_stm(self) -> Self

Copies the current state but sets the STM to identity

source

pub fn mass_kg(&self) -> f64

Returns the total mass in kilograms

source

pub fn degrade_to_spacecraft(&self) -> Spacecraft

Allows the automatic conversion of a BaseSpacecraft into a standard spacecraft. WARNING: This will IGNORE the extra of BaseSpacecraft

source§

impl BaseSpacecraft<GuidanceMode>

source

pub fn with_guidance_mode(self, mode: GuidanceMode) -> Self

Returns a copy of the state with the provided guidance mode

source

pub fn mode(&self) -> GuidanceMode

source

pub fn mut_mode(&mut self, mode: GuidanceMode)

Trait Implementations§

source§

impl<X: SpacecraftExt> Add<Matrix<f64, Const<6>, Const<1>, <DefaultAllocator as Allocator<f64, Const<6>, Const<1>>>::Buffer>> for BaseSpacecraft<X>

source§

fn add(self, other: OVector<f64, Const<6>>) -> Self

Adds the provided state deviation to this orbit

§

type Output = BaseSpacecraft<X>

The resulting type after applying the + operator.
source§

impl<X: SpacecraftExt> Add<Matrix<f64, Const<9>, Const<1>, <DefaultAllocator as Allocator<f64, Const<9>, Const<1>>>::Buffer>> for BaseSpacecraft<X>

source§

fn add(self, other: OVector<f64, Const<9>>) -> Self

Adds the provided state deviation to this orbit

§

type Output = BaseSpacecraft<X>

The resulting type after applying the + operator.
source§

impl<X: Clone + SpacecraftExt> Clone for BaseSpacecraft<X>

source§

fn clone(&self) -> BaseSpacecraft<X>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<X: Debug + SpacecraftExt> Debug for BaseSpacecraft<X>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<X: SpacecraftExt> Default for BaseSpacecraft<X>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<X: SpacecraftExt> Display for BaseSpacecraft<X>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl EstimateFrom<BaseSpacecraft<GuidanceMode>> for Orbit

source§

fn extract(from: Spacecraft) -> Self

From the state extract the state to be estimated
source§

impl EstimateFrom<BaseSpacecraft<GuidanceMode>> for Spacecraft

source§

fn extract(from: Spacecraft) -> Self

From the state extract the state to be estimated
source§

impl EventEvaluator<BaseSpacecraft<GuidanceMode>> for Event

source§

fn eval(&self, state: &Spacecraft) -> f64

source§

fn epoch_precision(&self) -> Duration

source§

fn value_precision(&self) -> f64

source§

fn eval_crossing(&self, prev_state: &S, next_state: &S) -> bool

source§

impl EventEvaluator<BaseSpacecraft<GuidanceMode>> for PenumbraEvent

source§

fn epoch_precision(&self) -> Duration

Stop searching when the time has converged to less than 0.1 seconds

source§

fn value_precision(&self) -> f64

Finds the slightest penumbra within 2%(i.e. 98% in visibility)

source§

fn eval(&self, sc: &Spacecraft) -> f64

source§

fn eval_crossing(&self, prev_state: &S, next_state: &S) -> bool

source§

impl EventEvaluator<BaseSpacecraft<GuidanceMode>> for UmbraEvent

source§

fn epoch_precision(&self) -> Duration

Stop searching when the time has converged to less than 0.1 seconds

source§

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

source§

fn eval_crossing(&self, prev_state: &S, next_state: &S) -> bool

source§

impl<X: SpacecraftExt> LowerExp for BaseSpacecraft<X>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter.
source§

impl<X: SpacecraftExt> LowerHex for BaseSpacecraft<X>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter.
source§

impl MdHdlr<BaseSpacecraft<GuidanceMode>> for OrbitStateOutput

source§

fn handle(&mut self, state: &Spacecraft)

source§

impl MeasurementDevice<BaseSpacecraft<GuidanceMode>, StdMeasurement> for GroundStation

source§

fn measure(&self, sc_rx: &Spacecraft) -> Option<StdMeasurement>

Perform a measurement from the ground station to the receiver (rx).

source§

impl<X: SpacecraftExt> PartialEq<BaseSpacecraft<X>> for BaseSpacecraft<X>

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<X: SpacecraftExt> State for BaseSpacecraft<X>

source§

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>

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>

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 Size = Const<9>

Size of the state and its STM
§

type VecLength = Const<90>

source§

fn reset_stm(&mut self)

Return this state as a vector for the propagation/estimation By default, this is not implemented. This function must be implemented when filtering on this state.
source§

fn zeros() -> Self

Initialize an empty state By default, this is not implemented. This function must be implemented when filtering on this state.
source§

fn epoch(&self) -> Epoch

Retrieve the Epoch
source§

fn set_epoch(&mut self, epoch: Epoch)

Set the Epoch
source§

fn add(self, other: OVector<f64, Self::Size>) -> Self

By default, this is not implemented. This function must be implemented when filtering on this state.
source§

fn value(&self, param: &StateParameter) -> Result<f64, NyxError>

Return the value of the parameter, returns an error by default
source§

fn set_value(&mut self, param: &StateParameter, val: f64) -> Result<(), NyxError>

Allows setting the value of the given parameter. NOTE: Most parameters where the value is available CANNOT be also set for that parameter (it’s a much harder problem!)
source§

impl<X: SpacecraftExt> UpperExp for BaseSpacecraft<X>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter.
source§

impl<X: SpacecraftExt> UpperHex for BaseSpacecraft<X>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter.
source§

impl<X: Copy + SpacecraftExt> Copy for BaseSpacecraft<X>

Auto Trait Implementations§

§

impl<X> RefUnwindSafe for BaseSpacecraft<X>where X: RefUnwindSafe,

§

impl<X> Send for BaseSpacecraft<X>

§

impl<X> Sync for BaseSpacecraft<X>

§

impl<X> Unpin for BaseSpacecraft<X>where X: Unpin,

§

impl<X> UnwindSafe for BaseSpacecraft<X>where X: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Printing<T> for Twhere T: Display,

§

fn to_str(self) -> String

Method to serialize. Decorates Vecs with square brackets and tuples with round ones. Implementation code is in printing.rs.
§

fn to_plainstr(self) -> String

Method to serialize in minimal form (space separated, no brackets) Implementation code is in printing.rs.
§

fn rd(self) -> String

Printable in red
§

fn gr(self) -> String

Printable in green
§

fn bl(self) -> String

Printable in blue
§

fn yl(self) -> String

Printable in yellow
§

fn mg(self) -> String

Printable in magenta
§

fn cy(self) -> String

Printable in cyan
§

fn wvec(self, f: &mut File) -> Result<(), Error>

Method to write vector(s) to file f (space separated, without brackets). Passes up io errors
§

fn pvec(self)

Method to print vector(s) to stdout (space separated,without brackets).
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> Scalar for Twhere T: 'static + Clone + PartialEq<T> + Debug,