# SoftBank Robotics documentation What's new in NAOqi 2.8?

# ALBattery API

NAOqi Sensors & LEDs - Overview | API

See also

Battery Hardware or Battery Hardware

Namespace : AL

    #include <alproxies/albatteryproxy.h>

## Method list

This module has the following methods:

class `ALBatteryProxy`

- `ALBatteryProxy::getBatteryCharge`

Deprecated methods

This module also inherits methods from ALModule API. Those inherited methods are deprecated.

## Event list

- `ALBattery/ConnectedToChargingStation()`
- `BatteryTrapIsOpen()`
- `BatteryChargingFlagChanged()`
- `BatteryPowerPluggedChanged()`
- `BatteryChargeChanged()`

## Methods

int `ALBatteryProxy::``getBatteryCharge`()

  Get battery charge.

  Returns: | Return the battery charge in percent.

## Events

Event: `"ALBattery/ConnectedToChargingStation"`
callback(std::string eventName, bool connected, std::string subscriberIdentifier)

  Pepper Only.

  Raised when the robot is connected and disconnected to charging station, irrespectively of the charging station being powered or not.

  Parameters: | eventName (std::string) – “ALBattery/ConnectedToChargingStation” connected – True when the robot is connected, false otherwise. subscriberIdentifier (std::string) –

Event: `"BatteryTrapIsOpen"`
callback(std::string eventName, bool open, std::string subscriberIdentifier)

  Pepper Only.

  Raised when the power hatch is opened or closed.

  Parameters: | eventName (std::string) – “BatteryTrapIsOpen” connected – True when the power hatch is opened, false otherwise. subscriberIdentifier (std::string) –

Event: `"BatteryChargingFlagChanged"`
callback(std::string eventName, bool charging, std::string subscriberIdentifier)

  Identical to `BatteryPowerPluggedChanged()`.

Event: `"BatteryPowerPluggedChanged"`
callback(std::string eventName, bool charging, std::string subscriberIdentifier)

  Raised when the battery is connected to or disconnected from a powered-on battery charger. The connection may occur through the power socket or through the charging station.

  Caution: some battery models do not provide information whether the power is plugged or not. In this case, the power plugged state is inferred from the electric current consumed by the battery. As a consequence, this event is less reliable when the battery is fully charged (because no current is consumed by the battery) or when the motors are used intensely (because current is drawn from both the charger and the battery).

  For further details see: Battery Hardware.

  Parameters: | eventName (std::string) – “BatteryPowerPluggedChanged” charging – True when the battery is connected to a power source, false otherwise. subscriberIdentifier (std::string) –

Event: `"BatteryChargeChanged"`
callback(std::string eventName, int percentage, std::string subscriberIdentifier)

  Raised when the battery level percentage changes.

  Parameters: | eventName (std::string) – “BatteryChargeChanged” percentage – The percent of the battery that remains. subscriberIdentifier (std::string) –

Glossary Site map Index Support Contact Legal Notices