def main(): try: serdev = SerialDevice() scarabot = Scara(serdev) cam = Camera() spkr = Speaker() scarabot.user_zero() scarabot.park() cam.start_camera() while True: inpt = input('Press enter to start game...') # Future improvements can happen here bot_first = True # random.choice([True, False]) game_function = 'standard' # random.choice(GAMETYPES) if inpt == 'c': spkr.set_cat_mode() else: spkr.set_human_mode() # Start game if game_function == 'standard': standard_game(scarabot, cam, spkr, bot_first = bot_first) elif game_function == 'meme': meme_game(scarabot, cam, spkr, bot_first = bot_first) scarabot.park() except Exception as e: raise e
def fastmoves(): sd = SerialDevice() bot = BottyMcBotFace(sd) bot.home() time.sleep(3) bot.relative_move(x=30, y=0.3)
def motors(): sd = SerialDevice() bot = BottyMcBotFace(sd) bot.home() move = 70 bot.relative_move(x=10) for i in range(100, 600, 50): bot.relative_move(x=move, velocity_mmps=i) move *= -1
def test_chop(): sd = SerialDevice() bot = BottyMcBotFace(sd) bot.home() c_pos = 10 c_inc = 2 while True: bot.absolute_move(x=c_pos) bot.chop() c_pos += c_inc c_inc *= 0.8
def __find_active_ports(port_info_list): active_ports = [] for port, baud in port_info_list: try: ser = serial.Serial( port=port, baudrate=baud, ) active_ports.append(SerialDevice.SerialDevice(port, baud, ser)) except Exception as ex: # this should mean port is not active pass time.sleep( 5 ) # To ensure that devices have time to reset after serial connection opening return active_ports
def main(): parser = argparse.ArgumentParser( description='HOLY HECK I made a robot that chops stuff.') parser.add_argument( '-m', type=int, default=0, help= 'Operational Mode - 0: De-Crust, 1: Chop, 2: Dice, 3: Finger Sammy, 4: Safety Keyboard' ) parser.add_argument('-n', type=int, default=8, help='Number of finger sammys to cut. Must be even') parser.add_argument('-w', type=float, default=3, help='Slicing thickness in mm') args = parser.parse_args() # try: s = Speaker() c = Camera() c.start() sd = SerialDevice() bot = BottyMcBotFace(sd) # Enter operational mode if cfg.DEBUG_MODE: print('Starting...') bot.home() if args.m == 0: decrust_mode(bot, c, s) elif args.m == 1: chop_mode(bot, c, s, args.w) elif args.m == 2: dice_mode(bot, c, s, args.w) elif args.m == 3: decrust_mode(bot, c, s, sammy_mode=True, n_pieces=args.n) elif args.m == 4: safety_mode(bot, c, s) bot.home()
def main(): parser = argparse.ArgumentParser(description='Holo Display.') parser.add_argument('-m', type=int, default=0, help='Operational Mode - 0: yes') parser.add_argument('-f', type=str, help='CSV playback file.') parser.add_argument('-s', action='store_true', help='Simualte playback.') parser.add_argument('-p', action='store_true', help='Purge nozzles') args = parser.parse_args() sd = SerialDevice() if args.p is True: for i in range(10): sd.command("pp") return if args.f is None: print("ERROR: Must specify playback file with '-f'") return if args.s: plt.ion() plt.show() with open(args.f) as f: for line in f.readlines(): simPlot(line) return with open(args.f) as f: while True: f.seek(0) for line in f.readlines(): sd.command(line)
def find_center(): from math import pi sd = SerialDevice() bot = BottyMcBotFace(sd) bot.home() bot.absolute_move(x=70)