Im having an issue where the uARM extends as far as possible once in a while, probably once every 300 movements (estimation). The uARM continues to do the rest of the movements normally however I would like to figure out why the uARM extends like this as I dont want it to potentially hit something it shouldnt…
EDIT: another key piece of information is that this happend when I disconnect/reconnect the uarm.
I am using pyuarm library in python to move the uarm according to a list of predefined coordinates. This is preformed in a loop.
Code below:
`
try:
uarm = pyuarm.uArm(debug=False)
except:
print 'Could not communicate to uARM, com port may be in use. '
if uarm.is_connected():
uarm.detach_all_servos()
with open(log_file) as f:
lines = [line.rstrip('\n') for line in f]
uarm.attach_all_servos()
while True:
time.sleep(2.0)
for i in lines:
if lines.index(i)== 0:
origin = i.split(',') #Remember the first set of coordinates as they are the starting position
x = i.split(',')
print 'Moving to: ' + str(x[0]) + ',' + str(x[1]) + ',' + str(x[2])
time.sleep(0.0)
uarm.move_to(x=float(x[0]), y=float(x[1]), z=(float(x[2])), time_spend=0.2)
print 'Next'
time.sleep(0.1)
uarm.move_to(x=float(origin[0]),y=float(origin[1]),z=float(origin[2]), time_spend=0.2) #Move uarm to starting position at the end of the list.
break
time.sleep(5.0)
time.sleep(1)
count = read_results(sys.path[0] + '\quartzlog.txt')
uarm.disconnect()
if count == 24:
print 'pass'
return 1
else:
print 'Fail'
return 0