电池#

介绍#

The battery class is derived from the brain base class and provides access to the EXP Brain’s battery, allowing your robot to monitor capacity, voltage, current draw, power usage, temperature, and efficiency.

使用权#

Brain.Battery

成员功能#

The battery class includes the following member functions:

  • voltage — Returns the battery voltage.

  • current — Returns the battery current draw.

  • capacity — Returns the brain’s remaining battery capacity.

  • temperature — Returns the battery temperature.

Before calling any battery member functions, a brain instance must be created, as shown below:

// Create the EXP Brain
brain Brain = brain();

voltage#

返回EXP Brain电池的电压。电压是指施加在电池上的电压力,可以帮助您检查电池电量是否充足,以确保机器人能够可靠运行。

Available Functions
double voltage( voltageUnits units = voltageUnits::volt );

Parameters

范围

类型

描述

units

voltageUnits

Optional. The unit used to represent voltage: volt (default) — volts, or mV — millivolts

Return Values

Returns a double representing the battery voltage in the specified units, ranging from 7.0 to 8.0 V or 7000 to 8000 mV.

current#

返回从 EXP Brain 电池汲取的电流。电流是指机器人从电池消耗的电量,可以帮助您了解机器人的工作强度或电机是否承受过大负载。

Available Functions
double current( currentUnits units = currentUnits::amp );

Parameters

范围

类型

描述

units

voltageUnits

Optional. The unit used to represent current: amp (default) — amperes

Return Values

Returns a double representing the electrical current drawn from the EXP Brain battery in amperes, ranging from 0.0 to 15.0 Amps.

capacity#

返回 EXP Brain 电池的剩余电量。

Available Functions
uint32_t capacity( percentUnits units = percentUnits::pct );

Parameters

范围

类型

描述

units

percentUnits

Optional. The unit used to represent battery capacity: pct / percent — percent

Return Values

Returns a uint32_t representing the remaining battery capacity as a percentage from 0% to 100%.

temperature#

返回 EXP Brain 电池的温度。

Available Functions

1 返回电池温度的百分比。

double temperature(
    percentUnits units = percentUnits::pct );

2 返回指定温度单位的电池温度。

double temperature(
    temperatureUnits units );

Parameters

范围

类型

描述

units

percentUnits

Optional. The unit used to represent battery temperature: pct / percent (default) — percent

units

temperatureUnits

Returns the battery temperature in specific units: celsius — degrees Celsius, or fahrenheit — degrees Fahrenheit

Return Values

Returns a double representing the remaining battery temperature in the specified units.

Notes
  • The operating temperature range for the battery is approximately 20°C (68°F) to 70°C (158°F).