# distance travelled is v*v/2a = 12000*12000/2*48000 = 1500
    rc.speed_accel_distance_m1(12000, 0, 0, 0)

    # that makes the total move in one direction 48000
    rc.speed_accel_distance_m2(12000, 0, 0, 0)

    buffers = (0, 0, 0)

    # Loop until distance command has completed
    while(buffers[1] != 0x80 and buffers[2] != 0x80):
        print("Buffers: ")
        print(buffers[1])
        print(" ")
        print(buffers[2])
        displayspeed()
        buffers = rc.ReadBuffers()

    time.sleep(1)

    rc.speed_accel_distance_m1(48000, -12000, 46500, 1)
    rc.speed_accel_distance_m2(48000, 12000, 46500, 1)

    # distance travelled is v*v/2a = 12000*12000/2*48000 = 1500
    rc.speed_accel_distance_m1(48000, 0, 0, 0)
    # that makes the total move in one direction 48000
    rc.speed_accel_distance_m2(48000, 0, 0, 0)

    buffers = (0, 0, 0)
    # Loop until distance command has completed
    while(buffers[1] != 0x80 and buffers[2] != 0x80):
        print("Buffers: ")
Exemple #2
0
else:
	print repr(version[1])

while(1):
	rc.SpeedAccelDistanceM1(address,12000,12000,42000,1);
	rc.SpeedAccelDistanceM2(address,12000,-12000,42000,1);
	rc.SpeedAccelDistanceM1(address,12000,0,0,0);  #distance travelled is v*v/2a = 12000*12000/2*48000 = 1500
	rc.SpeedAccelDistanceM2(address,12000,0,0,0);  #that makes the total move in one direction 48000
	buffers = (0,0,0)
	while(buffers[1]!=0x80 and buffers[2]!=0x80):	#Loop until distance command has completed
		print "Buffers: ",
		print buffers[1],
		print " ",
		print buffers[2]
		displayspeed();
		buffers = rc.ReadBuffers(address);
  
	time.sleep(1)

	rc.SpeedAccelDistanceM1(address,48000,-12000,46500,1);
	rc.SpeedAccelDistanceM2(address,48000,12000,46500,1);
	rc.SpeedAccelDistanceM1(address,48000,0,0,0);  #distance travelled is v*v/2a = 12000*12000/2*48000 = 1500
	rc.SpeedAccelDistanceM2(address,48000,0,0,0);  #that makes the total move in one direction 48000
	buffers = (0,0,0)
	while(buffers[1]!=0x80 and buffers[2]!=0x80):	#Loop until distance command has completed
		print "Buffers: ",
		print buffers[1],
		print " ",
		print buffers[2]
		displayspeed()
		buffers = rc.ReadBuffers(address)
                          distance1=int(distance),
                          speed2=int(speed),
                          distance2=int(distance),
                          buffer=int(1))
print "=== accelerate command issued ==="
rc.SpeedAccelDistanceM1M2(address=rc_address,
                          accel=int(655360),
                          speed1=int(0),
                          distance1=int(0),
                          speed2=int(0),
                          distance2=int(0),
                          buffer=int(0))
print "=== decelarate command issued ==="
buffers = (0, 0, 0)
while (buffers[1] != 0x80 and buffers[2] != 0x80):
    displayspeed()
    buffers = rc.ReadBuffers(rc_address)
    # time.sleep(0.01)
print "=== all commands complete =="

rc.ForwardBackwardM1(rc_address, 64)  # Stopped
rc.ForwardBackwardM2(rc_address, 64)  # Stopped

count = 0
while (count < 50):
    displayspeed()
    time.sleep(0.01)
    count += 1

print '=== experiment finished ==='