示例#1
0
class SHIP:
  def __init__(self, sock, camera):
    self.s = sock;
    self.led = Led(sock)
    self.drv = Drive(sock)
    self.dsp = Disposition(camera)
    print 'SHIP: Led test'
    if self.led.test():
      print "SHIP: Led test Fail"
    print 'SHIP: Motor test'
    if self.drv.test():
      print "SHIP: Drive test Fail"
    print 'SHIP: Desposition test'
    if self.dsp.test():
      print "SHIP: Disposition test Fail"

  def raw_control(self, state):
    try:
      for motor in range(0, 4):
        if self.drv.set_control(motor, state["drive"][motor]):
          print "SHIP: raw_c :: drv.set_control Fail"
      if self.led.set_state(state["led"]):
        print "SHIP: raw_c :: led.set_state Fail"
    except:
      pass

  def get_state(self):
    return {"drive": self.drv.get_state(), "led": self.led.get_state()}
示例#2
0
 def __init__(self, sock, camera):
   self.s = sock;
   self.led = Led(sock)
   self.drv = Drive(sock)
   self.dsp = Disposition(camera)
   print 'SHIP: Led test'
   if self.led.test():
     print "SHIP: Led test Fail"
   print 'SHIP: Motor test'
   if self.drv.test():
     print "SHIP: Drive test Fail"
   print 'SHIP: Desposition test'
   if self.dsp.test():
     print "SHIP: Disposition test Fail"