|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
Runtime PT calibration via RobustCalibrationFramework (9-D basis, TLS / Bayesian / RLS / GLR / bias), seeded from factory cubic. More...
#include <RobustCalibrationManager.hpp>
Public Member Functions | |
| RobustCalibrationManager () | |
| void | initialize_sensor (uint16_t sensor_id, const PTCalibrationCoeffs &baseline) |
| void | update_calibration (uint16_t sensor_id, int32_t adc_code, double reference_pressure) |
| void | zero_sensor (uint16_t sensor_id, int32_t adc_code) |
| void | reseed_sensor (uint16_t sensor_id, const PTCalibrationCoeffs &baseline) |
| Reseed a sensor's framework cleanly from the given cubic baseline, discarding any learned adjustments and ignoring restored/population priors. | |
| double | predict_pressure_psi (uint16_t sensor_id, int32_t adc_code) |
| Mean PSI from the robust model (default environment). | |
| bool | has_sensor (uint16_t sensor_id) const |
| True if this sensor_id was initialized for robust tracking (factory-baselined). | |
| void | reset_adjustment (uint16_t sensor_id) |
| bool | save_adjustments (const std::string &path, const std::map< uint16_t, std::string > *uid_to_role=nullptr) const |
| Persist per-sensor θ. | |
| bool | load_adjustments (const std::string &path, const std::map< uint16_t, std::string > *uid_to_role=nullptr) |
| Restore per-sensor θ. | |
Private Attributes | |
| std::mutex | mutex_ |
| std::map< uint16_t, SensorState > | states_ |
| std::optional< Eigen::VectorXd > | population_theta_mean_ |
| std::optional< Eigen::MatrixXd > | population_theta_cov_ |
| std::map< uint16_t, Eigen::VectorXd > | restored_theta_mean_ |
| std::map< uint16_t, Eigen::MatrixXd > | restored_theta_cov_ |
Runtime PT calibration via RobustCalibrationFramework (9-D basis, TLS / Bayesian / RLS / GLR / bias), seeded from factory cubic.
Streaming pressure uses predict_pressure_psi(), not a live cubic polynomial.
Definition at line 29 of file RobustCalibrationManager.hpp.
|
default |
| bool fsw::calibration::RobustCalibrationManager::has_sensor | ( | uint16_t | sensor_id | ) | const |
True if this sensor_id was initialized for robust tracking (factory-baselined).
Definition at line 193 of file RobustCalibrationManager.cpp.
References lock, mutex_, and states_.
Referenced by invert_abort_psi_to_adc(), and main().
| void fsw::calibration::RobustCalibrationManager::initialize_sensor | ( | uint16_t | sensor_id, |
| const PTCalibrationCoeffs & | baseline ) |
Definition at line 118 of file RobustCalibrationManager.cpp.
References lock, mutex_, population_theta_cov_, population_theta_mean_, restored_theta_cov_, restored_theta_mean_, state, and states_.
| bool fsw::calibration::RobustCalibrationManager::load_adjustments | ( | const std::string & | path, |
| const std::map< uint16_t, std::string > * | uid_to_role = nullptr ) |
Restore per-sensor θ.
When uid_to_role is given, an entry tagged with a role is restored into the sensor_id that role currently maps to (so a moved sensor keeps its learned state), falling back to the persisted numeric id for untagged/legacy entries.
Definition at line 256 of file RobustCalibrationManager.cpp.
References lock, mutex_, fsw::calibration::RobustCalibrationFramework::N, population_theta_cov_, population_theta_mean_, restored_theta_cov_, restored_theta_mean_, state, and states_.
Referenced by main().
| double fsw::calibration::RobustCalibrationManager::predict_pressure_psi | ( | uint16_t | sensor_id, |
| int32_t | adc_code ) |
Mean PSI from the robust model (default environment).
Definition at line 185 of file RobustCalibrationManager.cpp.
References lock, mutex_, and states_.
Referenced by invert_abort_psi_to_adc(), and main().
| void fsw::calibration::RobustCalibrationManager::reseed_sensor | ( | uint16_t | sensor_id, |
| const PTCalibrationCoeffs & | baseline ) |
Reseed a sensor's framework cleanly from the given cubic baseline, discarding any learned adjustments and ignoring restored/population priors.
Used when a calibration profile is swapped live: the profile is the whole cal, so robust resets and relearns from it.
Definition at line 209 of file RobustCalibrationManager.cpp.
References lock, mutex_, state, and states_.
Referenced by main().
| void fsw::calibration::RobustCalibrationManager::reset_adjustment | ( | uint16_t | sensor_id | ) |
| bool fsw::calibration::RobustCalibrationManager::save_adjustments | ( | const std::string & | path, |
| const std::map< uint16_t, std::string > * | uid_to_role = nullptr ) const |
Persist per-sensor θ.
When uid_to_role is given, each entry also records its role so a later load can re-attach it to the role's current sensor_id (calibration follows the sensor).
Definition at line 218 of file RobustCalibrationManager.cpp.
References basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType, CustomBaseClass >::array(), lock, mutex_, fsw::calibration::RobustCalibrationFramework::N, r, state, and states_.
Referenced by main().
| void fsw::calibration::RobustCalibrationManager::update_calibration | ( | uint16_t | sensor_id, |
| int32_t | adc_code, | ||
| double | reference_pressure ) |
Definition at line 158 of file RobustCalibrationManager.cpp.
References fsw::calibration::CalibrationPoint::adc_code, lock, mutex_, fsw::calibration::CalibrationPoint::pressure, states_, fsw::calibration::CalibrationPoint::timestamp, and fsw::calibration::CalibrationPoint::uncertainty.
Referenced by main().
| void fsw::calibration::RobustCalibrationManager::zero_sensor | ( | uint16_t | sensor_id, |
| int32_t | adc_code ) |
Definition at line 172 of file RobustCalibrationManager.cpp.
References fsw::calibration::CalibrationPoint::adc_code, lock, mutex_, fsw::calibration::CalibrationPoint::pressure, states_, fsw::calibration::CalibrationPoint::timestamp, and fsw::calibration::CalibrationPoint::uncertainty.
|
mutableprivate |
Definition at line 64 of file RobustCalibrationManager.hpp.
Referenced by has_sensor(), initialize_sensor(), load_adjustments(), predict_pressure_psi(), reseed_sensor(), reset_adjustment(), save_adjustments(), update_calibration(), and zero_sensor().
|
private |
Definition at line 70 of file RobustCalibrationManager.hpp.
Referenced by initialize_sensor(), and load_adjustments().
|
private |
Definition at line 69 of file RobustCalibrationManager.hpp.
Referenced by initialize_sensor(), and load_adjustments().
|
private |
Definition at line 73 of file RobustCalibrationManager.hpp.
Referenced by initialize_sensor(), and load_adjustments().
|
private |
Definition at line 72 of file RobustCalibrationManager.hpp.
Referenced by initialize_sensor(), and load_adjustments().
|
private |
Definition at line 65 of file RobustCalibrationManager.hpp.
Referenced by has_sensor(), initialize_sensor(), load_adjustments(), predict_pressure_psi(), reseed_sensor(), reset_adjustment(), save_adjustments(), update_calibration(), and zero_sensor().