def __init__(self): self.sensors = Sensors() self.servos = Actuators() # self.logic_displays = Displays() #self.dome_mc = SMC() #self.js = Joystick() self.snd = Sounds() fs = FileStorage() fs.readJson("clips.json") self.clips = fs.db
class Chaos(object): """ This does NOTHING USEFUL!!!!!!! It just exercises the codebase """ def __init__(self): self.sensors = Sensors() self.servos = Actuators() # self.logic_displays = Displays() #self.dome_mc = SMC() #self.js = Joystick() self.snd = Sounds() fs = FileStorage() fs.readJson("clips.json") self.clips = fs.db def __del__(self): pass def loop(self): # update display # self.logic_displays.update() # read inputs #ps4 = self.js.get() #print(ps4) # play random clip clip = random.choice(self.clips.keys()) print('playing:', clip) self.snd.sound(clip) time.sleep(5) # speak random word char_set = string.ascii_lowercase word = ''.join(random.sample(char_set, 6)) self.snd.speak(word) time.sleep(3) # move random servo num = random.choice(range(3)) name = 'door{}'.format(num) angle = random.choice(range(30, 150, 10)) print('Moving servro:', name, angle) self.servos.set(name, angle) time.sleep(1)
def __init__(self): # You might want to put some of these in a base class??? # these are place holders #self.legs_mc = Sabertooth() #self.dome_mc = SMC() self.sensors = Sensors() self.servos = Actuators() # self.logic_displays = Displays() #self.js = Joystick() self.snd = Sounds()
def chaos(ns, run): """ This does NOTHING USEFUL!!!!!!! It just exercises the codebase """ sensors = Sensors() servos = Actuators() snd = Sounds() fs = FileStorage() fs.readJson("clips.json") clips = fs.db while run.is_set(): # update display # logic_displays.update() # read inputs # ps4 = js.get() # print(ps4) # play random clip clip = random.choice(clips.keys()) print('playing:', clip) snd.sound(clip) time.sleep(5) # speak random word char_set = string.ascii_lowercase word = ''.join(random.sample(char_set, 6)) snd.speak(word) time.sleep(3) # move random servo num = random.choice(range(3)) name = 'door{}'.format(num) angle = random.choice(range(30, 150, 10)) print('Moving servro:', name, angle) servos.set(name, angle) time.sleep(1)