Class Battery

Inheritance Relationships

Derived Types

Class Documentation

class Battery

Subclassed by husarion_ugv_battery::ADCBattery, husarion_ugv_battery::RoboteqBattery

Public Functions

inline Battery()
inline ~Battery()
virtual bool Present() = 0
virtual void Update(const rclcpp::Time &header_stamp, const bool charger_connected) = 0
virtual void Reset(const rclcpp::Time &header_stamp) = 0
virtual float GetLoadCurrent() = 0
inline bool HasErrorMsg() const
inline std::string GetErrorMsg() const
inline BatteryStateMsg GetBatteryMsg() const
inline BatteryStateMsg GetBatteryMsgRaw() const
inline ChargingStatusMsg GetChargingStatus() const

Protected Functions

inline void SetErrorMsg(const std::string &error_msg)
inline float GetBatteryPercent(const float voltage) const
inline void ResetBatteryMsgs(const rclcpp::Time &header_stamp)
inline void ResetBatteryState(const rclcpp::Time &header_stamp)
inline void ResetChargingStatus(const rclcpp::Time &header_stamp)

Protected Attributes

std::string error_msg_
BatteryStateMsg battery_state_
BatteryStateMsg battery_state_raw_
ChargingStatusMsg charging_status_

Protected Static Attributes

static constexpr int kNumberOfCells = 10
static constexpr int kBatPresentMeanLen = 10
static constexpr float kChargingCurrentTresh = 0.1
static constexpr float kBatDetectTresh = 3.03
static constexpr float kVBatFatalMin = 27.0
static constexpr float kVBatFatalMax = 43.0
static constexpr float kLowBatTemp = -10.0
static constexpr float kOverheatBatTemp = 45.0
static constexpr float kDesignedCapacity = 20.0
static constexpr std::string_view kLocation = "user_compartment"
static constexpr float battery_approx_ranges[5] = {41.25, 37.0, 36.0, 35.0, 33.7}
static constexpr float battery_approx_a_values[6] = {8.665, 9.153, 19.8, 22.84, 10.538, 0.989}
static constexpr float battery_approx_b_values[6] = {-258.73, -278.861, -672.6, -782.04, -351.47, -29.669}