![]() |
GT RoboCup SSL
Soccer software, robot firmware
|
Calculates a battery's charge level given its voltage using a model of its discharge curve. More...
Public Types | |
typedef std::pair< double, double > | Entry |
Each Entry in the profile is a <voltage, charge level> pair. | |
Public Member Functions | |
BatteryProfile (std::vector< BatteryProfile::Entry > dataPoints) | |
Construct a battery profile with the given <voltage, charge level> pairs. More... | |
double | getChargeLevel (double voltage) const |
Get the charge level given the voltage. More... | |
Calculates a battery's charge level given its voltage using a model of its discharge curve.
Note that this is not an optimal way of measuring remaining battery capacity. It would be better to base it off of how much current has been drained from the battery so far, but we don't currently measure that, so we approximate charge level from voltage.
BatteryProfile::BatteryProfile | ( | std::vector< BatteryProfile::Entry > | dataPoints | ) |
Construct a battery profile with the given <voltage, charge level> pairs.
These MUST be sorted in order of increasing voltage.
double BatteryProfile::getChargeLevel | ( | double | voltage | ) | const |
Get the charge level given the voltage.
The voltage curve is represented by a piecewise linear graph based on the data points given in the constructor.
voltage | The voltage of the battery |