Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
kobuki::Battery Class Reference

Battery level module. More...

#include <battery.hpp>

Public Types

enum  Level { Dangerous, Low, Healthy, Maximum }
 
enum  Source { None, Adapter, Dock }
 
enum  State { Discharging, Charged, Charging }
 

Public Member Functions

 Battery (const uint8_t &new_voltage, const uint8_t &charger_flag)
 
Level level () const
 
float percent () const
 

Public Attributes

Source charging_source
 
State charging_state
 
double voltage
 

Static Public Attributes

static double capacity = 16.5
 
static double dangerous = 13.2
 
static double low = 14.0
 

Detailed Description

Battery level module.

Currently hard codes the battery status. It might be useful to provide some configurable parameters for this module in the future.

Definition at line 46 of file battery.hpp.

Member Enumeration Documentation

◆ Level

Enumerator
Dangerous 
Low 
Healthy 
Maximum 

Definition at line 61 of file battery.hpp.

◆ Source

Enumerator
None 
Adapter 
Dock 

Definition at line 56 of file battery.hpp.

◆ State

Enumerator
Discharging 
Charged 
Charging 

Definition at line 67 of file battery.hpp.

Constructor & Destructor Documentation

◆ Battery()

kobuki::Battery::Battery ( const uint8_t &  new_voltage,
const uint8_t &  charger_flag 
)

Configures the battery status given the current sensor readings.

Parameters
new_voltage: measured voltage*10
charger_flag: bit flag representing charging status and source

Definition at line 43 of file battery.cpp.

Member Function Documentation

◆ level()

Battery::Level kobuki::Battery::level ( ) const

Definition at line 65 of file battery.cpp.

◆ percent()

float kobuki::Battery::percent ( ) const

Definition at line 72 of file battery.cpp.

Member Data Documentation

◆ capacity

double kobuki::Battery::capacity = 16.5
static

Definition at line 78 of file battery.hpp.

◆ charging_source

Source kobuki::Battery::charging_source

Definition at line 83 of file battery.hpp.

◆ charging_state

State kobuki::Battery::charging_state

Definition at line 82 of file battery.hpp.

◆ dangerous

double kobuki::Battery::dangerous = 13.2
static

Definition at line 80 of file battery.hpp.

◆ low

double kobuki::Battery::low = 14.0
static

Definition at line 79 of file battery.hpp.

◆ voltage

double kobuki::Battery::voltage

Definition at line 81 of file battery.hpp.


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


kobuki_driver
Author(s): Daniel Stonier , Younghun Ju , Jorge Santos Simon
autogenerated on Wed Mar 2 2022 00:26:14