57 float configured_power_limit {35.0f};
58 float offline_power_limit {35.0f};
59 float max_cap_boost {0.0f};
61 float torque_per_current {0.3f * 20.0f / 16384.0f};
62 float speed_loss {0.22f * (3591.0f / 187.0f)};
63 float torque_loss {1.2f * (187.0f / 3591.0f) * (187.0f / 3591.0f)};
64 float constant_loss {2.78f};
65 float error_weight_low {1.0f};
66 float error_weight_high {2.0f};
67 float cap_base_energy {100.0f};
68 float cap_full_energy {250.0f};
69 float buffer_base_energy {50.0f};
70 float buffer_full_energy {60.0f};
71 float energy_kp {50.0f};
72 float energy_kd {0.0002f};
73 bool rls_enabled {
false};
74 float rls_forgetting_factor {0.9999f};
75 float rls_initial_covariance {0.00001f};
76 float rls_period {0.01f};
77 float max_speed_loss {20.0f};
78 float max_torque_loss {20.0f};
82 static bool valid_configuration(
const info_type& info);
84 bool configured()
const {
return configured_; }
85 bool enabled()
const {
return configured_ && info_.enabled; }
86 const power_allocation& status()
const {
return status_; }
89 power_allocation
allocate(
const std::array<power_wheel, 4>& wheels,
90 const power_feedback& feedback,
bool output_allowed,
93 void update(device::chassis_base& chassis,
const power_feedback& feedback,
94 bool output_allowed,
float dt_seconds);
96 awaitable<void>
update(device::chassis_base& chassis,
bool output_allowed,
float dt_seconds);
99 float energy_limit(
const power_feedback& feedback,
float dt_seconds);
100 void update_model(
const std::array<power_wheel, 4>& wheels,
101 const power_feedback& feedback,
float dt_seconds);
105 bool configured_ {
false};
106 power_allocation status_ {};
107 float speed_loss_ {};
108 float torque_loss_ {};
109 std::array<std::array<double, 2>, 2> covariance_ {};
110 float previous_base_error_ {};
111 float previous_full_error_ {};
112 unsigned energy_source_ {};
113 float rls_elapsed_ {};
114 std::uint64_t last_measurement_sequence_ {};
115 std::uint64_t rls_updates_ {};