def __init__(self, channel, timeout, speed, parallel=False): self.channel = channel self.controller = Controller() self.speed = speed self.controller.setTarget(1, 6000) self.controller.setTarget(2, 6000) super(SetSpeed, self).__init__(timeout) self.parallel = parallel return
def __init__(self, node, server): self.node = node self.server = server self.done = False self.hp = 100 self.hasKey = False self.direction = "South" self.control = Controller() self.control.setTarget(1, 6000)
def __init__(self): self.servo = Controller() #self.root = tk.Tk() os.system('xset r off') #set targets to neutral for i in range(17): self.servo.setTarget(i, neutral) self.servo.setSpeed(i, 0) self.servo.setAccel(i, 60) self.servo.setAccel(drive_target, 6)
def __init__(self): # Maestro instantiation self.controller = Controller() for chan in range(len(self.controller.Targets)): self.controller.setTarget(chan, 6000) self.controller.setAccel(0, 10) self.controller.setAccel(1, 10) self.controller.setAccel(2, 30) self.controller.setAccel(3, 20) self.controller.setAccel(3, 20) os.system('xset r off')
def run(self): global rob rob = Controller() global q q = queue.Queue() global count count = 0 win = tk.Tk() win.title("Tango Bot") moveButton = tk.Button(win, width="12", text="Move", command=Button.createMove) turnButton = tk.Button(win, width="12", text="Turn", command=Button.createTurn) bodyButton = tk.Button(win, width="12", text="Rotate Body", command=Button.createBody) headButton = tk.Button(win, width="12", text="Move Head", command=Button.createHead) listenButton = tk.Button(win, width="12", text="Listen", command=Button.createListen) speakButton = tk.Button(win, width="12", text="Speak", command=Button.createSpeak) moveButton.grid(column=0, row=0, pady=10) turnButton.grid(column=1, row=0, pady=10) bodyButton.grid(column=2, row=0, pady=10) headButton.grid(column=3, row=0, pady=10) listenButton.grid(column=4, row=0, pady=10) speakButton.grid(column=5, row=0, pady=10) global frame frame = tk.Frame(win, width=750, height=300) frame.grid(columnspan=6, row=1, padx=15, pady=15) frame.grid_propagate(False) reset = tk.Button(win, width="20", text="Reset", command=Control.reset) run = tk.Button(win, width="20", text="Run", command=Control.run) reset.grid(columnspan=3, column=0, row=2, pady=10) run.grid(columnspan=3, column=2, row=2, pady=10) win.mainloop()
def __init__(self,win): self.root = win self.tango = Controller() self.body = default_pos self.headturn = default_pos self.headtilt = default_pos self.motors = 0 self.turn = 0 self.tango.setAccel(motors, default_accel) self.tango.setAccel(full_turn,default_accel) for i in range(1,6): self.tango.setTarget(i,default_pos)
def __init__(self, rotateChannel, forwardChannel, controller): self._forwardChannel = forwardChannel self.controller = controller self.controller = Controller() self.rotate = 0 self.forward = 0 self.enable = False self.moveForward = False self.moveBackward = False self.rotateLeft = False self.rotateRight = False self.speed = Drivetrain.Slow self.stop = False self._rotateChannel = rotateChannel
def __init__(self): self.controller = Controller() self.body = 0 self.motor_move = 1 self.motor_turn = 2 self.head_vert = 3 self.head_hor = 4 self.low_range = 4000 self.high_range = 5000 self.kill = 6000 # must kill motors before starting self.controller.setTarget(self.motor_move, self.kill) self.controller.setTarget(self.motor_turn, self.kill)
def run(): global part global direction global dur rob = Controller() if (part == 'wheels'): if (direction == 'forward'): rob.setTarget(1, 5000) elif (direction == 'back'): rob.setTarget(1, 7000) elif (direction == 'left'): rob.setTarget(2, 7000) elif (direction == 'right'): rob.setTarget(2, 5000) time.sleep(dur) rob.setTarget(1, 6000) rob.setTarget(2, 6000) elif (part == 'head'): if (direction == 'up'): rob.setTarget(4, 7500) elif (direction == 'down'): rob.setTarget(4, 4500) elif (direction == 'left'): rob.setTarget(3, 7500) elif (direction == 'right'): rob.setTarget(3, 4500) elif (direction == 'center'): rob.setTarget(4, 6000) rob.setTarget(3, 6000) elif (part == 'body'): if (direction == 'left'): rob.setTarget(0, 7500) elif (direction == 'right'): rob.setTarget(0, 4500) elif (direction == 'center'): rob.setTarget(0, 6000) time.sleep(1)
def __init__(self): self.screen = curses.initscr() curses.cbreak() curses.noecho() curses.halfdelay(1) curses.endwin() self.screen.keypad(True) self.control = Controller() self.control.setTarget(1, 6000) self.control.setTarget(2, 6000) self.head_pos = 6000 self.head_step = 1000 self.head_tilt = 6000 self.speed = 1250 self.control.setTarget(0, 6000) self.control.setTarget(3, 6000) self.control.setTarget(4, 5000)
def __init__(self, canvas, x, y, width, height, color, text): self.x = x self.y = y self.width = width self.height = height self.clicked = False # if the action is currently clicked self.color = color # color of action rectangle self.setting = 0 # how long or how many degrees to do action for self.settingStep = 0 # how much to decrease or increase setting per button press self.settingType = None # duration or degrees self.settingMin = 0 # minimum setting self.settingMax = 0 # maximum setting self.icon = canvas.create_rectangle(self.x - self.width / 2, self.y - self.height / 2, self.x + self.width / 2, self.y + self.height / 2, fill=color, width=5) self.text = canvas.create_text(self.x, self.y - 7, text=text) # name of action self.label = None # shows current setting self.buttonUp = canvas.create_polygon(self.x - 20, self.y - 20, self.x + 20, self.y - 20, self.x, self.y - 50, fill='black') # up button for adjusting setting self.buttonDown = canvas.create_polygon(self.x - 20, self.y + 20, self.x + 20, self.y + 20, self.x, self.y + 50, fill='black') # down button for adjusting setting self.control = Controller() self.control.setTarget(1,6000)
def __init__(self, win): ## init to work with alex's code # def __init__(self): self.root = win self.x = Controller()
def init(): RobotMap.controller = Controller()
import tty import sys import termios from Maestro import Controller x = Controller() # 0 <- body # 1 <- wheel # 2 <- wheel # 3 <- head left/right # 4 <- head up/down # forward 2400 - 1800 # reverse 6300 - 7100 x.setTarget(1, 6000) x.setTarget(2, 6000) x.setSpeed(1, 30) x.setSpeed(2, 30) x.setAccel(1, 150) low_range = 4000 high_range = 5000 def take_instr(direction): global low_range global high_range
from Maestro import Controller from tkinter import * import time import os import socket import threading import random # Maestro instantiation controller = Controller() for chan in range(len(controller.Targets)): controller.setTarget(chan, 6000) controller.setAccel(0, 10) controller.setAccel(1, 10) controller.setAccel(2, 30) controller.setAccel(3, 20) controller.setAccel(4, 20) controller.setAccel(6, 20) controller.setAccel(7, 20) controller.setAccel(8, 20) controller.setAccel(9, 20) controller.setAccel(10, 20) controller.setAccel(11, 20) os.system('xset r off') # Global Variables port = 7777 # Socket setup sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.close()
class commands: rob = Controller() def fight(self): targetR = 6 targetL = 12 targetRR = 8 targetLL = 14 self.rob.setTarget(targetR, 0) self.rob.setTarget(targetL, 0) self.rob.setTarget(targetRR, 0) self.rob.setTarget(targetLL, 0) for i in range(0, 2): self.rob.setTarget(targetR, 8000) self.rob.setTarget(targetL, 2000) self.rob.setTarget(targetRR, 8000) self.rob.setTarget(targetLL, 8000) time.sleep(.5) self.rob.setTarget(targetR, 0) self.rob.setTarget(targetL, 0) self.rob.setTarget(targetRR, 0) self.rob.setTarget(targetLL, 0) time.sleep(.5) def randomFight(self): for i in range(0, 20): target = int(random.uniform(6, 17)) amount = int(random.uniform(0, 10)) self.rob.setTarget(target, amount) self.rob.setTarget(target, amount) def reset(self): zeroVal = [6, 12] sizVal = [8, 9, 10, 11, 15, 16, 17] for i in range(2): target = zeroVal[i] self.rob.setTarget(target, 0) for i in range(7): target = sizVal[i] self.rob.setTarget(target, 6000) time.sleep(1) for i in range(2): target = 7 target2 = 13 self.rob.setTarget(target, 7000) self.rob.setTarget(target2, 6000) target = 14 self.rob.setTarget(target, 7000) body = 0 head = 3 head2 = 4 self.rob.setTarget(body, 6000) self.rob.setTarget(head, 6000) self.rob.setTarget(head2, 6000) def superReset(self): headUP = 4 headLR = 3 body = 0 upperRight = 6 upperLeft = 12 middleRight = 7 middleLeft = 13 self.rob.setTarget(headUP, 6000) self.rob.setTarget(headLR, 6000) self.rob.setTarget(body, 6000) self.rob.setTarget(upperRight, 0) self.rob.setTarget(upperLeft, 0) self.rob.setTarget(middleRight, 7000) self.rob.setTarget(middleLeft, 6000) def die(self): targetUpArmR = 6 targetUpArmL = 12 targetout = 13 targetoutR = 7 body = 0 head = 3 headUp = 4 for i in range(0, 10000): self.rob.setTarget(targetUpArmR, 9000) self.rob.setTarget(targetUpArmL, 1000) self.rob.setTarget(body, 6000) self.rob.setTarget(head, 6000) time.sleep(2) self.rob.setTarget(targetout, 2000) self.rob.setTarget(targetoutR, 8000) self.rob.setTarget(headUp, 8000) time.sleep(2) self.rob.setTarget(targetUpArmR, 0) self.rob.setTarget(targetUpArmL, 0) self.rob.setTarget(targetout, 6000) self.rob.setTarget(targetoutR, 7000) self.rob.setTarget(head, 6000) self.rob.setTarget(headUp, 4000) time.sleep(3) def look(self): headUD = 4 headLR = 3 self.rob.setTarget(headUD, 6000) self.rob.setTarget(headLR, 6000) time.sleep(1) self.rob.setTarget(headLR, 4000) time.sleep(2) self.rob.setTarget(headLR, 8000) time.sleep(2) self.rob.setTarget(headLR, 6000) def corn(self): target2 = 12 target3 = 14 target4 = 15 target5 = 16 target6 = 17 self.rob.setTarget(target2, 5000) self.rob.setTarget(target3, 8000) time.sleep(.5) self.rob.setTarget(target4, 4000) self.rob.setTarget(target3, 4000) time.sleep(.5) self.rob.setTarget(target4, 8000) self.rob.setTarget(target3, 8000) time.sleep(.5) self.rob.setTarget(target4, 4000) self.rob.setTarget(target3, 4000) time.sleep(.5) self.rob.setTarget(target4, 8000) self.rob.setTarget(target3, 8000) time.sleep(.5) self.rob.setTarget(target4, 4000) self.rob.setTarget(target3, 4000) time.sleep(.5) self.rob.setTarget(target4, 8000) self.rob.setTarget(target3, 8000) time.sleep(.5) self.rob.setTarget(target4, 4000) self.rob.setTarget(target3, 4000) time.sleep(.5) time.sleep(3) def wtf(self): target = 6 self.rob.setTarget(target, 2000) target = 12 self.rob.setTarget(target, 2000) def forward(self): target = 1 self.rob.setTarget(target, 5000) time.sleep(1) self.rob.setTarget(target, 6000) def backward(self): target = 1 self.rob.setTarget(target, 7000) time.sleep(1) self.rob.setTarget(target, 6000) def left(self): target = 2 self.rob.setTarget(target, 7000) time.sleep(2) self.rob.setTarget(target, 6000) target = 1 self.rob.setTarget(target, 5000) time.sleep(1) self.rob.setTarget(target, 6000) def right(self): target = 2 self.rob.setTarget(target, 5000) time.sleep(2) self.rob.setTarget(target, 6000) target = 1 self.rob.setTarget(target, 5000) time.sleep(1) self.rob.setTarget(target, 6000) def runAway(self): target = 2 self.rob.setTarget(target, 3000) time.sleep(5) self.rob.setTarget(target, 6000) target = 1 self.rob.setTarget(target, 5000) time.sleep(2) self.rob.setTarget(target, 6000) def think(self): target = 12 self