|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
Public Member Functions | |
| __init__ (self, Optional[str] log_file=None, str format="json") | |
| None | log_tick (self, int tick, float timestamp, Measurement meas, Optional[EngineEstimate] eng_est, Dict[str, float] constraints, np.ndarray u_proposed, np.ndarray u_filtered, ActuationCommand actuation_cmd, np.ndarray w_bar, Optional[float] F_ref=None, Optional[float] MR_ref=None) |
| None | save (self, Optional[str] filepath=None) |
| List[Dict[str, Any]] | load (cls, str filepath) |
Public Attributes | |
| log_file = log_file | |
| str | format = format |
| list | logs = [] |
| log_path = Path(log_file) | |
Protected Member Functions | |
| None | _write_json (self, Dict[str, Any] entry) |
| None | _write_csv (self, Dict[str, Any] entry) |
| Dict[str, Any] | _flatten_entry (self, Dict[str, Any] entry) |
Structured logger for controller runs.
Definition at line 18 of file logging.py.
| engine.control.robust_ddp.logging.ControllerLogger.__init__ | ( | self, | |
| Optional[str] | log_file = None, | ||
| str | format = "json" ) |
Initialize logger.
Parameters:
-----------
log_file : str, optional
Path to log file. If None, logs to stdout.
format : str
Log format: "json" or "csv"
Definition at line 21 of file logging.py.
|
protected |
|
protected |
Write CSV log entry.
Definition at line 137 of file logging.py.
References log_path.
Referenced by log_tick().
|
protected |
Write JSON log entry.
Definition at line 131 of file logging.py.
References log_path.
Referenced by log_tick().
| List[Dict[str, Any]] engine.control.robust_ddp.logging.ControllerLogger.load | ( | cls, | |
| str | filepath ) |
Load logs from file.
Parameters:
-----------
filepath : str
Path to log file
Returns:
--------
logs : List[Dict[str, Any]]
List of log entries
Definition at line 255 of file logging.py.
Referenced by engine.layerx.measurements.MeasurementStore.get().
| None engine.control.robust_ddp.logging.ControllerLogger.log_tick | ( | self, | |
| int | tick, | ||
| float | timestamp, | ||
| Measurement | meas, | ||
| Optional[EngineEstimate] | eng_est, | ||
| Dict[str, float] | constraints, | ||
| np.ndarray | u_proposed, | ||
| np.ndarray | u_filtered, | ||
| ActuationCommand | actuation_cmd, | ||
| np.ndarray | w_bar, | ||
| Optional[float] | F_ref = None, | ||
| Optional[float] | MR_ref = None ) |
Log one control tick.
Parameters:
-----------
tick : int
Tick number
timestamp : float
Timestamp [s]
meas : Measurement
Sensor measurements
eng_est : EngineEstimate, optional
Engine performance estimate
constraints : Dict[str, float]
Constraint margins
u_proposed : np.ndarray
Proposed relaxed control
u_filtered : np.ndarray
Filtered (safe) relaxed control
actuation_cmd : ActuationCommand
Actuation command
w_bar : np.ndarray
Residual bounds
F_ref : float, optional
Reference thrust [N]
MR_ref : float, optional
Reference mixture ratio
Definition at line 42 of file logging.py.
References _write_csv(), _write_json(), format, USBD_CDC_LineCodingTypeDef.format, log_path, logs, and fsw::config::Config.logs.
| None engine.control.robust_ddp.logging.ControllerLogger.save | ( | self, | |
| Optional[str] | filepath = None ) |
Save all logs to file.
Parameters:
-----------
filepath : str, optional
Path to save file. If None, uses self.log_file.
Definition at line 183 of file logging.py.
References _flatten_entry(), format, USBD_CDC_LineCodingTypeDef.format, log_path, logs, and fsw::config::Config.logs.
| str engine.control.robust_ddp.logging.ControllerLogger.format = format |
Definition at line 33 of file logging.py.
Referenced by log_tick(), and save().
| engine.control.robust_ddp.logging.ControllerLogger.log_file = log_file |
Definition at line 32 of file logging.py.
| engine.control.robust_ddp.logging.ControllerLogger.log_path = Path(log_file) |
Definition at line 37 of file logging.py.
Referenced by _write_csv(), _write_json(), log_tick(), and save().
| engine.control.robust_ddp.logging.ControllerLogger.logs = [] |
Definition at line 34 of file logging.py.
Referenced by log_tick(), and save().