Skip to content

Instantly share code, notes, and snippets.

Sebastien Cagnon sebcagnon

View GitHub Profile
@sebcagnon
sebcagnon / passThroughOptionParser.py
Last active Nov 22, 2016
OptionParser that lets optional arguments go through. Useful when pre-processing then giving the rest to another program.
View passThroughOptionParser.py
from optparse import (OptionParser,BadOptionError,AmbiguousOptionError)
class PassThroughOptionParser(OptionParser):
"""
An unknown option pass-through implementation of OptionParser.
When unknown arguments are encountered, bundle with largs and try again,
until rargs is depleted.
sys.exit(status) will still be called if a known argument is passed
@sebcagnon
sebcagnon / signal connect
Last active Jan 19, 2016
In a Python box with the onStopped output set to "string"
View signal connect
class MyClass(GeneratedClass):
def __init__(self):
GeneratedClass.__init__(self)
def onLoad(self):
#put initialization code here
self.id = None
def onUnload(self):
#put clean-up code here
@sebcagnon
sebcagnon / loadNaoImageDBBox.py
Created Aug 25, 2015
the code to put in your Choregraphe box to load the Image Recognition Database on your Nao or Pepper
View loadNaoImageDBBox.py
class MyClass(GeneratedClass):
def __init__(self):
GeneratedClass.__init__(self)
def onLoad(self):
self.reco = ALProxy("ALVisionRecognition")
self.fmgr = ALProxy("ALFrameManager")
def onUnload(self):
pass
You can’t perform that action at this time.