SunSensor
このコンテンツはまだ日本語訳がありません。
Defined in: sun_sensor.rs:45
pub struct SunSensorSun 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 any body can block the Sun (occulters is not empty),
the sensor also computes the illumination fraction. During total
eclipse (illumination = 0), direction is None.
Methods
Section titled “Methods”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.
for_earth()
Section titled “for_earth()”fn for_earth() -> Self
Create a sun sensor for Earth orbit with conical shadow model.
for_body()
Section titled “for_body()”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).
with_noise()
Section titled “with_noise()”fn with_noise(self, noise: impl NoiseModel + ‘static) -> Self
Add a noise model. Multiple calls chain in order.
without_shadow()
Section titled “without_shadow()”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.
with_shadow_body()
Section titled “with_shadow_body()”fn with_shadow_body(self, radius: f64) -> Self
Set the shadow body radius for eclipse computation.
Panics
Section titled “Panics”Panics unless the radius is finite and positive, as
OccultingBody::central(crate::eclipse::OccultingBody::central) does:
a body of no radius would silently stop casting a shadow.
with_shadow_model()
Section titled “with_shadow_model()”fn with_shadow_model(self, model: ShadowModel) -> Self
Set the shadow model. Set the shadow geometry of the central body.
A distant occulter keeps its own: the Earth seen from a lunar orbit has to stay conical, where a cylindrical shadow would call 6.83 hours a year dark against the true 3.67.
with_occulter()
Section titled “with_occulter()”fn with_occulter(self, occulter: OccultingBody) -> Self
Add a body that can block the Sun, beside those already there.
measure()
Section titled “measure()”fn measure(&mut self, t: f64, state: &SpacecraftState, epoch: &Epoch) -> SunSensorOutput
Measure the sun direction in the body frame (fine sun sensor).
Returns SunSensorOutput::Fine with:
direction: Some(...), a unit vector, when the sun is visible (illumination > 0) and the noisy vector still has a directiondirection: Nonewhen in total eclipse (illumination = 0), when the spacecraft is at the Sun’s centre, or when noise left a zero or non-finite vectorilluminationin [0, 1]: actual eclipse-aware illumination fraction, reported whether or not a direction came out
t is the sim time of the sample [s], which the noise models are keyed on.
measure_in_frame()
Section titled “measure_in_frame()”fn measure_in_frame<F: EphemerisFrameBridge>(&mut self, t: f64, 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.