RBControl
Library for the RB3201-RBControl board with the ESP32 by RoboticsBrno.
Public Member Functions | Static Public Attributes | Friends | List of all members
rb::Battery Class Reference

Contains the battery state and can control the robot's power. More...

#include <RBControl_battery.hpp>

Public Member Functions

void setFineTuneCoef (float coef)
 Tunes battery measurement to compensate e.g. for voltage divider error. Default 1, expected to be 0.5 to 1.5. More...
 
float fineTuneCoef () const
 
uint32_t raw () const
 returns the raw value More...
 
uint32_t pct () const
 returns current battery percentage More...
 
uint32_t voltageMv () const
 returns current battery voltage More...
 
void shutdown ()
 shuts the robot down More...
 

Static Public Attributes

static constexpr uint32_t VOLTAGE_MIN = 3300 * 2
 Minimal battery voltage, in mV, at which the robot shuts down. More...
 
static constexpr uint32_t VOLTAGE_MAX = 4200 * 2
 Maximal battery voltage, in mV. More...
 
static constexpr uint32_t VOLTAGE_WARNING = 3500 * 2
 The voltage at which alert triggers. More...
 
static constexpr float BATT_DIVIDER = 10.0f / (82.0f + 10.0f)
 Voltage divider ratio. More...
 

Friends

class Manager
 

Detailed Description

Contains the battery state and can control the robot's power.

Member Function Documentation

◆ fineTuneCoef()

float rb::Battery::fineTuneCoef ( ) const

◆ pct()

uint32_t rb::Battery::pct ( ) const

returns current battery percentage

◆ raw()

uint32_t rb::Battery::raw ( ) const

returns the raw value

◆ setFineTuneCoef()

void rb::Battery::setFineTuneCoef ( float  coef)

Tunes battery measurement to compensate e.g. for voltage divider error. Default 1, expected to be 0.5 to 1.5.

◆ shutdown()

void rb::Battery::shutdown ( )

shuts the robot down

◆ voltageMv()

uint32_t rb::Battery::voltageMv ( ) const

returns current battery voltage

Friends And Related Function Documentation

◆ Manager

friend class Manager
friend

Member Data Documentation

◆ BATT_DIVIDER

constexpr float rb::Battery::BATT_DIVIDER = 10.0f / (82.0f + 10.0f)
staticconstexpr

Voltage divider ratio.

◆ VOLTAGE_MAX

constexpr uint32_t rb::Battery::VOLTAGE_MAX = 4200 * 2
staticconstexpr

Maximal battery voltage, in mV.

◆ VOLTAGE_MIN

constexpr uint32_t rb::Battery::VOLTAGE_MIN = 3300 * 2
staticconstexpr

Minimal battery voltage, in mV, at which the robot shuts down.

◆ VOLTAGE_WARNING

constexpr uint32_t rb::Battery::VOLTAGE_WARNING = 3500 * 2
staticconstexpr

The voltage at which alert triggers.


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