ADCS.estimators.initialization module¶
Quantities a warm start needs, read straight off a measurement vector.
vector_observations() turns the attitude sensors’ readings into pairs
of unit directions, one in the body frame and one in the inertial frame,
each with an angular standard deviation, ready for
attitude_determination. Single-axis sensors
(magnetometers, sun sensors, sun pairs) are combined into one direction per
kind by weighted least squares; vector sensors (Earth horizon, star tracker)
are taken as they are. angular_rate_from_readings() does the same for
the gyros, and wheel_momentum_from_readings() collects the reaction
wheel readings.
- class ADCS.estimators.initialization.VectorObservation(kind, body, reference, sigma, sources)[source]¶
Bases:
objectOne direction seen in the body frame and known in the inertial frame.
- Parameters:
kind (str) – What was observed (
"magnetic_field","sun","nadir","star").body (ndarray) – Unit direction in the body frame.
reference (ndarray) – Unit direction in the inertial frame.
sigma (float) – Angular standard deviation of
bodyin radians, the same in every direction perpendicular to it.sources (tuple[str, ...]) – Names of the measurement-stack entries that produced it.
- body: ndarray¶
- kind: str¶
- reference: ndarray¶
- sigma: float¶
- sources: tuple[str, ...]¶
- class ADCS.estimators.initialization.WarmStart(method='auto', rate='gyro', wheel_momentum='readings', act_bias=None, sens_bias=None, dist_param=None, attitude_std=None, rate_std=None, wheel_momentum_std=None, act_bias_std=None, sens_bias_std=None, dist_param_std=None, process_noise=None, star_references=None, max_attitude_std=3.141592653589793)[source]¶
Bases:
objectHow to build an estimator’s initial state from its first readings.
Pass an instance in place of the
stateof any attitude estimator, or tofrom_readings(). The attitude is solved from the direction observations (seeattitude_from_readings()), the angular rate is read off the gyros assuming zero bias, and the wheel momenta off the wheels. Biases and disturbance parameters start at zero unless given. Every*_stdis an initial standard deviation, a single number or one per element; the attitude, rate and wheel-momentum ones default to what the sensors’ noise implies, the bias and disturbance ones must be given whenever the satellite estimates such parameters, and a value you supply yourself (a rate, wheel momenta) needs its standard deviation too.- Parameters:
method (str) –
"auto"(a quaternion star tracker when one has a reading, otherwise QUEST),"quest","triad"(the two most precise directions) or"tracker".rate (Any) –
"gyro"or the initial angular rate in rad/s.wheel_momentum (Any) –
"readings"or the initial wheel momenta.act_bias (Any) – Initial actuator biases (default zeros).
sens_bias (Any) – Initial sensor biases (default zeros).
dist_param (Any) – Initial disturbance parameters (default zeros).
attitude_std (Any) – Attitude standard deviation in rad, per body axis; default from the observations.
rate_std (Any) – Rate standard deviation in rad/s; default from the gyro noise.
wheel_momentum_std (Any) – Wheel-momentum standard deviation; default from the wheels’ momentum-measurement noise.
act_bias_std (Any) – Actuator-bias standard deviations.
sens_bias_std (Any) – Sensor-bias standard deviations.
dist_param_std (Any) – Disturbance-parameter standard deviations.
process_noise (Any) – The per-step process covariance the filter adds (
int_cov), in the filter’s covariance coordinates; default zeros.star_references (Mapping[Any, Any] | None) – Inertial directions for vector star trackers, see
vector_observations().max_attitude_std (float) – Cap, in rad, for an attitude axis the observations barely determine (nearly parallel directions); the default, pi, means “unknown” and leaves the filter’s first corrections to settle it.
- act_bias: Any = None¶
- act_bias_std: Any = None¶
- attitude_std: Any = None¶
- dist_param: Any = None¶
- dist_param_std: Any = None¶
- max_attitude_std: float = 3.141592653589793¶
- method: str = 'auto'¶
- process_noise: Any = None¶
- rate: Any = 'gyro'¶
- rate_std: Any = None¶
- sens_bias: Any = None¶
- sens_bias_std: Any = None¶
- star_references: Mapping[Any, Any] | None = None¶
- wheel_momentum: Any = 'readings'¶
- wheel_momentum_std: Any = None¶
- ADCS.estimators.initialization.angular_rate_from_readings(satellite, readings)[source]¶
Body angular rate from the gyro readings, assuming zero gyro bias.
- Returns:
(rate, covariance)in rad/s and (rad/s)^2, by weighted least squares over the gyros with finite readings.- Raises:
ValueError – when fewer than three non-coplanar gyro axes have readings.
- Parameters:
satellite (Any)
readings (Any)
- ADCS.estimators.initialization.attitude_from_readings(satellite, readings, orbital_state, *, method='auto', star_references=None)[source]¶
The attitude at the time of one raw measurement vector.
"quest"solves Wahba’s problem over every direction observation (vector_observations()),"triad"uses the two most precise ones,"tracker"takes the reading of a quaternion star tracker, and"auto"takes the tracker when one has a finite reading and QUEST otherwise. The solution’s covariance is the small-angle attitude-error covariance in the body frame, in rad^2.- Raises:
ValueError – when the readings do not determine the attitude (fewer than two usable directions, for example in eclipse with only magnetometers and sun sensors, or parallel directions); the message says to pass the initial attitude explicitly.
- Parameters:
satellite (Any)
readings (Any)
orbital_state (Any)
method (str)
star_references (Mapping[Any, Any] | None)
- Return type:
- ADCS.estimators.initialization.initial_state_from_readings(satellite, readings, orbital_state, warm_start=None, *, covariance_coordinates='tangent', quaternion_mode='quaternion_vector')[source]¶
A complete initial estimator state from one raw measurement vector.
The values come from the readings as the
WarmStartrecipe says (its defaults: attitude by"auto", rate from the gyros, wheel momenta from the wheels, zero biases and disturbance parameters). The covariance is block diagonal: the attitude solution’s covariance, the gyro least-squares covariance, the wheels’ momentum-measurement noise, and the given bias and disturbance standard deviations. Its attitude block is expressed in thequaternion_modechart, and forcovariance_coordinates="full"(the EKF) the whole matrix is projected onto the four quaternion components.- Parameters:
satellite (Any) – The
EstimatedSatellitethe estimator uses.readings (Any) – Raw measurement vector, in the measurement stack’s order.
orbital_state (Any) – Orbital state at the time of the readings.
warm_start (WarmStart | None) – The recipe;
Nonefor the defaults.covariance_coordinates (str) –
"tangent"(MEKF, UKF, SRUKF) or"full"(EKF).quaternion_mode (str) – Chart of the attitude block; the estimator’s
quaternion_mode.
- Raises:
ValueError – when the readings do not determine the attitude or the rate, or the recipe lacks a required standard deviation.
- Return type:
- ADCS.estimators.initialization.vector_observations(satellite, readings, orbital_state, *, star_references=None, lit_threshold_sigmas=3.0, sigma_floor=1e-06)[source]¶
Direction pairs from the attitude sensors’ readings.
Single-axis sensors of one kind (three magnetometers, a set of sun sensors) are combined by weighted least squares into one direction per kind; at least three non-coplanar axes with finite readings are needed, otherwise that kind is skipped. Sun sensors count only when lit (reading above
lit_threshold_sigmasnoise standard deviations); in eclipse their readings areNaNand no sun direction results. Vector sensors give one observation each. A vector star tracker needs its star’s inertial direction instar_references(keyed by measurement-stack entry name or sensor index) because the reading does not say which star it saw.- Parameters:
satellite (Any) – The
EstimatedSatellitewhose measurement layout the readings follow.readings (Any) – Raw measurement vector, in the measurement stack’s order.
orbital_state (Any) – Orbital state at the time of the readings (reference directions).
star_references (Mapping[Any, Any] | None) – Inertial unit directions for vector star trackers.
lit_threshold_sigmas (float) – A sun sensor is lit when its reading exceeds this many noise sigmas.
sigma_floor (float) – Smallest angular standard deviation reported, in radians; perfect (noise-free) sensors get this value. The default, 1e-6 rad, is well below any real sensor and keeps the weights of a mixed set within what the attitude solvers handle accurately.
- Returns:
One
VectorObservationper observed direction; possibly empty.- Return type:
list[VectorObservation]