|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
Public Member Functions | |
| __init__ (self, ControllerConfig cfg, Optional[PintleEngineConfig] engine_config=None, Optional[ControllerLogger] logger=None) | |
| None | reset (self) |
| tuple | step (self, Measurement meas, NavState nav, Command cmd, ExecutionBackend backend=ExecutionBackend.PWM) |
Public Attributes | |
| cfg = cfg | |
| state = ControllerState() | |
| logger = logger | |
| engine_wrapper = None | |
| dynamics_params = DynamicsParams.from_config(cfg) | |
| Optional[np.ndarray] | x_prev = None |
| Optional[np.ndarray] | u_prev_applied = None |
| Optional[np.ndarray] | u_seq_prev = None |
| float | V_u_F = cfg.V_u_F_init if cfg.V_u_F_init is not None else 0.01 |
| float | V_u_O = cfg.V_u_O_init if cfg.V_u_O_init is not None else 0.01 |
| int | tick = 0 |
Protected Member Functions | |
| np.ndarray | _build_state (self, Measurement meas) |
| np.ndarray | _get_warm_start_control_sequence (self) |
| Optional[float] | _get_previous_f_ref (self) |
| None | _update_state (self, np.ndarray x, np.ndarray u_applied, solution, ref) |
Protected Attributes | |
| Optional[PolicyLUT] | _policy_lut = None |
Robust DDP controller for thrust regulation.
Definition at line 44 of file controller.py.
| engine.control.robust_ddp.controller.RobustDDPController.__init__ | ( | self, | |
| ControllerConfig | cfg, | ||
| Optional[PintleEngineConfig] | engine_config = None, | ||
| Optional[ControllerLogger] | logger = None ) |
Initialize robust DDP controller.
Parameters:
-----------
cfg : ControllerConfig
Controller configuration
engine_config : PintleEngineConfig, optional
Engine configuration (required for engine wrapper)
logger : ControllerLogger, optional
Logger instance. If None, no logging.
Definition at line 47 of file controller.py.
|
protected |
Build full state vector from measurements and internal ullage volumes.
Parameters:
-----------
meas : Measurement
Sensor measurements
Returns:
--------
x : np.ndarray, shape (N_STATE,)
Full state vector including gas masses
Definition at line 354 of file controller.py.
References dynamics_params, V_u_F, fsw::control::RobustDDPController::ControllerState.V_u_F, V_u_O, and fsw::control::RobustDDPController::ControllerState.V_u_O.
Referenced by step().
|
protected |
Get previous reference thrust for slew rate limiting.
Definition at line 416 of file controller.py.
Referenced by step().
|
protected |
Get warm start control sequence from previous solution.
Returns:
--------
u_seq_init : np.ndarray, shape (N, N_CONTROL)
Initial control sequence (shifted previous or small non-zero values)
Definition at line 394 of file controller.py.
References cfg, and u_seq_prev.
Referenced by step().
|
protected |
Update controller state for next tick.
Parameters:
-----------
x : np.ndarray
Current state
u_applied : np.ndarray
Applied control (after safety filter)
solution : DDPSolution
DDP solution
ref : Reference
Reference trajectory
Definition at line 421 of file controller.py.
References u_prev_applied, u_seq_prev, V_u_F, fsw::control::RobustDDPController::ControllerState.V_u_F, V_u_O, fsw::control::RobustDDPController::ControllerState.V_u_O, and x_prev.
Referenced by step().
| None engine.control.robust_ddp.controller.RobustDDPController.reset | ( | self | ) |
Reset controller state to initial values.
Definition at line 106 of file controller.py.
References cfg, reset(), anonymous_namespace{idle_e2e.cpp}::Beat.state, anonymous_namespace{idle_e2e.cpp}::World.state, battery_t.state, daqtest::Burst.state, detail::serializer< BasicJsonType >.state, state, feedtwin.session.core.BottleSim.state, feedtwin.session.core.Session.state, feedtwin.session.core.TankSim.state, feedtwin.session.network_trace.NetworkTrace.state, fsw::config::FireConfig.state, gnss_core_t.state, gnss_frame_parser_t.state, SensorHotfire::CoreState.state, sequencer::DynamicState.state, Valve.state, world_t.state, tick, u_prev_applied, u_seq_prev, V_u_F, fsw::control::RobustDDPController::ControllerState.V_u_F, V_u_O, fsw::control::RobustDDPController::ControllerState.V_u_O, and x_prev.
Referenced by reset().
| tuple engine.control.robust_ddp.controller.RobustDDPController.step | ( | self, | |
| Measurement | meas, | ||
| NavState | nav, | ||
| Command | cmd, | ||
| ExecutionBackend | backend = ExecutionBackend.PWM ) |
Execute one control step.
Parameters:
-----------
meas : Measurement
Current sensor measurements
nav : NavState
Current navigation state
cmd : Command
Control command (thrust desired or altitude goal)
backend : ExecutionBackend
Actuation backend (PWM or BINARY)
Returns:
--------
actuation_cmd : ActuationCommand
Actuation command for solenoids
diagnostics : dict
Additional diagnostics (DDP solution, reference, etc.)
Definition at line 116 of file controller.py.
References _build_state(), _get_previous_f_ref(), _get_warm_start_control_sequence(), _policy_lut, _update_state(), cfg, dynamics_params, engine_wrapper, logger, anonymous_namespace{idle_e2e.cpp}::Beat.state, anonymous_namespace{idle_e2e.cpp}::World.state, battery_t.state, daqtest::Burst.state, detail::serializer< BasicJsonType >.state, state, feedtwin.session.core.BottleSim.state, feedtwin.session.core.Session.state, feedtwin.session.core.TankSim.state, feedtwin.session.network_trace.NetworkTrace.state, fsw::config::FireConfig.state, gnss_core_t.state, gnss_frame_parser_t.state, SensorHotfire::CoreState.state, sequencer::DynamicState.state, Valve.state, world_t.state, tick, u_prev_applied, and x_prev.
Referenced by engine.pipeline.thermal.wall_conduction.WallModel.advance(), and engine.pipeline.thermal.wall_conduction.WallModel.soak().
|
protected |
Definition at line 98 of file controller.py.
Referenced by step().
| engine.control.robust_ddp.controller.RobustDDPController.cfg = cfg |
Definition at line 65 of file controller.py.
Referenced by _get_warm_start_control_sequence(), test_robust_ddp_controller_integration.TestControllerIntegration._simulate_dynamics(), engine.control.robust_ddp.identify.ParameterIdentifier._update_alpha_F(), engine.control.robust_ddp.identify.ParameterIdentifier._update_alpha_O(), engine.control.robust_ddp.identify.ParameterIdentifier._update_copv_coefficients(), payload.cold_gas_thruster.ColdGasThruster.compute(), payload.cold_gas_thruster.ColdGasThruster.generate_nozzle_contour(), reset(), step(), test_combustion_stability_audit.TestIntegration.test_acoustic_report_only_by_default(), test_robust_ddp_reference.TestReferenceGeneration.test_altitude_command(), test_robust_ddp_reference.TestReferenceGeneration.test_altitude_command_below_goal(), test_robust_ddp_actuation.TestActuation.test_binary_actuation_sigma_delta(), test_robust_ddp_actuation.TestActuation.test_binary_actuation_threshold(), test_robust_ddp_reference.TestReferenceGeneration.test_build_reference_altitude_mode(), test_robust_ddp_reference.TestReferenceGeneration.test_build_reference_slew_rate(), test_robust_ddp_reference.TestReferenceGeneration.test_build_reference_thrust_mode(), test_combustion_stability_audit.TestIntegration.test_chug_gate_is_the_gain_margin_band_minimum(), test_robust_ddp_safety_filter.TestSafetyFilter.test_compute_action_cost(), test_robust_ddp_actuation.TestActuation.test_compute_actuation_binary(), test_robust_ddp_actuation.TestActuation.test_compute_actuation_clamping(), test_robust_ddp_actuation.TestActuation.test_compute_actuation_dwell_enforcement(), test_robust_ddp_actuation.TestActuation.test_compute_actuation_dwell_satisfied(), test_robust_ddp_actuation.TestActuation.test_compute_actuation_pwm(), test_robust_ddp_controller_integration.TestControllerIntegration.test_controller_integration(), test_robust_ddp_reference.TestReferenceGeneration.test_estimate_thrust_bounds(), test_robust_ddp_safety_filter.TestSafetyFilter.test_filter_action_clamping(), test_robust_ddp_safety_filter.TestSafetyFilter.test_filter_action_safe(), test_robust_ddp_safety_filter.TestSafetyFilter.test_filter_action_unsafe_mr(), test_robust_ddp_safety_filter.TestSafetyFilter.test_filter_action_unsafe_ullage(), test_robust_ddp_safety_filter.TestSafetyFilter.test_find_best_safe_action(), test_robust_ddp_ddp_solver.TestDDPSolver.test_forward_rollout(), test_robust_ddp_safety_filter.TestSafetyFilter.test_generate_action_candidates(), test_robust_ddp_identify.TestParameterIdentification.test_get_params(), test_robust_ddp_identify.TestParameterIdentification.test_identify_alpha_F(), test_robust_ddp_identify.TestParameterIdentification.test_identify_alpha_O(), test_robust_ddp_identify.TestParameterIdentification.test_identify_copv_coefficients(), test_robust_ddp_identify.TestParameterIdentification.test_identify_tau_line_F(), test_robust_ddp_identify.TestParameterIdentification.test_identify_tau_line_O(), test_combustion_stability_audit.TestIntegration.test_missing_injector_drop_is_recorded_and_zero_is_zero(), test_combustion_stability_audit.TestIntegration.test_model_error_fails_closed(), test_robust_ddp_identify.TestParameterIdentification.test_parameter_bounds(), test_robust_ddp_reference.TestReferenceGeneration.test_project_thrust_bounds(), test_robust_ddp_reference.TestReferenceGeneration.test_project_thrust_slew_rate(), test_robust_ddp_ddp_solver.TestDDPSolver.test_running_cost(), test_robust_ddp_ddp_solver.TestDDPSolver.test_running_cost_with_errors(), test_robust_ddp_safety_filter.TestSafetyFilter.test_tube_violates_constraints_copv_min(), test_robust_ddp_safety_filter.TestSafetyFilter.test_tube_violates_constraints_mr(), test_robust_ddp_safety_filter.TestSafetyFilter.test_tube_violates_constraints_safe(), test_robust_ddp_safety_filter.TestSafetyFilter.test_tube_violates_constraints_ullage_max(), and test_robust_ddp_identify.TestParameterIdentification.test_update_config().
| engine.control.robust_ddp.controller.RobustDDPController.dynamics_params = DynamicsParams.from_config(cfg) |
Definition at line 81 of file controller.py.
Referenced by _build_state(), test_robust_ddp_controller_integration.TestControllerIntegration._simulate_dynamics(), and step().
| engine.control.robust_ddp.controller.RobustDDPController.engine_wrapper = None |
Definition at line 70 of file controller.py.
Referenced by step(), test_robust_ddp_ddp_solver.TestDDPSolver.test_backward_pass_structure(), test_robust_ddp_safety_filter.TestSafetyFilter.test_compute_action_cost(), test_robust_ddp_ddp_solver.TestDDPSolver.test_ddp_decreases_cost(), test_robust_ddp_ddp_solver.TestDDPSolver.test_ddp_on_toy_linear_system(), test_robust_ddp_ddp_solver.TestDDPSolver.test_ddp_respects_bounds(), test_robust_ddp_safety_filter.TestSafetyFilter.test_filter_action_clamping(), test_robust_ddp_safety_filter.TestSafetyFilter.test_filter_action_safe(), test_robust_ddp_safety_filter.TestSafetyFilter.test_filter_action_unsafe_mr(), test_robust_ddp_safety_filter.TestSafetyFilter.test_filter_action_unsafe_ullage(), test_robust_ddp_safety_filter.TestSafetyFilter.test_find_best_safe_action(), test_robust_ddp_ddp_solver.TestDDPSolver.test_forward_line_search(), test_robust_ddp_ddp_solver.TestDDPSolver.test_forward_rollout(), test_robust_ddp_safety_filter.TestSafetyFilter.test_tube_violates_constraints_mr(), and test_robust_ddp_safety_filter.TestSafetyFilter.test_tube_violates_constraints_safe().
| engine.control.robust_ddp.controller.RobustDDPController.logger = logger |
Definition at line 67 of file controller.py.
Referenced by step().
| engine.control.robust_ddp.controller.RobustDDPController.state = ControllerState() |
Definition at line 66 of file controller.py.
Referenced by reset(), step(), test_robust_ddp_actuation.TestActuation.test_compute_actuation_binary(), test_robust_ddp_actuation.TestActuation.test_compute_actuation_clamping(), test_robust_ddp_actuation.TestActuation.test_compute_actuation_pwm(), test_robust_ddp_safety_filter.TestSafetyFilter.test_filter_action_clamping(), test_robust_ddp_safety_filter.TestSafetyFilter.test_filter_action_safe(), test_robust_ddp_safety_filter.TestSafetyFilter.test_filter_action_unsafe_mr(), test_robust_ddp_safety_filter.TestSafetyFilter.test_filter_action_unsafe_ullage(), and test_robust_ddp_safety_filter.TestSafetyFilter.test_find_best_safe_action().
| int engine.control.robust_ddp.controller.RobustDDPController.tick = 0 |
Definition at line 95 of file controller.py.
| Optional[np.ndarray] engine.control.robust_ddp.controller.RobustDDPController.u_prev_applied = None |
Definition at line 85 of file controller.py.
Referenced by _update_state(), reset(), and step().
| Optional[np.ndarray] engine.control.robust_ddp.controller.RobustDDPController.u_seq_prev = None |
Definition at line 88 of file controller.py.
Referenced by _get_warm_start_control_sequence(), _update_state(), and reset().
| float engine.control.robust_ddp.controller.RobustDDPController.V_u_F = cfg.V_u_F_init if cfg.V_u_F_init is not None else 0.01 |
Definition at line 91 of file controller.py.
Referenced by _build_state(), _update_state(), and reset().
| float engine.control.robust_ddp.controller.RobustDDPController.V_u_O = cfg.V_u_O_init if cfg.V_u_O_init is not None else 0.01 |
Definition at line 92 of file controller.py.
Referenced by _build_state(), _update_state(), and reset().
| Optional[np.ndarray] engine.control.robust_ddp.controller.RobustDDPController.x_prev = None |
Definition at line 84 of file controller.py.
Referenced by _update_state(), reset(), step(), test_robust_ddp_robustness.TestRobustness.test_multiple_updates_convergence(), test_robust_ddp_robustness.TestRobustness.test_tube_propagate_basic(), test_robust_ddp_robustness.TestRobustness.test_tube_propagate_validation(), test_robust_ddp_robustness.TestRobustness.test_tube_propagate_widens(), test_robust_ddp_robustness.TestRobustness.test_tube_propagate_with_large_w_bar(), test_robust_ddp_robustness.TestRobustness.test_update_bounds_basic(), test_robust_ddp_robustness.TestRobustness.test_update_bounds_beta(), test_robust_ddp_robustness.TestRobustness.test_update_bounds_ema_behavior(), test_robust_ddp_robustness.TestRobustness.test_update_bounds_inflation(), test_robust_ddp_robustness.TestRobustness.test_update_bounds_requires_mass_flow(), test_robust_ddp_robustness.TestRobustness.test_update_bounds_residual_spike(), test_robust_ddp_robustness.TestRobustness.test_update_bounds_with_engine_wrapper(), and engine.control.robust_ddp.identify.ParameterIdentifier.update_params().