Simulation#
Simulation runners and experiment helpers.
Trial Runner#
Quadrotor parameter-estimation trial runner.
Orchestrates a closed-loop simulation: trajectory tracking via LQR,
online parameter estimation using any algorithm from online_estimators.estimators,
and payload-change events.
- online_estimators.simulation.trial.make_estimator(name, theta0, window, seed=None)[source]#
Instantiate an estimator by name.
- Parameters:
name (
str) – Algorithm identifier (case-insensitive)."gt"or"none"returnsNone.theta0 (
ndarray) – Initial parameter estimate.window (
int) – Number of stacked measurement rows (used for KF noise sizing).seed (
int|None) – If provided, seed the internal RNG of randomised estimators for reproducibility.
- Return type:
estimator or None
- Raises:
ValueError – If name is not recognised.
- online_estimators.simulation.trial.gate_param_update(theta, A, b, rel_resid_max=0.0001, verbose=False)[source]#
Safety gate: accept or reject a proposed parameter update.
Checks physical plausibility (mass bounds, COM bounds, inertia eigenvalues) and numerical quality (relative residual).
- online_estimators.simulation.trial.run_single_trial(estimator_name, base_seed, seed_offset, est_freq, window, ref_type, T_sim=20.0, noise='none', *, verbose_ctrl=False, verbose_est=False)[source]#
Run one closed-loop quadrotor parameter-estimation trial.
- Parameters:
estimator_name (
str) – Algorithm name (seemake_estimator()).base_seed (
int) – Base random seed.seed_offset (
int) – Offset added to base_seed for reproducibility across trials.est_freq (
int) – Estimation update period (in simulation steps).window (
int) – Number of consecutive measurement snapshots stacked per update.ref_type (
str) – Trajectory type (key intoTRAJECTORY_REGISTRY).T_sim (
float) – Simulation duration (s).noise (
str) – Sensor noise level:"none","low","medium","high".verbose_ctrl (
bool) – Print per-step control debug info.verbose_est (
bool) – Print per-update estimation debug info.
- Returns:
Result dictionary with trajectory data, errors, and metadata.
- Return type:
Utilities#
Small numerical helper functions used across simulations.
- online_estimators.simulation.utils.rel_residual(A, x, b, eps=1e-12)[source]#
Relative residual
||Ax - b||_2 / max(||b||_2, eps).