ALRecharge¶
Overview | API
Pepper only
What it does¶
ALRecharge module provides API to manage Pepper behavior about its charging station.
It allows the user to make Pepper look for its charging station, dock onto it to automatically recharge, and leave it safely.
While Pepper is docked on the charging station, all motion moves are disabled. They are automatically re-enabled when Pepper leaves the charging station.
During all these operations, the module provides a way for developers to follow the progress and the current status.
How it works¶
Upon calling of ALRechargeProxy::goToStation
, Pepper starts to
look for its charging station around him. Once it has localized it using
the bottom camera, he goes in front of it using ALTracker, stopping at 0.6m.
After charging station localization confirmation, Pepper performs a U-turn and docks on its charging station in a backward motion at a reduced speed.
Upon success, it disables motion move API. In case of a failure, Pepper moves away from the charging station in order not to collide with it and an event is raised.
When Pepper is disconnected from the charging station, motion move APIs are
disabled until Pepper has moved away from the charging station either by
calling ALRechargeProxy::leaveStation
or by manually pushing
Pepper out of its charging station.
This behavior can be cut down into smaller steps by calling ALRechargeProxy::lookForStation
,
ALRechargeProxy::moveInFrontOfStation
and ALRechargeProxy::dockOnStation
The function ALRechargeProxy::leaveStation
makes Pepper leave the
charging station. This is the only method to make Pepper move while it is connected to its charging station.
Performances and limitations¶
- The total behavior to move Pepper onto its charging station should take less than a minute in normal cases.
- The battery charging time is the same as with the manual charger.
- The current behavior stops when an obstacle is detected or if the tracker stops for whatever reason. The recharge behavior has to be managed from an higher level application to retry docking in case of a failure.
- This module is using vision extractor. The detection and localization of the charging station thus uses 2D cameras.
- If Pepper is not equipped with the right hardware, the charging station will not supply power to Pepper even though it has reached the correct position. In this case, Pepper will safely exit the charging station and remain in front.
- ALRecharge uses ALTracker ‘navigate’ mode for servoing from far distance from the charging station. Fine position in front of it is done using ‘Move’ mode.
Example use¶
To take advantage of ALRecharge, simply use goToStation: it will handle all parts of the process.
sample_alrecharge_gotostation.py
# -*- encoding: UTF-8 -*-
''' ALRecharge: Makes the robot move onto his charging station. '''
import argparse
import qi
def main(ip, port = 9559):
s = qi.Session()
s.connect("tcp://"+str(ip)+":"+str(port))
# Get proxies
recharge = s.service("ALRecharge")
motion = s.service("ALMotion")
# Wake the robot up.
motion.wakeUp()
# Make the robot go to his charging station
success = recharge.goToStation()
if success != 0: # The charging station has not been found.
print "Station is not found."
return
print "Robot successfully docked."
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--ip", type=str, default="127.0.0.1", help="Robot IP address")
parser.add_argument("--port", type=int, default=9559, help="Robot port number")
args = parser.parse_args()
main(args.ip, args.port)
Alternatively, you can use the API successively for a finer control over the operation.
sample_alrecharge.py
# -*- encoding: UTF-8 -*-
''' ALRecharge: Makes the robot move onto his charging station. '''
import argparse
import qi
def main(ip, port = 9559):
s = qi.Session()
s.connect("tcp://"+str(ip)+":"+str(port))
# Get proxies
recharge = s.service("ALRecharge")
motion = s.service("ALMotion")
# Wake the robot up.
motion.wakeUp()
# Make the robot look for his charging station
found = recharge.lookForStation()
if found[0] != 0: # The charging station has not been found.
print "Station is not found."
return
# Move in front of charging station using ALTracker
correct = recharge.moveInFrontOfStation()
if correct != 0: # The robot has not been able to move close to the charging station.
print "Unable to move in front of the station."
return
# Start docking motion
docked = recharge.dockOnStation()
if docked != 0: # The docking failed.
print "Unable to dock on the charging station."
return
print "Robot successfully docked."
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--ip", type=str, default="127.0.0.1", help="Robot IP address")
parser.add_argument("--port", type=int, default=9559, help="Robot port number")
args = parser.parse_args()
main(args.ip, args.port)