Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
the code to put in your Choregraphe box to load the Image Recognition Database on your Nao or Pepper
class MyClass(GeneratedClass):
def __init__(self):
GeneratedClass.__init__(self)
def onLoad(self):
self.reco = ALProxy("ALVisionRecognition")
self.fmgr = ALProxy("ALFrameManager")
def onUnload(self):
pass
def onInput_onStart(self):
# self.getParameter refers to Choregraphe box parameters
path = self.fmgr.getBehaviorPath(self.behaviorId) + self.getParameter("path")
# this is the most important call
if self.reco.changeDatabase(path, self.getParameter("db name")):
self.logger.info('Vision Database was loaded')
else:
self.logger.warning('Could not load vision recognition database')
self.onStopped()
def onInput_onStop(self):
self.onUnload() #it is recommended to reuse the clean-up as the box is stopped
self.onStopped() #activate the output of the box
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment