def wait_for( *polls, **named ): """ Wait for at least one of the passed polls to happen """ C = __namedtuple__( "WaitResults", named.keys ) return C( **named )
class Battery: def __init__(self): self.voltage = 12.3 self.current = 1.3 class Power: def __init__(self): self.led = [0,1,2,3,4,5,6,7] self.battery = Battery() def beep(self, hz, time=1): pass # Vision MarkerInfo = __namedtuple__( "MarkerInfo", "code marker_type offset size" ) ImageCoord = __namedtuple__( "ImageCoord", "x y" ) WorldCoord = __namedtuple__( "WorldCoord", "x y z" ) PolarCoord = __namedtuple__( "PolarCoord", "length rot_x rot_y" ) Orientation = __namedtuple__( "Orientation", "rot_x rot_y rot_z" ) Point = __namedtuple__( "Point", "image world polar" ) class Marker: def __init__(self): # Aliases self.info = MarkerInfo() self.timestamp = 3.14159 self.res = (800, 600) self.vertices = [] self.centre = Point() self.dist = 42