GT RoboCup SSL
Soccer software, robot firmware
BatteryProfile Class Reference

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ BatteryProfile()

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.

Member Function Documentation

◆ getChargeLevel()

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.

Parameters
voltageThe voltage of the battery
Returns
A value between 0 and 1 indicating charge level

The documentation for this class was generated from the following files: