SoftBank Robotics documentation What's new in NAOqi 2.8?

ALRecharge API

Overview | API


pepp Pepper only

Namespace : AL

#include <alproxies/alnotificationmanagerproxy.h>

Methods

AL::ALValue ALRechargeProxy::lookForStation()

Tries to locate the charging station. This is a blocking call.

Pepper looks for his charging station all around him and localizes it.

360 ° search process: Pepper scans 180° in front of him, then 2 times, Pepper rotates on himself through 120° and scans.

The Status is set to Idle right before this method returns.

Returns:[int error_code, [float x, float y, float theta]] where error_code returns the error of the call (see Error code). It is 0 if the charging station has been successfully localized. his position is then given in FRAME_WORLD in the second array (x,y,theta).
int ALRechargeProxy::moveInFrontOfStation()

Makes Pepper go in front of his charging station. This is a blocking call.

Pepper goes in front of his charging station to prepare docking using ALTracker.

If the charging station has not been found already, this method will return the corresponding error code. The Status is set to Idle right before this method returns.

Returns:an Error code corresponding to the situation.
int ALRechargeProxy::dockOnStation()

Makes Pepper dock onto his charging station. This is a blocking call.

Pepper performs a U-turn and enters his charging station in a backward motion.

If the charging station has not been found already, or if the charging station is not close to his desired position in front of Pepper, this method will return the corresponding error code. If Pepper is not close to his desired position in front of the robot, this method will return False.

Upon success, this method forbids all motion moves while the robot is on the charging station. The Status is set to Idle right before this method returns.

Returns:an Error code correspondig to the situation.
int ALRechargeProxy::adjustDockingPosition(std::vector<std::vector<float>> positions)

Makes Pepper move onto his charging station to ensure working connection. This is a blocking call.

Parameters:
  • positions – The robot performs successively the moveTo commands defined by this vector of Pose2D(x, y, theta).

Upon success, this method forbids all motion moves while Pepper is on the charging station. The Status is set to Idle right before this method returns.

Returns:an Error code corresponding to the situation.
qi::Future<int> ALRechargeProxy::goToStation()

Makes Pepper go onto his charging station.

This method calls successfully ALRechargeProxy::lookForStation, ALRechargeProxy::moveInFrontOfStation and ALRechargeProxy::dockOnStation without interruption. This is a non blocking call.

This behavior can be monitored using ALRechargeProxy::getStatus.

Returns:a future that will be updated with the final Error code.

Upon success, this method forbids all motion moves while Pepper is on the charging station.

int ALRechargeProxy::leaveStation()

If Pepper is on the charging station, this method makes Pepper go just in front of it.

Upon success, this function allows all motion moves. The Status is set to Idle right before this method returns.

Returns:an Error code corresponding to the situation.
int ALRechargeProxy::getStatus()

Get the current Status of the recharge manager module.

Returns:Int representing the Status.
std::vector<float> ALRechargeProxy::getStationPosition()

Get the current charging pose2D used by the recharge module.

Returns:Pose2D (x, y, theta) of the charging station in FRAME_WORLD
void ALRechargeProxy::stopAll()

Deprecated since version 2.5: This call may not operate during critical operation like docking or undocking.

Request to stop the current behavior. This will stop the Tracker and all ongoing moves. This resets the Status to Idle.

bool ALRechargeProxy::getUseTrackerSearcher()
Returns:true if the ALRechargeProxy::lookForStation uses the whole body tracker animation from ALTracker during search and else returns false.
void ALRechargeProxy::setUseTrackerSearcher(bool enable)

Sets default or custom animation to be used upon call of ALRechargeProxy::lookForStation.

Parameters:
  • enable – If true, during search, Pepper uses the whole body tracker animation from ALTracker. Otherwise a custom animation can be used.
void ALRechargeProxy::setMaxNumberOfTries(int number)

Sets the number of attempts authorized during ALRechargeProxy::moveInFrontOfStation before returning failure error code.

Parameters:
  • number – Number of attempts stricly superior to zero.
int ALRechargeProxy::getMaxNumberOfTries()
Returns:returns the number of attempts authorized during ALRechargeProxy::moveInFrontOfStation before failing.

Events

Event: "ALRecharge/StatusChanged"
callback(std::string eventName, int status, std::string subscriberIdentifier)

Raised when the ALRecharge Status changes.

Parameters:
  • eventName (std::string) – “ALRecharge/StatusChanged”
  • status – new Status.
  • subscriberIdentifier (std::string) –
Event: "ALRecharge/StationDetected"
callback(std::string eventName, AL::ALValue plugged, std::string subscriberIdentifier)

Raised when Pepper detects his charging station with a confidence index higher than 0.5.

Parameters:
  • eventName (std::string) – “ALRecharge/StationDetected”
  • plugged – data needed by ALTracker for charging station tracking.
  • subscriberIdentifier (std::string) –
Event: "ALRecharge/StationNotFound"
callback(std::string eventName, std::string subscriberIdentifier)

Raised when Pepper has not found the charging station. It then stops the search.

Event: "ALRecharge/ConnectedToChargingStation"
callback(std::string eventName, std::string subscriberIdentifier)

Raised when Pepper is correctly docked onto the charging station.

Event: "ALRecharge/DockingSuccess"
callback(std::string eventName, std::string subscriberIdentifier)

Raised when Pepper has successfully docked onto the charging station.

Event: "ALRecharge/DockingFailed"
callback(std::string eventName, std::string subscriberIdentifier)

Raised when Pepper failed to dock onto the charging station during the final step.

Event: "ALRecharge/LeaveSuccess"
callback(std::string eventName, std::string subscriberIdentifier)

Raised when Pepper correctly left his charging station.

Event: "ALRecharge/LeaveFailed"
callback(std::string eventName, std::string subscriberIdentifier)

Raised when Pepper failed to leave his charging station due to an obstacle in the way.

Event: "ALRecharge/SearchStopped"
callback(std::string eventName, std::string subscriberIdentifier)

Raised when Pepper stops the search and goes back to idle Status.

Event: "ALRecharge/MoveFailed"
callback(std::string eventName, std::string subscriberIdentifier)

Raised when Pepper interrupts his operation because a safety rule prevents the usage of ALMotion module.

Event: "ALRecharge/DockingUTurnStarted"
callback(std::string eventName, float angle, std::string subscriberIdentifier)

Raised when Pepper starts his UTurn motion during docking step.

Parameters:
  • eventName (std::string) – “ALRecharge/DockingUTurnStarted”
  • angle – Angle of rotation in radians made by Pepper to prepare entering the charging station.
  • subscriberIdentifier (std::string) –
Event: "ALRecharge/DockingBackwardStarted"
callback(std::string eventName, std::string subscriberIdentifier)

Raised when Pepper starts his backward motion during docking step.

Event: "ALRecharge/CloseToChargingStation"
callback(std::string eventName, std::string subscriberIdentifier)

Raised when ALRecharge forbids all wheel motions, because Pepper is too close from the charging station. When Pepper is put away from the charging station, the wheel motions are enabled back and this event raised with False.


Status

Value Meaning
0 Idle
1 Looking for his charging station
2 Going in front of his charging station
3 Docking onto his charging station
4 An error has been detected during the process
5 “Subscribed” meaning that ALRecharge is listening to charging station detection events and updates the charging station pose. Used for testing
6 Pepper is leaving his charging station

Error code

Value Meaning
0 OK
1 Safety issue
2 Charging station not found
3 Pepper on charging station
4 No charging station hypothesis
5 Proxy call failed
6 Not connected but Pepper touched the connectors or the slope pattern seems right during the backward move
7 Not connected, Pepper did not touch the connectors during his move and the slope pattern does not indicate that Pepper is connected
8 Pepper not woken up
9 Pepper not in front of the station
10 Already going to station
11 The docking process has been aborted, as the charging station appears to be slanted
12 Pepper did not manage to connect to his station nor to move away from it, thus being in an unsafe position possibly partly on the charging station