コンテンツにスキップ

SunSensor

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

Defined in: sun_sensor.rs:36

pub struct SunSensor

Sun sensor that measures the sun direction in the body frame.

Computes the satellite→Sun unit vector and rotates it into the body frame via the attitude quaternion:

d_eci = normalize(sun_pos_eci - sc_pos_eci)
d_body = noise(R_bi · d_eci)

When eclipse support is enabled (shadow_body_radius is set), the sensor also computes the illumination fraction. During total eclipse (illumination = 0), direction is None.

fn new() -> Self

Create an ideal sun sensor (no noise, no eclipse) for Earth orbit.

The Sun direction is geocentric. Use for_body(Self::for_body) for any other central body: from Mars in 2026 the geocentric direction is up to 176° away from where Mars sees the Sun.


fn for_earth() -> Self

Create a sun sensor for Earth orbit with conical shadow model.


fn for_body(body: KnownBody) -> [Result<Self, SunPositionError>](https://doc.rust-lang.org/std/result/enum.Result.html)

Create a sun sensor for orbit about body, with that body’s shadow.

Orbiting the Sun puts it at the origin, so the direction is -r_sat and nothing eclipses it. Fails for a central body with no Sun ephemeris (Uranus, Neptune).


fn with_noise(self, noise: impl NoiseModel + ‘static) -> Self

Add a noise model. Multiple calls chain in order.


fn without_shadow(self) -> Self

Drop the shadow, keeping the Sun direction this sensor was built with (builder pattern).

The same builder the two SRP models have: for_body(body)? carries that body’s conical shadow, and this asks for an unshadowed reading without going back to the geocentric Sun that new() reads.


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

Set the shadow body radius for eclipse computation.


fn with_shadow_model(self, model: ShadowModel) -> Self

Set the shadow model.


fn measure(&mut self, state: &SpacecraftState, epoch: &Epoch) -> SunSensorOutput

Measure the sun direction in the body frame (fine sun sensor).

Returns SunSensorOutput::Fine with:

  • direction: Some(...) when the sun is visible (illumination > 0)
  • direction: None when in total eclipse (illumination = 0)
  • illumination in [0, 1]: actual eclipse-aware illumination fraction

fn measure_in_frame<F: EphemerisFrameBridge>(&mut self, state: &SpacecraftState<F>, epoch: &Epoch) -> SunSensorOutput

Measure the sun direction in the body frame for a state propagated in an arbitrary inertial frame F.

The analytic Sun ephemeris is expressed in Gcrs, so it is rotated into F via EphemerisFrameBridge before being differenced with the spacecraft position — identity for SimpleEci/Gcrs (preserving the historical behavior exactly), the precession/nutation rotation for an of-date frame such as Cirs. A frame without that impl is a compile error rather than a silent GCRS-alignment assumption.