10 #define AP_BATT_MONITOR_MAX_INSTANCES 2 13 #define AP_BATT_PRIMARY_INSTANCE 0 15 #define AP_BATT_SERIAL_NUMBER_DEFAULT -1 17 #define AP_BATT_MONITOR_TIMEOUT 5000 19 #define AP_BATT_MONITOR_RES_EST_TC_1 0.5f 20 #define AP_BATT_MONITOR_RES_EST_TC_2 0.1f 48 FUNCTOR_TYPEDEF(battery_failsafe_handler_fn_t,
void,
const char *,
const int8_t);
50 AP_BattMonitor(uint32_t log_battery_bit, battery_failsafe_handler_fn_t battery_failsafe_handler_fn,
const int8_t *failsafe_priorities);
61 uint16_t
cells[MAVLINK_MSG_BATTERY_STATUS_FIELD_VOLTAGES_LEN];
92 bool healthy(uint8_t instance)
const;
104 float voltage(uint8_t instance)
const;
const int8_t * _failsafe_priorities
static const struct AP_Param::GroupInfo var_info[]
int8_t _highest_failsafe_priority
bool _has_triggered_failsafe
BatteryFailsafe check_failsafe(const uint8_t instance)
returns the failsafe state of the battery
float get_resistance(uint8_t instance) const
#define AP_BATT_PRIMARY_INSTANCE
uint32_t critical_voltage_start_ms
static AP_BattMonitor & battery()
AP_BattMonitor(uint32_t log_battery_bit, battery_failsafe_handler_fn_t battery_failsafe_handler_fn, const int8_t *failsafe_priorities)
float voltage_resting_estimate() const
int8_t get_highest_failsafe_priority(void) const
returns the highest failsafe action that has been triggered
FUNCTOR_TYPEDEF(battery_failsafe_handler_fn_t, void, const char *, const int8_t)
bool overpower_detected() const
true when (voltage * current) > watt_max
uint32_t _log_battery_bit
BattMonitor_Type type(void) const
A system for managing and storing variables that are of general interest to the system.
AP_BattMonitor_Params _params[AP_BATT_MONITOR_MAX_INSTANCES]
parameters
AP_BattMonitor_Backend * drivers[AP_BATT_MONITOR_MAX_INSTANCES]
uint32_t last_time_micros
battery_failsafe_handler_fn_t _battery_failsafe_handler_fn
BattMonitor_State state[AP_BATT_MONITOR_MAX_INSTANCES]
void set_monitoring(uint8_t instance, uint8_t mon)
set_monitoring - sets the monitor type (used for example sketch only)
float current_amps() const
uint32_t low_voltage_start_ms
uint8_t capacity_remaining_pct() const
Common definitions and utility routines for the ArduPilot libraries.
AP_BattMonitor & operator=(const AP_BattMonitor &)=delete
void read()
Read the battery voltage and current for all batteries. Should be called at 10hz. ...
static AP_BattMonitor * _singleton
int32_t pack_capacity_mah() const
bool get_temperature(float &temperature) const
void check_failsafes(void)
enum AP_BattMonitor_Params::BattMonitor_Type get_type()
get_type - returns battery monitor type
bool has_consumed_energy() const
float consumed_wh() const
void convert_params(void)
number of monitors
uint8_t num_instances(void) const
#define AP_BATT_MONITOR_MAX_INSTANCES
float get_resistance() const
float voltage_resting_estimate
float consumed_mah() const
bool has_failsafed(void) const
returns true if a battery failsafe has ever been triggered
uint32_t temperature_time
const cells & get_cell_voltages() const