コンテンツにスキップ

SpacecraftDynamics

このコンテンツはまだ日本語訳がありません。

Defined in: dynamics.rs:32

pub struct SpacecraftDynamics\<G: [GravityField](../../traits/gravityfield/), F: [Eci](../../../../arika/api/traits/eci/) = [arika::frame::SimpleEci](../../../../arika/api/type-aliases/simpleeci/)\>

Coupled orbit-attitude dynamics for a rigid spacecraft.

Composes a gravitational field, inertia tensor, external load models, and state effectors (e.g. reaction wheels) into a DynamicalSystem for the augmented spacecraft state.

Parameterized by the inertial frame F (default SimpleEci), matching SpacecraftState<F>.

The state type is AugmentedState<SpacecraftState<F>> — the 14D plant state (orbit 6D + attitude 7D + mass 1D) plus concatenated auxiliary variables from registered StateEffectors (e.g. RW angular momentum). When no effectors are registered, aux is empty and the dynamics are equivalent to the pre-effector version.

Equations of motion:

  • Translation: dr/dt = v, dv/dt = a_gravity + Σ a_loads
  • Rotation: dq/dt = ½ q ⊗ (0,ω), dω/dt = I⁻¹(τ − ω × Iω)
  • Auxiliary: daux/dt from registered effectors

fn new(mu: f64, gravity: G, inertia: Matrix3<f64>) -> Self

Create with gravitational parameter, gravity model, and inertia tensor.

Panics if inertia is singular (not invertible).


fn with_model(self, model: impl [Model<SpacecraftState<F>>](../../traits/model/) + ‘static) -> Self

Add an external model (builder pattern).


fn with_effector(self, effector: impl [StateEffector<SpacecraftState<F>>](../../traits/stateeffector/) + ‘static) -> Self

Add a state effector (builder pattern).

Effectors have auxiliary state (e.g. RW angular momentum) that is integrated alongside the plant state. The effector must produce its loads in this system’s inertial frame F (its StateEffector::derivatives returns ExternalLoads<F>), so the dynamics never re-tag coordinates. See issue #103.


fn with_epoch(self, epoch: Epoch) -> Self

Set the initial epoch corresponding to integration time t = 0.


fn with_body_radius(self, radius: f64) -> Self

Set the central body radius for event detection.


fn initial_augmented_state(&self, plant: SpacecraftState<F>) -> [AugmentedState<SpacecraftState<F>>](../augmentedstate/)

Create an initial augmented state with the given plant state.

Auxiliary state is initialized to zeros; bounds are collected from all registered effectors.


fn effector<T: [StateEffector<SpacecraftState<F>>](../../traits/stateeffector/) + ‘static>(&self, index: usize) -> Option<&T>

Downcast a state effector by index (immutable).


fn effector_mut<T: [StateEffector<SpacecraftState<F>>](../../traits/stateeffector/) + ‘static>(&mut self, index: usize) -> Option<&mut T>

Downcast a state effector by index (mutable).


fn effector_by_name<T: [StateEffector<SpacecraftState<F>>](../../traits/stateeffector/) + ‘static>(&self, name: &str) -> Option<&T>

Find and downcast a state effector by name (immutable).


fn effector_by_name_mut<T: [StateEffector<SpacecraftState<F>>](../../traits/stateeffector/) + ‘static>(&mut self, name: &str) -> Option<&mut T>

Find and downcast a state effector by name (mutable).


fn registry(&self) -> &AuxRegistry

Get the auxiliary state registry.


fn inertia(&self) -> &Matrix3<f64>

Get the inertia tensor.


fn body_radius(&self) -> Option<f64>

Get the central body radius (if set).


fn replace_model(&mut self, name: &str, new_model: [Box<dyn [Model<SpacecraftState<F>>](../../traits/model/)>](https://doc.rust-lang.org/std/boxed/struct.Box.html)) -> [Option<[Box<dyn [Model<SpacecraftState<F>>](../../traits/model/)>](https://doc.rust-lang.org/std/boxed/struct.Box.html)>](https://doc.rust-lang.org/std/option/enum.Option.html)

Replace a model by name, returning the old one (if found).

This is used to swap in a model with updated commanded state between integration segments (e.g., MtqAssembly with a new command).


fn model_names(&self) -> Vec<&str>

Names of active models.


fn model_breakdown(&self, t: f64, state: &SpacecraftState<F>) -> [Vec<(&str, ExternalLoads<F>)>](https://doc.rust-lang.org/std/vec/struct.Vec.html)

Per-model load breakdown at the given state.


fn torque_breakdown(&self, t: f64, state: &SpacecraftState<F>) -> [Vec<(&str, [arika::frame::Vec3<arika::frame::Body>](../../../../arika/api/structs/vec3/))>](https://doc.rust-lang.org/std/vec/struct.Vec.html)

Per-model disturbance torque in the body frame [N·m], for telemetry.

The vector rather than a magnitude, because a magnitude carries neither the sign nor the axis, and those are what a torque is read for: an attitude disturbance that turns the wrong way looks the same size as one that turns the right way.

The gravity field is absent. It acts on the centre of mass, so it exerts no torque about it; a gravity-gradient torque is a Model(crate::model::Model) and answers under its own name. This is why the list is one entry per model, where acceleration_breakdown(Self::acceleration_breakdown) leads with "gravity".

Every model answers, not only the environmental ones. A magnetorquer and a thruster assembly are Models and are installed as such, so their commanded torques appear here under their own names. A reaction wheel is a StateEffector — it carries its own state — and is absent; its momentum is read from the effector.


fn acceleration_breakdown(&self, t: f64, state: &SpacecraftState<F>) -> Vec<(&str, f64)>

Acceleration breakdown for telemetry.