import sys import tkinter import robotControl import math import numpy as np from pylab import * top = tkinter.Tk() rob = robotControl.robotControl(sys.argv[1], 9600, timeout=4) def init(): rob.startSensors() rob.startDrive() def off(): rob.stopSensors() rob.stopDrive() def startPlot(): plotData(rob.getTheta()) def readSensors(): rob.updateSensors() top.after(1, readSensors) ra = []
import time import pygame import datetime from robotControl import robotControl robots = robotControl("COM4") # # Movement Class to move the robot(s) autonomously and by joystick. # Only module that connects to the base station serial port. # case1 = -1 case2 = -1 target1 = datetime.datetime.now() + datetime.timedelta(days=100) target2 = datetime.datetime.now() + datetime.timedelta(days=100) # Only send the command to move if it's the first time through the loop firstTime = True firstTime2 = True # Either 'f' or 'b' for forward and backward movement direction1 = "x" direction2 = "x" # straightTime amount of time spent going to forward or backwards, optional parameter straightTime1 = 1 straightTime2 = 1 #
import time import pygame import datetime import Line_Functions import math from robotControl import robotControl robots = robotControl('COM4') # # Movement Class to move the robot(s) autonomously and by joystick. # Only module that connects to the base station serial port. # case1 = -1 case2 = -1 target1 = datetime.datetime.now() + datetime.timedelta(days=100) target2 = datetime.datetime.now() + datetime.timedelta(days=100) #Only send the command to move if it's the first time through the loop firstTime = True firstTime2 = True #Either 'f' or 'b' for forward and backward movement direction1 = 'x' direction2 = 'x' #straightTime amount of time spent going to forward or backwards, optional parameter straightTime1 = 0.5 straightTime2 = 0.5
import sys import tkinter import robotControl import math import numpy as np from pylab import * top = tkinter.Tk() rob = robotControl.robotControl('COM6', 9600, timeout=4) h, = plot([], [], 'bo') def update_line(hl, new_datax, new_datay): hl.set_xdata(np.append(hl.get_xdata(), new_datax)) hl.set_ydata(np.append(hl.get_ydata(), new_datay)) gca().relim() gca().autoscale_view() axis('equal') draw() global stopScan stopscan = False def startPlot(): ion() show() #rob.driveSpeed(-5,5) global stopScan stopScan = False plotData(rob.getTheta())