pub struct BaseSpacecraftDynamics<'a, X: SpacecraftExt> {
    pub orbital_dyn: OrbitalDynamics<'a>,
    pub force_models: Vec<Arc<dyn ForceModel<X> + 'a>>,
    pub guid_law: Option<Arc<dyn GuidanceLaw<X> + 'a>>,
    pub decrement_mass: bool,
}
Expand description

A generic spacecraft dynamics with associated force models, guidance law, and flag specifying whether to decrement the fuel mass or not. Note: when developing new guidance laws, it is recommended to not enable fuel decrement until the guidance law seems to work without proper physics. Note: if the spacecraft runs out of fuel, the propagation segment will return an error.

Fields§

§orbital_dyn: OrbitalDynamics<'a>§force_models: Vec<Arc<dyn ForceModel<X> + 'a>>§guid_law: Option<Arc<dyn GuidanceLaw<X> + 'a>>§decrement_mass: bool

Implementations§

source§

impl<'a, X: SpacecraftExt> BaseSpacecraftDynamics<'a, X>

source

pub fn from_guidance_law( orbital_dyn: OrbitalDynamics<'a>, guid_law: Arc<dyn GuidanceLaw<X> + 'a> ) -> Self

Initialize a Spacecraft with a set of orbital dynamics and a propulsion subsystem. By default, the mass of the vehicle will be decremented as propellant is consummed.

source

pub fn from_guidance_law_no_decr( orbital_dyn: OrbitalDynamics<'a>, guid_law: Arc<dyn GuidanceLaw<X> + 'a> ) -> Self

Initialize a Spacecraft with a set of orbital dynamics and a propulsion subsystem. Will not decrement the fuel mass as propellant is consummed.

source

pub fn new(orbital_dyn: OrbitalDynamics<'a>) -> Self

Initialize a Spacecraft with a set of orbital dynamics and with SRP enabled.

source

pub fn from_model( orbital_dyn: OrbitalDynamics<'a>, force_model: Arc<dyn ForceModel<X> + 'a> ) -> Self

Initialize new spacecraft dynamics with the provided orbital mechanics and with the provided force model.

source

pub fn from_models( orbital_dyn: OrbitalDynamics<'a>, force_models: Vec<Arc<dyn ForceModel<X> + 'a>> ) -> Self

Initialize new spacecraft dynamics with a vector of force models.

source

pub fn add_model(&mut self, force_model: Arc<dyn ForceModel<X> + 'a>)

Add a model to the currently defined spacecraft dynamics

source

pub fn with_model(self, force_model: Arc<dyn ForceModel<X> + 'a>) -> Self

Clone these dynamics and add a model to the currently defined orbital dynamics

source

pub fn guidance_achieved( &self, state: &BaseSpacecraft<X> ) -> Result<bool, NyxError>

A shortcut to spacecraft.guid_law if a guidance law is defined for these dynamics

source

pub fn with_guidance_law(&self, guid_law: Arc<dyn GuidanceLaw<X> + 'a>) -> Self

Clone these spacecraft dynamics and update the control to the one provided.

source

pub fn with_guidance_law_no_decr( &self, guid_law: Arc<dyn GuidanceLaw<X> + 'a> ) -> Self

Clone these spacecraft dynamics and update the control to the one provided.

source

pub fn without_guidance_law(&self) -> Self

Clone these spacecraft dynamics and remove any control model

Trait Implementations§

source§

impl<'a, X: Clone + SpacecraftExt> Clone for BaseSpacecraftDynamics<'a, X>

source§

fn clone(&self) -> BaseSpacecraftDynamics<'a, 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<'a, X: SpacecraftExt> Display for BaseSpacecraftDynamics<'a, X>

source§

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

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

impl<'a, X: SpacecraftExt> Dynamics for BaseSpacecraftDynamics<'a, X>

§

type HyperdualSize = Const<9>

The state of the associated hyperdual state, almost always StateType + U1
§

type StateType = BaseSpacecraft<X>

source§

fn finally( &self, next_state: Self::StateType ) -> Result<Self::StateType, NyxError>

Optionally performs some final changes after each successful integration of the equations of motion. For example, this can be used to update the Guidance mode. NOTE: This function is also called just prior to very first integration step in order to update the initial state if needed.
source§

fn eom( &self, delta_t: f64, state: &OVector<f64, Const<90>>, ctx: &Self::StateType ) -> Result<OVector<f64, Const<90>>, NyxError>

Defines the equations of motion for these dynamics, or a combination of provided dynamics. The time delta_t is in seconds PAST the context epoch. The state vector is the state which changes for every intermediate step of the integration. The state context is the state of what is being propagated, it should allow rebuilding a new state context from the provided state vector.
source§

fn dual_eom( &self, delta_t_s: f64, ctx: &Self::StateType ) -> Result<(OVector<f64, Const<9>>, OMatrix<f64, Const<9>, Const<9>>), NyxError>

Defines the equations of motion for Dual numbers for these dynamics. All dynamics need to allow for automatic differentiation. However, if differentiation is not supported, then the dynamics should prevent initialization with a context which has an STM defined.

Auto Trait Implementations§

§

impl<'a, X> !RefUnwindSafe for BaseSpacecraftDynamics<'a, X>

§

impl<'a, X> Send for BaseSpacecraftDynamics<'a, X>

§

impl<'a, X> Sync for BaseSpacecraftDynamics<'a, X>

§

impl<'a, X> Unpin for BaseSpacecraftDynamics<'a, X>

§

impl<'a, X> !UnwindSafe for BaseSpacecraftDynamics<'a, X>

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