Exemplo n.º 1
0
import time
from roboclaw import Roboclaw

# Windows comport name
# rc = Roboclaw("COM9", 115200)
# Linux comport name
rc = Roboclaw("/dev/ttyACM0", 115200)

rc.Open()
address = 0x80

rc.ForwardMixed(address, 0)
rc.TurnRightMixed(address, 0)

while (1):
    rc.ForwardMixed(address, 32)
    time.sleep(2)
    rc.BackwardMixed(address, 32)
    time.sleep(2)
    rc.TurnRightMixed(address, 32)
    time.sleep(2)
    rc.TurnLeftMixed(address, 32)
    time.sleep(2)
    rc.ForwardMixed(address, 0)
    rc.TurnRightMixed(address, 32)
    time.sleep(2)
    rc.TurnLeftMixed(address, 32)
    time.sleep(2)
    rc.TurnRightMixed(address, 0)
    time.sleep(2)
Exemplo n.º 2
0
#newtime=time.time()

address = 0x80
rc = Roboclaw("/dev/serial/by-id/usb-03eb_USB_Roboclaw_2x60A-if00", 115200)
#rc = Roboclaw("/dev/ttyACM1", 115200)
#f=open("file.txt", "w")
#f.write("TEST")
if not rc.Open():
    print(
        "***************************FAILED TO OPEN****************************"
    )

rc.ForwardMixed(address, 0)
rc.TurnRightMixed(address, 0)
rc.BackwardMixed(address, 0)
rc.TurnLeftMixed(address, 0)

# Instantiating The Class Object For PySabertooth
#wheels = DriveEsc(128, "mixed")
#armMix = DriveEsc(129, "notMixed")

IDLE_TIMEOUT = 15  #seconds
#use actual button numbers instead of 0-indexed array
j1_b = [0 for i in range(13)]
j1_a = [0.0 for i in range(7)]
j2_b = [0 for i in range(13)]
j2_a = [0.0 for i in range(7)]
j1 = 0.0
j4 = 0
j51 = (0, 0)
j52 = (0, 0)