46 #include <px4_platform_common/module_params.h> 85 bool connected,
bool selected_source,
int priority,
86 float throttle_normalized,
94 void estimateRemaining(
float voltage_v,
float current_a,
float throttle,
bool armed);
99 (ParamFloat<px4::params::BAT_V_EMPTY>) _param_bat_v_empty,
100 (ParamFloat<px4::params::BAT_V_CHARGED>) _param_bat_v_charged,
101 (ParamInt<px4::params::BAT_N_CELLS>) _param_bat_n_cells,
102 (ParamFloat<px4::params::BAT_CAPACITY>) _param_bat_capacity,
103 (ParamFloat<px4::params::BAT_V_LOAD_DROP>) _param_bat_v_load_drop,
104 (ParamFloat<px4::params::BAT_R_INTERNAL>) _param_bat_r_internal,
105 (ParamFloat<px4::params::BAT_LOW_THR>) _param_bat_low_thr,
106 (ParamFloat<px4::params::BAT_CRIT_THR>) _param_bat_crit_thr,
107 (ParamFloat<px4::params::BAT_EMERGEN_THR>) _param_bat_emergen_thr
110 bool _battery_initialized =
false;
static struct vehicle_status_s status
float _current_filtered_a
int cell_count()
Get the battery cell count.
void filterThrottle(float throttle)
DEFINE_PARAMETERS((ParamFloat< px4::params::BAT_V_EMPTY >) _param_bat_v_empty,(ParamFloat< px4::params::BAT_V_CHARGED >) _param_bat_v_charged,(ParamInt< px4::params::BAT_N_CELLS >) _param_bat_n_cells,(ParamFloat< px4::params::BAT_CAPACITY >) _param_bat_capacity,(ParamFloat< px4::params::BAT_V_LOAD_DROP >) _param_bat_v_load_drop,(ParamFloat< px4::params::BAT_R_INTERNAL >) _param_bat_r_internal,(ParamFloat< px4::params::BAT_LOW_THR >) _param_bat_low_thr,(ParamFloat< px4::params::BAT_CRIT_THR >) _param_bat_crit_thr,(ParamFloat< px4::params::BAT_EMERGEN_THR >) _param_bat_emergen_thr) bool _battery_initialized
void reset(battery_status_s *battery_status)
Reset all battery stats and report invalid/nothing.
hrt_abstime _last_timestamp
float _discharged_mah_loop
void sumDischarged(hrt_abstime timestamp, float current_a)
High-resolution timer with callouts and timekeeping.
float _remaining_voltage
normalized battery charge level remaining based on voltage
float full_cell_voltage()
Get the full voltage per cell.
void filterVoltage(float voltage_v)
void estimateRemaining(float voltage_v, float current_a, float throttle, bool armed)
float empty_cell_voltage()
Get the empty voltage per cell.
static struct actuator_armed_s armed
void determineWarning(bool connected)
__BEGIN_DECLS typedef uint64_t hrt_abstime
Absolute time, in microsecond units.
void updateBatteryStatus(hrt_abstime timestamp, float voltage_v, float current_a, bool connected, bool selected_source, int priority, float throttle_normalized, bool armed, battery_status_s *status)
Update current battery status message.
float _remaining
normalized battery charge level, selected based on config param
float _voltage_filtered_v
void filterCurrent(float current_a)