Last active
August 29, 2015 14:16
-
-
Save CryZe/b93733fc78daaab025d4 to your computer and use it in GitHub Desktop.
NAO Classes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyClass(GeneratedClass): | |
def __init__(self): | |
GeneratedClass.__init__(self) | |
def onLoad(self): | |
self.gotInput1 = False | |
self.gotInput2 = False | |
def onUnload(self): | |
pass | |
def onInput_onInput1(self): | |
self.gotInput1 = True | |
if self.gotInput2: | |
self.onStopped() | |
def onInput_onInput2(self): | |
self.gotInput2 = True | |
if self.gotInput1: | |
self.onStopped() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyClass(GeneratedClass): | |
def __init__(self): | |
GeneratedClass.__init__(self) | |
def onLoad(self): | |
self.isOpen = False | |
def onUnload(self): | |
pass | |
def onInput_onOpen(self): | |
self.isOpen = True | |
def onInput_onInput(self): | |
if self.isOpen: | |
self.onStopped() | |
def onInput_onReset(self): | |
self.isOpen = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyClass(GeneratedClass): | |
def __init__(self): | |
GeneratedClass.__init__(self) | |
self.detector = ALProxy("ALLandMarkDetection") | |
self.memory = ALProxy("ALMemory") | |
self.subscribed = False | |
self.BIND_PYTHON(self.getName(), "onLandmarkDetected") | |
def onLoad(self): | |
self.subscribed = False | |
def onUnload(self): | |
if self.subscribed: | |
self.memory.unsubscribeToEvent("LandmarkDetected", self.getName()) | |
self.detector.unsubscribe("Test_LandMark") | |
self.subscribed = False | |
def onLandmarkDetected(self, key, value, message): | |
self.onFound() | |
self.onStop() | |
def onInput_onStart(self): | |
self.detector.subscribe("Test_LandMark", 500, 1.0) | |
self.memory.subscribeToEvent("LandmarkDetected", self.getName(), "onLandmarkDetected") | |
self.subscribed = True | |
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