mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-22 09:28:58 +00:00
Created new AnalogBattery class
This commit is contained in:
committed by
Julian Oes
parent
bff1df7080
commit
d7bb5d46bb
@@ -346,7 +346,7 @@ void Simulator::handle_message_hil_sensor(const mavlink_message_t *msg)
|
||||
static uint64_t last_integration_us = 0;
|
||||
|
||||
// battery simulation (limit update to 100Hz)
|
||||
if (hrt_elapsed_time(&_battery_status.timestamp) >= 10_ms) {
|
||||
if (hrt_elapsed_time(&_last_battery_timestamp) >= 10_ms) {
|
||||
|
||||
const float discharge_interval_us = _param_sim_bat_drain.get() * 1000 * 1000;
|
||||
|
||||
@@ -370,7 +370,9 @@ void Simulator::handle_message_hil_sensor(const mavlink_message_t *msg)
|
||||
vbatt *= _battery.cell_count();
|
||||
|
||||
const float throttle = 0.0f; // simulate no throttle compensation to make the estimate predictable
|
||||
_battery.updateBatteryStatus(vbatt, ibatt, now_us, true, 0, throttle, armed);
|
||||
_battery.updateBatteryStatus(now_us, vbatt, ibatt, true, true, 0, throttle, armed, true);
|
||||
|
||||
_last_battery_timestamp = now_us;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user