toplevel added

master
adligeerik 6 years ago
parent eafbee72ce
commit c4fd668de7

@ -184,13 +184,13 @@ currentMotor = 0
motorcfg = [0] * 10 motorcfg = [0] * 10
motorcfg[1] = {"name" : 'base' , "positive":1, "negative":2, 'speedslot':2} motorcfg[1] = {"name" : 'base' , "positive":1, "negative":2, 'speedslot':2}
motorcfg[2] = {"name" : 'reararm' ,"positive":3, "negative":4, 'speedslot':4} motorcfg[2] = {"name" : 'reararm' ,"positive":3, "negative":4, 'speedslot':4}
motorcfg[3] = {"name" : 'base' ,"positive":5, "negative":6, 'speedslot':6} motorcfg[3] = {"name" : 'forearm' ,"positive":5, "negative":6, 'speedslot':6}
friction = 0.99 friction = 0.95
movement_time = 5 movement_time = 3
max_movement_time = 10 max_movement_time = 5
min_speed = 1 min_speed = 1
max_speed = 50 max_speed = 100
speed = 0 speed = 0
stopTime = 0 stopTime = 0
@ -224,7 +224,7 @@ def stopMotorFunctions():
def updateLoop(): def updateLoop():
global nowTime, stopTime, currentMotor, speed, friction, min_speed, motorcfg global nowTime, stopTime, currentMotor, speed, friction, min_speed, motorcfg
nowTime = (time.time() - startTime) nowTime = (time.time() - startTime)
threading.Timer(0.2, updateLoop).start() threading.Timer(1, updateLoop).start()
if currentMotor != 0: if currentMotor != 0:
if nowTime > stopTime: if nowTime > stopTime:
@ -235,7 +235,7 @@ def updateLoop():
if abs(speed) < min_speed: if abs(speed) < min_speed:
stopMotorFunctions() stopMotorFunctions()
return return
candy.setparams(motorcfg[currentMotor]['name'], abs(speed))) candy.setparams(motorcfg[currentMotor]['name'], abs(speed))
#print("JOG parameter {} to {}".format( motorcfg[currentMotor]['speedslot'], abs(speed)) ) #print("JOG parameter {} to {}".format( motorcfg[currentMotor]['speedslot'], abs(speed)) )
@ -281,16 +281,20 @@ updateLoop()
#def down(): #def down():
# c.rearArm(-1) # c.rearArm(-1)
# #
#def grab(): def stopCmp():
# c.gripp() candy.stopcmp()
def grab():
candy.gripp()
# c.stopcmp() # c.stopcmp()
# #
#def drop(): def drop():
# c.letgo() candy.letgo()
# c.stopcmp() # c.stopcmp()
# #
#def stop():
# c.panic() def stop():
candy.panic()
# #
#def getCurrentCmd(): #def getCurrentCmd():
# return c.getCurrentCmd() # return c.getCurrentCmd()

Loading…
Cancel
Save