else:
		pass
	sys.exit(0)

def parse_input():
	args = sys.argv
	if len(args) != 4:
		exit_msg(0)
	try:
		addr = int(args[1])
		speed = int(args[2])
		turning = int(args[3])
	except ValueError as e:
		exit_msg(0)
	return (addr, speed, turning)

if __name__ == '__main__':
	addr, speed, turning = parse_input()
	print parse_input()
	try:
		packet = BogiePacket(addr, speed, turning)
		packet2 = BogiePacket(addr, turning, speed)
	except ValueError as e:
		exit_msg(1)

	bus = serial.Serial(port='/dev/ttyO4',
				baudrate=115200)

	bus.write(packet.msg())
	print str(packet)
def go(bus, addr, speed, turning):
    packet = BogiePacket(addr, speed, turning)
    bus.write(packet.msg())
    print str(packet)
        pass
    sys.exit(0)


def parse_input():
    args = sys.argv
    if len(args) != 4:
        exit_msg(0)
    try:
        addr = int(args[1])
        speed = int(args[2])
        turning = int(args[3])
    except ValueError as e:
        exit_msg(0)
    return (addr, speed, turning)


if __name__ == '__main__':
    addr, speed, turning = parse_input()
    print parse_input()
    try:
        packet = BogiePacket(addr, speed, turning)
        packet2 = BogiePacket(addr, turning, speed)
    except ValueError as e:
        exit_msg(1)

    bus = serial.Serial(port='/dev/ttyO4', baudrate=115200)

    bus.write(packet.msg())
    print str(packet)
        print "Needs speed in format: python rampingtest.py 20 where 20 is in ms"
    return burstSpeed

if __name__ == '__main__':
    bus = serial.Serial(port='/dev/ttyO4',
                        baudrate=115200)
    start_time = time.time()
    burstSpeed = float(grabBurstSpeed()) / 1000
    speed_list = []
    count = 0
    for x in range(1, 128):
        speed_list.append(x)
    for x in reversed(range(1, 127)):
        speed_list.append(x)
    for x in range(3):
	speed_list.append(0)
    for speed in speed_list:
        #for wheelAddr in reversed(range(2, 4)):
        for addr in range(2,8):
		go(bus, addr, speed, 0)
        if (time.time() - start_time) > 1:
            # Send still alive message
            packet = BogiePacket(1, 17, 0)
            print str(packet)
            packet = packet.msg()
            bus.write(packet)
            start_time = time.time() # Reset timer
        for wheelAddr in reversed(range(2, 8)):
        	go(bus, wheelAddr, speed, 0)
        time.sleep(burstSpeed)
예제 #5
0
def go(bus, addr, speed, turning):
    packet = BogiePacket(addr, speed, turning)
    bus.write(packet.msg())
    print str(packet)
예제 #6
0
        print "Needs speed in format: python rampingtest.py 20 where 20 is in ms"
    return burstSpeed


if __name__ == '__main__':
    bus = serial.Serial(port='/dev/ttyO4', baudrate=115200)
    start_time = time.time()
    burstSpeed = float(grabBurstSpeed()) / 1000
    speed_list = []
    count = 0
    for x in range(1, 128):
        speed_list.append(x)
    for x in reversed(range(1, 127)):
        speed_list.append(x)
    for x in range(3):
        speed_list.append(0)
    for speed in speed_list:
        #for wheelAddr in reversed(range(2, 4)):
        for addr in range(2, 8):
            go(bus, addr, speed, 0)
        if (time.time() - start_time) > 1:
            # Send still alive message
            packet = BogiePacket(1, 17, 0)
            print str(packet)
            packet = packet.msg()
            bus.write(packet)
            start_time = time.time()  # Reset timer
        for wheelAddr in reversed(range(2, 8)):
            go(bus, wheelAddr, speed, 0)
        time.sleep(burstSpeed)