Exemple #1
0

if __name__ == '__main__':
    servo = Servo("/dev/cu.usbserial-14130")
    # evo = TeraRanger()
    root = tk.Tk()
    Window = MainWindow(root)

    # Main Loop
    while (Window.ExitFlag):
        if Window.update:
            if Window.running:
                updateParams(servo, Window)
            else:
                servo.min = 0  #21 duty cycle corresponds with 0 location

            # Reset the needed parameters
            servo.reset()
            # evo.reset()
            Window.update = 0

        elif Window.running:
            servo.update()
            # sleep(0.003)
            Window.updatePlot(servo.time, servo.data)

        root.update()

    servo._close()
    # evo._close()
Exemple #2
0

if __name__ == '__main__':
    servo = servofunctions()  #creates object to control robot
    func = servo.absolute  #initializes breathing pattern
    root = tk.Tk()  #creates window for tkinter
    Window = MainWindow(root)  #creates object to control tkinter

    # Main Loop
    while (1):
        if (
                Window.UpdateCheck == 1
        ):  #runs if update or start/stop has been clicked in GUI (or if exiting)
            if Window.running:
                servo.A = Window.AMP  #these all take GUI values and sends them to the pattern calculations in servo
                servo.M = Window.OFF
                servo.freq = Window.BPM
                func = switch(Window.FUNC)
                servo.reset()  #resets the robot to the offset
                Window.UpdateCheck = 0  #stops this branch from running multiple times without user input
            else:  #resets the robot to zero position when stopped or exiting
                servo.M = 21  #21 duty cycle corresponds with 0 location
                servo.reset()
                Window.UpdateCheck = 0

        elif (Window.running == 1):
            func()  #runs selected function in servofunctions to move the robot
            Window.updatePlot(servo.time, servo.data)  #updates plot

        root.update()  #checks GUI for input
Exemple #3
0
if __name__ == '__main__':
    # servo = Servo("/dev/cu.usbserial-14130")
    evo = TeraRanger()
    root = tk.Tk()
    Window = MainWindow(root)

    # Main Loop
    while (Window.ExitFlag):
        if Window.update:
            # if Window.running:
            # 	updateParams(servo,Window)
            # else:
            # 	servo.min = 0 #21 duty cycle corresponds with 0 location

            # Reset the needed parameters
            # servo.reset()
            evo.reset()
            Window.update = 0

        elif Window.running:
            # servo.update()
            evo.update()
            # Window.updatePlot(servo.time,servo.data)
            Window.updatePlot(evo.time, evo.getData())
            # Window.updatePlot(servo.time,servo.data,evo.time,evo.getData())

        root.update()

    # servo._close()
    evo._close()