STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
engine.control.robust_ddp.controller.RobustDDPController Class Reference
Collaboration diagram for engine.control.robust_ddp.controller.RobustDDPController:
[legend]

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

Detailed Description

Robust DDP controller for thrust regulation.

Definition at line 44 of file controller.py.

Constructor & Destructor Documentation

◆ __init__()

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.

Member Function Documentation

◆ _build_state()

np.ndarray engine.control.robust_ddp.controller.RobustDDPController._build_state ( self,
Measurement meas )
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().

◆ _get_previous_f_ref()

Optional[float] engine.control.robust_ddp.controller.RobustDDPController._get_previous_f_ref ( self)
protected
Get previous reference thrust for slew rate limiting.

Definition at line 416 of file controller.py.

Referenced by step().

◆ _get_warm_start_control_sequence()

np.ndarray engine.control.robust_ddp.controller.RobustDDPController._get_warm_start_control_sequence ( self)
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().

◆ _update_state()

None engine.control.robust_ddp.controller.RobustDDPController._update_state ( self,
np.ndarray x,
np.ndarray u_applied,
solution,
ref )
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().

◆ reset()

◆ step()

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().

Member Data Documentation

◆ _policy_lut

Optional[PolicyLUT] engine.control.robust_ddp.controller.RobustDDPController._policy_lut = None
protected

Definition at line 98 of file controller.py.

Referenced by step().

◆ cfg

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().

◆ dynamics_params

engine.control.robust_ddp.controller.RobustDDPController.dynamics_params = DynamicsParams.from_config(cfg)

◆ engine_wrapper

◆ logger

engine.control.robust_ddp.controller.RobustDDPController.logger = logger

Definition at line 67 of file controller.py.

Referenced by step().

◆ state

◆ tick

int engine.control.robust_ddp.controller.RobustDDPController.tick = 0

Definition at line 95 of file controller.py.

Referenced by reset(), and step().

◆ u_prev_applied

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().

◆ u_seq_prev

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().

◆ V_u_F

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().

◆ V_u_O

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().

◆ x_prev


The documentation for this class was generated from the following file: