RBControl
Library for the RB3201-RBControl board with the ESP32 by RoboticsBrno.
Namespaces | Classes | Enumerations | Functions | Variables
rb Namespace Reference

The base namespace. Contains some logging functions, too. More...

Namespaces

 half_duplex
 

Classes

class  Angle
 
class  Arm
 
class  Bone
 
class  BoneBuilder
 
class  ArmBuilder
 
class  Battery
 Contains the battery state and can control the robot's power. More...
 
class  Encoder
 
class  Leds
 Helper class for controlling the LEDs connected to the expander. More...
 
class  Manager
 The main library class for working with the RBControl board. Call the install() method at the start of your program. More...
 
class  MotorChangeBuilder
 Helper class for building the motor change event. More...
 
class  Motor
 
class  Nvs
 
class  Piezo
 Helper class for controlling the piezo. More...
 
class  SerialPWM
 
class  SmartServoBus
 
class  Timers
 

Enumerations

enum  ManagerInstallFlags { MAN_NONE = 0 , MAN_DISABLE_MOTOR_FAILSAFE = (1 << 0) , MAN_DISABLE_BATTERY_MANAGEMENT = (1 << 1) , MAN_DISABLE_PIEZO = (1 << 2) }
 This enum contains flags for the Manager's install() method. More...
 
enum class  MotorId : uint8_t {
  M1 , M2 , M3 , M4 ,
  M5 , M6 , M7 , M8 ,
  MAX
}
 

Functions

Angle operator+ (Angle a, Angle b)
 
Angle operator- (Angle a, Angle b)
 
Angle operator* (Angle a, Angle::_T c)
 
Angle operator/ (Angle a, Angle::_T c)
 
Angle operator""_deg (long double d)
 
Angle operator""_rad (long double r)
 
Angle operator""_deg (unsigned long long int d)
 
Angle operator""_rad (unsigned long long int r)
 
 __attribute__ ((constructor)) void loggerInit()
 
template<typename... Args>
FormatString log (int verbosity, const std::string &tag, const std::string &message, Args... args)
 
template<typename... Args>
FormatString logPanic (const std::string &tag, const std::string &message, Args... args)
 
template<typename... Args>
FormatString logError (const std::string &tag, const std::string &message, Args... args)
 
template<typename... Args>
FormatString logWarning (const std::string &tag, const std::string &message, Args... args)
 
template<typename... Args>
FormatString logInfo (const std::string &tag, const std::string &message, Args... args)
 
template<typename... Args>
FormatString logDebug (const std::string &tag, const std::string &message, Args... args)
 
ManagerInstallFlags operator| (ManagerInstallFlags a, ManagerInstallFlags b)
 
static int INV (int v)
 
MotorId operator++ (MotorId &x)
 
static void dieTimers (TimerHandle_t timer)
 
template<typename T , typename... Args>
clamp (T value, T min, T max, const char *tag="", const char *msg=NULL, Args... args)
 
void delayMs (int ms)
 
void delay (std::chrono::duration< uint32_t, std::milli > delay)
 

Variables

const int DEFAULT_REF_VOLTAGE = 1100
 
const int BATTERY_ADC_SAMPLES = 32
 
static const pcnt_unit_t PCNT_UNITS [ENC_COUNT]
 
const gpio_num_t ENCODER_PINS [ENC_COUNT *2]
 
Logger logger
 
static const gpio_num_t IO0 = GPIO_NUM_0
 
static const gpio_num_t IO2 = GPIO_NUM_2
 
static const gpio_num_t IO12 = GPIO_NUM_12
 
static const gpio_num_t IO4 = GPIO_NUM_4
 
static const gpio_num_t IO5 = GPIO_NUM_5
 
static const gpio_num_t IO13 = GPIO_NUM_13
 
static const gpio_num_t IO14 = GPIO_NUM_14
 
static const gpio_num_t IO15 = GPIO_NUM_15
 
static const gpio_num_t IO16 = GPIO_NUM_16
 
static const gpio_num_t IO17 = GPIO_NUM_17
 
static const gpio_num_t IO18 = GPIO_NUM_18
 
static const gpio_num_t IO19 = GPIO_NUM_19
 
static const gpio_num_t IO21 = GPIO_NUM_21
 
static const gpio_num_t IO25 = GPIO_NUM_25
 
static const gpio_num_t IO26 = GPIO_NUM_26
 
static const gpio_num_t IO27 = GPIO_NUM_27
 
static const gpio_num_t IO32 = GPIO_NUM_32
 
static const gpio_num_t IO33 = GPIO_NUM_33
 
static const gpio_num_t IO34 = GPIO_NUM_34
 
static const gpio_num_t IO35 = GPIO_NUM_35
 
static const gpio_num_t RCKMOT = IO0
 
static const gpio_num_t SERMOT = IO2
 
static const gpio_num_t SCKMOT = IO12
 
static const gpio_num_t ENC1A = IO21
 
static const gpio_num_t ENC1B = IO19
 
static const gpio_num_t ENC2A = IO18
 
static const gpio_num_t ENC2B = IO5
 
static const gpio_num_t ENC3A = IO17
 
static const gpio_num_t ENC3B = IO16
 
static const gpio_num_t ENC4A = IO15
 
static const gpio_num_t ENC4B = IO13
 
static const gpio_num_t ENC5A = IO4
 
static const gpio_num_t ENC5B = IO15
 
static const gpio_num_t ENC6A = IO27
 
static const gpio_num_t ENC6B = IO26
 
static const gpio_num_t ENC7A = IO25
 
static const gpio_num_t ENC7B = IO33
 
static const gpio_num_t ENC8A = IO32
 
static const gpio_num_t ENC8B = IO35
 
static const gpio_num_t POWER_OFF = IO32
 
static const gpio_num_t BATT_REF = IO34
 
static const adc_unit_t BATT_ADC_UNIT = ADC_UNIT_1
 
static const adc1_channel_t BATT_ADC_CHANNEL = ADC1_CHANNEL_6
 
static const gpio_num_t PIEZO_A = ENC7A
 
static const gpio_num_t PIEZO_B = ENC7B
 
static const gpio_num_t I2C_MASTER_SDA = GPIO_NUM_23
 
static const gpio_num_t I2C_MASTER_SCL = GPIO_NUM_22
 
static const int I2C_ADDR_EXPANDER = 0x20 | 0x01
 
static const int EA0 = 0
 
static const int EA1 = 1
 
static const int EA2 = 2
 
static const int EA3 = 3
 
static const int EA4 = 4
 
static const int EA5 = 5
 
static const int EA6 = 6
 
static const int EA7 = 7
 
static const int EB0 = 8
 
static const int EB1 = 9
 
static const int EB2 = 10
 
static const int EB3 = 11
 
static const int EB4 = 12
 
static const int EB5 = 13
 
static const int EB6 = 14
 
static const int EB7 = 15
 
static const int SW1 = EB0
 
static const int SW2 = EB1
 
static const int SW3 = EB2
 
static const int LED_RED = EB3
 
static const int LED_YELLOW = EB4
 
static const int LED_GREEN = EB5
 
static const int LED_BLUE = EB6
 
static const int EXPANDER_BOARD_POWER_ON = EB7
 

Detailed Description

The base namespace. Contains some logging functions, too.

Enumeration Type Documentation

◆ ManagerInstallFlags

This enum contains flags for the Manager's install() method.

Enumerator
MAN_NONE 
MAN_DISABLE_MOTOR_FAILSAFE 

after 300ms of no set motor power calls.

Disables automatic motor failsafe, which stops the motors

MAN_DISABLE_BATTERY_MANAGEMENT 

auto-shutdown on low battery voltage.

Disables the battery voltage

MAN_DISABLE_PIEZO 

Do not initialize piezo on pins IO25/IO33, keeps the pins free for other functions. Warning: disabling the piezo is not recommanded because it is used to signalize low battery voltage.

◆ MotorId

enum rb::MotorId : uint8_t
strong
Enumerator
M1 
M2 
M3 
M4 
M5 
M6 
M7 
M8 
MAX 

Function Documentation

◆ __attribute__()

rb::__attribute__ ( (constructor)  )

◆ clamp()

template<typename T , typename... Args>
T rb::clamp ( value,
min,
max,
const char *  tag = "",
const char *  msg = NULL,
Args...  args 
)

◆ delay()

void rb::delay ( std::chrono::duration< uint32_t, std::milli >  delay)
inline

◆ delayMs()

void rb::delayMs ( int  ms)
inline

◆ dieTimers()

static void rb::dieTimers ( TimerHandle_t  timer)
static

◆ INV()

static int rb::INV ( int  v)
static

◆ log()

template<typename... Args>
FormatString rb::log ( int  verbosity,
const std::string &  tag,
const std::string &  message,
Args...  args 
)

◆ logDebug()

template<typename... Args>
FormatString rb::logDebug ( const std::string &  tag,
const std::string &  message,
Args...  args 
)

◆ logError()

template<typename... Args>
FormatString rb::logError ( const std::string &  tag,
const std::string &  message,
Args...  args 
)

◆ logInfo()

template<typename... Args>
FormatString rb::logInfo ( const std::string &  tag,
const std::string &  message,
Args...  args 
)

◆ logPanic()

template<typename... Args>
FormatString rb::logPanic ( const std::string &  tag,
const std::string &  message,
Args...  args 
)

◆ logWarning()

template<typename... Args>
FormatString rb::logWarning ( const std::string &  tag,
const std::string &  message,
Args...  args 
)

◆ operator""_deg() [1/2]

Angle rb::operator""_deg ( long double  d)

◆ operator""_deg() [2/2]

Angle rb::operator""_deg ( unsigned long long int  d)

◆ operator""_rad() [1/2]

Angle rb::operator""_rad ( long double  r)

◆ operator""_rad() [2/2]

Angle rb::operator""_rad ( unsigned long long int  r)

◆ operator*()

Angle rb::operator* ( Angle  a,
Angle::_T  c 
)

◆ operator+()

Angle rb::operator+ ( Angle  a,
Angle  b 
)

◆ operator++()

MotorId rb::operator++ ( MotorId x)
inline

◆ operator-()

Angle rb::operator- ( Angle  a,
Angle  b 
)

◆ operator/()

Angle rb::operator/ ( Angle  a,
Angle::_T  c 
)

◆ operator|()

ManagerInstallFlags rb::operator| ( ManagerInstallFlags  a,
ManagerInstallFlags  b 
)
inline

Variable Documentation

◆ BATT_ADC_CHANNEL

const adc1_channel_t rb::BATT_ADC_CHANNEL = ADC1_CHANNEL_6
static

◆ BATT_ADC_UNIT

const adc_unit_t rb::BATT_ADC_UNIT = ADC_UNIT_1
static

◆ BATT_REF

const gpio_num_t rb::BATT_REF = IO34
static

◆ BATTERY_ADC_SAMPLES

const int rb::BATTERY_ADC_SAMPLES = 32

◆ DEFAULT_REF_VOLTAGE

const int rb::DEFAULT_REF_VOLTAGE = 1100

◆ EA0

const int rb::EA0 = 0
static

◆ EA1

const int rb::EA1 = 1
static

◆ EA2

const int rb::EA2 = 2
static

◆ EA3

const int rb::EA3 = 3
static

◆ EA4

const int rb::EA4 = 4
static

◆ EA5

const int rb::EA5 = 5
static

◆ EA6

const int rb::EA6 = 6
static

◆ EA7

const int rb::EA7 = 7
static

◆ EB0

const int rb::EB0 = 8
static

◆ EB1

const int rb::EB1 = 9
static

◆ EB2

const int rb::EB2 = 10
static

◆ EB3

const int rb::EB3 = 11
static

◆ EB4

const int rb::EB4 = 12
static

◆ EB5

const int rb::EB5 = 13
static

◆ EB6

const int rb::EB6 = 14
static

◆ EB7

const int rb::EB7 = 15
static

◆ ENC1A

const gpio_num_t rb::ENC1A = IO21
static

◆ ENC1B

const gpio_num_t rb::ENC1B = IO19
static

◆ ENC2A

const gpio_num_t rb::ENC2A = IO18
static

◆ ENC2B

const gpio_num_t rb::ENC2B = IO5
static

◆ ENC3A

const gpio_num_t rb::ENC3A = IO17
static

◆ ENC3B

const gpio_num_t rb::ENC3B = IO16
static

◆ ENC4A

const gpio_num_t rb::ENC4A = IO15
static

◆ ENC4B

const gpio_num_t rb::ENC4B = IO13
static

◆ ENC5A

const gpio_num_t rb::ENC5A = IO4
static

◆ ENC5B

const gpio_num_t rb::ENC5B = IO15
static

◆ ENC6A

const gpio_num_t rb::ENC6A = IO27
static

◆ ENC6B

const gpio_num_t rb::ENC6B = IO26
static

◆ ENC7A

const gpio_num_t rb::ENC7A = IO25
static

◆ ENC7B

const gpio_num_t rb::ENC7B = IO33
static

◆ ENC8A

const gpio_num_t rb::ENC8A = IO32
static

◆ ENC8B

const gpio_num_t rb::ENC8B = IO35
static

◆ ENCODER_PINS

const gpio_num_t rb::ENCODER_PINS[ENC_COUNT *2]
Initial value:
= {
}
static const gpio_num_t ENC1B
Definition: RBControl_pinout.hpp:49
static const gpio_num_t ENC7B
Definition: RBControl_pinout.hpp:61
static const gpio_num_t ENC1A
Definition: RBControl_pinout.hpp:48
static const gpio_num_t ENC8B
Definition: RBControl_pinout.hpp:63
static const gpio_num_t ENC2A
Definition: RBControl_pinout.hpp:50
static const gpio_num_t ENC4A
Definition: RBControl_pinout.hpp:54
static const gpio_num_t ENC6B
Definition: RBControl_pinout.hpp:59
static const gpio_num_t ENC3A
Definition: RBControl_pinout.hpp:52
static const gpio_num_t ENC5A
Definition: RBControl_pinout.hpp:56
static const gpio_num_t ENC4B
Definition: RBControl_pinout.hpp:55
static const gpio_num_t ENC6A
Definition: RBControl_pinout.hpp:58
static const gpio_num_t ENC3B
Definition: RBControl_pinout.hpp:53
static const gpio_num_t ENC8A
Definition: RBControl_pinout.hpp:62
static const gpio_num_t ENC2B
Definition: RBControl_pinout.hpp:51
static const gpio_num_t ENC5B
Definition: RBControl_pinout.hpp:57
static const gpio_num_t ENC7A
Definition: RBControl_pinout.hpp:60

◆ EXPANDER_BOARD_POWER_ON

const int rb::EXPANDER_BOARD_POWER_ON = EB7
static

◆ I2C_ADDR_EXPANDER

const int rb::I2C_ADDR_EXPANDER = 0x20 | 0x01
static

◆ I2C_MASTER_SCL

const gpio_num_t rb::I2C_MASTER_SCL = GPIO_NUM_22
static

◆ I2C_MASTER_SDA

const gpio_num_t rb::I2C_MASTER_SDA = GPIO_NUM_23
static

◆ IO0

const gpio_num_t rb::IO0 = GPIO_NUM_0
static

◆ IO12

const gpio_num_t rb::IO12 = GPIO_NUM_12
static

◆ IO13

const gpio_num_t rb::IO13 = GPIO_NUM_13
static

◆ IO14

const gpio_num_t rb::IO14 = GPIO_NUM_14
static

◆ IO15

const gpio_num_t rb::IO15 = GPIO_NUM_15
static

◆ IO16

const gpio_num_t rb::IO16 = GPIO_NUM_16
static

◆ IO17

const gpio_num_t rb::IO17 = GPIO_NUM_17
static

◆ IO18

const gpio_num_t rb::IO18 = GPIO_NUM_18
static

◆ IO19

const gpio_num_t rb::IO19 = GPIO_NUM_19
static

◆ IO2

const gpio_num_t rb::IO2 = GPIO_NUM_2
static

◆ IO21

const gpio_num_t rb::IO21 = GPIO_NUM_21
static

◆ IO25

const gpio_num_t rb::IO25 = GPIO_NUM_25
static

◆ IO26

const gpio_num_t rb::IO26 = GPIO_NUM_26
static

◆ IO27

const gpio_num_t rb::IO27 = GPIO_NUM_27
static

◆ IO32

const gpio_num_t rb::IO32 = GPIO_NUM_32
static

◆ IO33

const gpio_num_t rb::IO33 = GPIO_NUM_33
static

◆ IO34

const gpio_num_t rb::IO34 = GPIO_NUM_34
static

◆ IO35

const gpio_num_t rb::IO35 = GPIO_NUM_35
static

◆ IO4

const gpio_num_t rb::IO4 = GPIO_NUM_4
static

◆ IO5

const gpio_num_t rb::IO5 = GPIO_NUM_5
static

◆ LED_BLUE

const int rb::LED_BLUE = EB6
static

◆ LED_GREEN

const int rb::LED_GREEN = EB5
static

◆ LED_RED

const int rb::LED_RED = EB3
static

◆ LED_YELLOW

const int rb::LED_YELLOW = EB4
static

◆ logger

Logger rb::logger

◆ PCNT_UNITS

const pcnt_unit_t rb::PCNT_UNITS[ENC_COUNT]
static
Initial value:
= {
PCNT_UNIT_0,
PCNT_UNIT_1,
PCNT_UNIT_2,
PCNT_UNIT_3,
PCNT_UNIT_4,
PCNT_UNIT_5,
PCNT_UNIT_6,
PCNT_UNIT_7
}

◆ PIEZO_A

const gpio_num_t rb::PIEZO_A = ENC7A
static

◆ PIEZO_B

const gpio_num_t rb::PIEZO_B = ENC7B
static

◆ POWER_OFF

const gpio_num_t rb::POWER_OFF = IO32
static

◆ RCKMOT

const gpio_num_t rb::RCKMOT = IO0
static

◆ SCKMOT

const gpio_num_t rb::SCKMOT = IO12
static

◆ SERMOT

const gpio_num_t rb::SERMOT = IO2
static

◆ SW1

const int rb::SW1 = EB0
static

◆ SW2

const int rb::SW2 = EB1
static

◆ SW3

const int rb::SW3 = EB2
static