|
libPlayingWithFusion 2026.2.09
Playing With Fusion driver library for FRC roboRIO
|
High-level C++ wrapper class for accessing battery fuel gauge data. More...
#include <BattFuelGauge.h>
Public Types | |
| enum | ChargeState { kInit = 0 , kDischarge = 1 , kConstICharge = 2 , kConstVCharge = 3 , kTrickleCharge = 4 , kIdle = 5 , kMeasureOCV = 6 } |
| enum | BattMfg { kDuracell = 0 , kEnergizer = 1 , kInterstate = 2 , kMightyMax = 3 , kMKPowered = 4 , kPowerSonic = 5 , kNumMfgs = 6 } |
Public Member Functions | |
| BattFuelGauge (uint8_t sensorID) | |
| virtual | ~BattFuelGauge () |
| BattFuelGauge (const BattFuelGauge &)=delete | |
| BattFuelGauge & | operator= (const BattFuelGauge &)=delete |
| BattFuelGauge (BattFuelGauge &&)=default | |
| BattFuelGauge & | operator= (BattFuelGauge &&)=default |
| void | IdentifySensor () |
| uint32_t | GetFirmwareVersion () const |
| uint32_t | GetSerialNumber () const |
| ChargeState | GetBatteryState () const |
| Get the battery charge/discharge state. | |
| float | GetCurrent () const |
| Get the battery discharge current. | |
| float | GetVoltage () const |
| Get the current battery voltage. | |
| float | GetDodAh () const |
| Get the current depth of discharge in ampere-hours. | |
| float | GetDodWh () const |
| Get the current depth of discharge energy. | |
| float | GetRemainingChargePct () const |
| Get the remaining charge as a percentage. | |
| float | GetEffectiveCapacityAh () const |
| Get the effective (usable) capacity of the battery. | |
| float | GetBatteryAgeDays () const |
| Get the age of the battery. | |
| float | GetCapacityAh () const |
| Get the current (estimated) battery capacity. | |
| float | GetRatedCapacityAh () const |
| Get the original rated capacity when the battery was new. | |
| int | GetNumCycles () const |
| Get the total number of charge/discharge cycles. | |
| std::string | GetNickname () const |
| Get the user-defined nickname of the battery. | |
| BattMfg | GetManufacturer () const |
| Get the battery manufacturer identifier. | |
| void | SetNickname (std::string newNickname) const |
| Set the user-defined nickname of the battery. | |
| void | SetManufacturer (BattMfg newMfg) const |
| Set the battery manufacturer. | |
| float | GetCycleRmsDischargeCurrent () const |
| RMS discharge current during the last complete charge cycle. | |
| float | GetCycleMaxCurrent () const |
| Maximum charging current observed during the last charge cycle. | |
| float | GetCycleMinCurrent () const |
| Maximum discharge current observed during the last charge cycle. | |
| float | GetCycleMinVoltage () const |
| Minimum voltage observed during the last charge cycle. | |
| float | GetCycleMaxVoltage () const |
| Maximum voltage observed during the last charge cycle. | |
| float | GetCycleMinDodAh () const |
| Minimum depth of discharge reached during the last charge cycle. | |
| float | GetCycleMaxDodAh () const |
| Maximum depth of discharge reached during the last charge cycle. | |
| float | GetCycleMinDodWh () const |
| Minimum energy discharged during the last charge cycle. | |
| float | GetCycleMaxDodWh () const |
| Maximum energy discharged during the last charge cycle. | |
| float | GetCycleChargeTime () const |
| Total time spent charging during the last charge cycle. | |
| float | GetCycleDischargeTime () const |
| Total time spent discharging during the last charge cycle. | |
| float | GetCycleStartingVoltage () const |
| Starting voltage at the beginning of the last charge cycle. | |
| float | GetMatchRmsDischargeCurrent () const |
| RMS discharge current during the last robot match. | |
| float | GetMatchMaxCurrent () const |
| Maximum current (any direction) during the last robot match. | |
| float | GetMatchMinCurrent () const |
| Minimum current (most negative discharge) during the last match. | |
| float | GetMatchMinVoltage () const |
| Minimum voltage observed during the last robot match. | |
| float | GetMatchMaxVoltage () const |
| Maximum voltage observed during the last robot match. | |
| float | GetMatchMinDodAh () const |
| Minimum depth of discharge reached during the last robot match. | |
| float | GetMatchMaxDodAh () const |
| Maximum depth of discharge reached during the last robot match. | |
| float | GetMatchChargeTime () const |
| Total charging time during the last robot match (if any). | |
| float | GetMatchDischargeTime () const |
| Total discharging time during the last robot match. | |
| float | GetMatchStartingVoltage () const |
| Battery voltage at the start of the last robot match. | |
| float | GetMatchStartingEnergy () const |
| Energy stored at the beginning of the last robot match. | |
| float | GetMatchEndingEnergy () const |
| Energy remaining at the end of the last robot match. | |
| float | GetMatchStartingCharge () const |
| Charge stored at the beginning of the last robot match. | |
| float | GetMatchEndingCharge () const |
| Charge remaining at the end of the last robot match. | |
| float | GetMatchDuration () const |
| Duration of the last robot match. | |
High-level C++ wrapper class for accessing battery fuel gauge data.
This class provides a clean, object-oriented interface to the battery fuel gauge functionality. It forwards calls to the underlying C-style API functions defined in BattFuelGaugeApi.h.
All getter methods are const-qualified and return current values from the underlying implementation. The internal handle is assumed to remain valid for the lifetime of this object.
Battery charge state enumeration
|
explicit |
|
virtual |
|
delete |
|
default |
| float BattFuelGauge::GetBatteryAgeDays | ( | ) | const |
Get the age of the battery.
| BattFuelGauge::ChargeState BattFuelGauge::GetBatteryState | ( | ) | const |
Get the battery charge/discharge state.
| float BattFuelGauge::GetCapacityAh | ( | ) | const |
Get the current (estimated) battery capacity.
| float BattFuelGauge::GetCurrent | ( | ) | const |
Get the battery discharge current.
| float BattFuelGauge::GetCycleChargeTime | ( | ) | const |
Total time spent charging during the last charge cycle.
| float BattFuelGauge::GetCycleDischargeTime | ( | ) | const |
Total time spent discharging during the last charge cycle.
| float BattFuelGauge::GetCycleMaxCurrent | ( | ) | const |
Maximum charging current observed during the last charge cycle.
| float BattFuelGauge::GetCycleMaxDodAh | ( | ) | const |
Maximum depth of discharge reached during the last charge cycle.
| float BattFuelGauge::GetCycleMaxDodWh | ( | ) | const |
Maximum energy discharged during the last charge cycle.
| float BattFuelGauge::GetCycleMaxVoltage | ( | ) | const |
Maximum voltage observed during the last charge cycle.
| float BattFuelGauge::GetCycleMinCurrent | ( | ) | const |
Maximum discharge current observed during the last charge cycle.
| float BattFuelGauge::GetCycleMinDodAh | ( | ) | const |
Minimum depth of discharge reached during the last charge cycle.
| float BattFuelGauge::GetCycleMinDodWh | ( | ) | const |
Minimum energy discharged during the last charge cycle.
| float BattFuelGauge::GetCycleMinVoltage | ( | ) | const |
Minimum voltage observed during the last charge cycle.
| float BattFuelGauge::GetCycleRmsDischargeCurrent | ( | ) | const |
RMS discharge current during the last complete charge cycle.
| float BattFuelGauge::GetCycleStartingVoltage | ( | ) | const |
Starting voltage at the beginning of the last charge cycle.
| float BattFuelGauge::GetDodAh | ( | ) | const |
Get the current depth of discharge in ampere-hours.
| float BattFuelGauge::GetDodWh | ( | ) | const |
Get the current depth of discharge energy.
| float BattFuelGauge::GetEffectiveCapacityAh | ( | ) | const |
Get the effective (usable) capacity of the battery.
| uint32_t BattFuelGauge::GetFirmwareVersion | ( | ) | const |
Determine the sensor firmware version
| BattFuelGauge::BattMfg BattFuelGauge::GetManufacturer | ( | ) | const |
Get the battery manufacturer identifier.
| float BattFuelGauge::GetMatchChargeTime | ( | ) | const |
Total charging time during the last robot match (if any).
| float BattFuelGauge::GetMatchDischargeTime | ( | ) | const |
Total discharging time during the last robot match.
| float BattFuelGauge::GetMatchDuration | ( | ) | const |
Duration of the last robot match.
| float BattFuelGauge::GetMatchEndingCharge | ( | ) | const |
Charge remaining at the end of the last robot match.
| float BattFuelGauge::GetMatchEndingEnergy | ( | ) | const |
Energy remaining at the end of the last robot match.
| float BattFuelGauge::GetMatchMaxCurrent | ( | ) | const |
Maximum current (any direction) during the last robot match.
| float BattFuelGauge::GetMatchMaxDodAh | ( | ) | const |
Maximum depth of discharge reached during the last robot match.
| float BattFuelGauge::GetMatchMaxVoltage | ( | ) | const |
Maximum voltage observed during the last robot match.
| float BattFuelGauge::GetMatchMinCurrent | ( | ) | const |
Minimum current (most negative discharge) during the last match.
| float BattFuelGauge::GetMatchMinDodAh | ( | ) | const |
Minimum depth of discharge reached during the last robot match.
| float BattFuelGauge::GetMatchMinVoltage | ( | ) | const |
Minimum voltage observed during the last robot match.
| float BattFuelGauge::GetMatchRmsDischargeCurrent | ( | ) | const |
RMS discharge current during the last robot match.
| float BattFuelGauge::GetMatchStartingCharge | ( | ) | const |
Charge stored at the beginning of the last robot match.
| float BattFuelGauge::GetMatchStartingEnergy | ( | ) | const |
Energy stored at the beginning of the last robot match.
| float BattFuelGauge::GetMatchStartingVoltage | ( | ) | const |
Battery voltage at the start of the last robot match.
| std::string BattFuelGauge::GetNickname | ( | ) | const |
Get the user-defined nickname of the battery.
| int BattFuelGauge::GetNumCycles | ( | ) | const |
Get the total number of charge/discharge cycles.
| float BattFuelGauge::GetRatedCapacityAh | ( | ) | const |
Get the original rated capacity when the battery was new.
| float BattFuelGauge::GetRemainingChargePct | ( | ) | const |
Get the remaining charge as a percentage.
| uint32_t BattFuelGauge::GetSerialNumber | ( | ) | const |
Determine the sensor hardware serial number
| float BattFuelGauge::GetVoltage | ( | ) | const |
Get the current battery voltage.
| void BattFuelGauge::IdentifySensor | ( | ) |
Dispay 'Identification' page on the BFG OLED display to indicate the sensor asscioated with this instance of software
|
default |
|
delete |
| void BattFuelGauge::SetManufacturer | ( | BattFuelGauge::BattMfg | newMfg | ) | const |
Set the battery manufacturer.
| newMfg | Enum value representing the battery manufacturer |
| void BattFuelGauge::SetNickname | ( | std::string | newNickname | ) | const |
Set the user-defined nickname of the battery.
| newNickname | New battery nickname |