pub struct Simulator<E> { /* private fields */ }Expand description
Stateless RK4 stepper over an immutable vehicle, force model and settings.
Motor ignition, each thrust knot and burnout split integration intervals so no step straddles a motor discontinuity. Mass is evaluated analytically at every RK stage. Collision detection and terrain termination belong to the host application.
Implementations§
Source§impl<E: ForceModel> Simulator<E>
impl<E: ForceModel> Simulator<E>
Sourcepub fn new(
rocket: Rocket,
forces: E,
settings: IntegratorSettings,
) -> Result<Self>
pub fn new( rocket: Rocket, forces: E, settings: IntegratorSettings, ) -> Result<Self>
Create a reusable simulator, validating settings before any integration.
Sourcepub fn rocket(&self) -> &Rocket
pub fn rocket(&self) -> &Rocket
The vehicle configuration needed alongside a snapshot to resume a flight.
Sourcepub fn forces_mut(&mut self) -> &mut E
pub fn forces_mut(&mut self) -> &mut E
Access the environment to update externally sampled weather between steps.
Sourcepub fn settings(&self) -> IntegratorSettings
pub fn settings(&self) -> IntegratorSettings
Validated integrator settings.
Sourcepub fn step(
&self,
state: &FlightState,
duration_s: f64,
control: ControlInput,
) -> Result<StepResult>
pub fn step( &self, state: &FlightState, duration_s: f64, control: ControlInput, ) -> Result<StepResult>
Advance using an externally supplied command, held fixed for the requested duration. Call at a fixed cadence to obtain repeatable controller and integration behavior.
Sourcepub fn step_guided<G: Guidance + ?Sized>(
&self,
state: &FlightState,
duration_s: f64,
guidance: &mut G,
) -> Result<StepResult>
pub fn step_guided<G: Guidance + ?Sized>( &self, state: &FlightState, duration_s: f64, guidance: &mut G, ) -> Result<StepResult>
Evaluate guidance once, then advance under its held command. Invalid state/duration is rejected before calling guidance. A later model error leaves the input flight state unchanged but does not roll back the controller.
Trait Implementations§
Auto Trait Implementations§
impl<E> Freeze for Simulator<E>where
E: Freeze,
impl<E> RefUnwindSafe for Simulator<E>where
E: RefUnwindSafe,
impl<E> Send for Simulator<E>where
E: Send,
impl<E> Sync for Simulator<E>where
E: Sync,
impl<E> Unpin for Simulator<E>where
E: Unpin,
impl<E> UnsafeUnpin for Simulator<E>where
E: UnsafeUnpin,
impl<E> UnwindSafe for Simulator<E>where
E: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§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).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.