|
|
@ -30,7 +30,6 @@ class Candybot:
|
|
|
|
|
|
|
|
|
|
|
|
self.linearspeed = 100
|
|
|
|
self.linearspeed = 100
|
|
|
|
self.lastleinearspeed = 100
|
|
|
|
self.lastleinearspeed = 100
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CON_STR = {
|
|
|
|
CON_STR = {
|
|
|
|
dType.DobotConnect.DobotConnect_NoError: "DobotConnect_NoError",
|
|
|
|
dType.DobotConnect.DobotConnect_NoError: "DobotConnect_NoError",
|
|
|
@ -137,7 +136,7 @@ class Candybot:
|
|
|
|
|
|
|
|
|
|
|
|
def letgo(self):
|
|
|
|
def letgo(self):
|
|
|
|
print("drops\n")
|
|
|
|
print("drops\n")
|
|
|
|
#dType.SetEndEffectorGripper(self.api, 1, 0, isQueued=0)
|
|
|
|
dType.SetEndEffectorGripper(self.api, 1, 0, isQueued=0)
|
|
|
|
|
|
|
|
|
|
|
|
def stop(self):
|
|
|
|
def stop(self):
|
|
|
|
print("stops\n")
|
|
|
|
print("stops\n")
|
|
|
@ -169,18 +168,17 @@ class Candybot:
|
|
|
|
def setparams(self, name, speed):
|
|
|
|
def setparams(self, name, speed):
|
|
|
|
lookup = {'base' : 0, 'reararm' : 1, 'forearm' : 2, 'gripperroation' :3}
|
|
|
|
lookup = {'base' : 0, 'reararm' : 1, 'forearm' : 2, 'gripperroation' :3}
|
|
|
|
if name == 'rail':
|
|
|
|
if name == 'rail':
|
|
|
|
print("Change speed rail " + str(speed) +"\n" )
|
|
|
|
print("Change speed rail %d\n", speed)
|
|
|
|
#dType.SetJOGLParams(self.api, speed, 200, isQueued=0)
|
|
|
|
#dType.SetJOGLParams(self.api, speed, 200, isQueued=0)
|
|
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
speeds = [0,0,0,0]
|
|
|
|
speeds = [0,0,0,0]
|
|
|
|
speeds[lookup[name]] = speed
|
|
|
|
speeds[lookup[name]] = speed
|
|
|
|
print("change speed " + name + str(speed))
|
|
|
|
print("change speed" + name + "%d\n",speed)
|
|
|
|
#dType.SetJOGJointParams(self.api, speeds[0], 200, speeds[1], 200, speeds[2], 200, speeds[3], 200, isQueued = 1)
|
|
|
|
#dType.SetJOGJointParams(self.api, speeds[0], 200, speeds[1], 200, speeds[2], 200, speeds[3], 200, isQueued = 1)
|
|
|
|
|
|
|
|
|
|
|
|
def setJOGcmd(self, cmd):
|
|
|
|
def setJOGcmd(self, cmd):
|
|
|
|
print("Joint "+ str(cmd) + "is moving \n")
|
|
|
|
dType.SetJOGCmd(self.api,1,cmd)
|
|
|
|
#dType.SetJOGCmd(self.api,1,cmd)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
candy = Candybot()
|
|
|
|
candy = Candybot()
|
|
|
|
|
|
|
|
|
|
|
@ -257,37 +255,69 @@ def rt():
|
|
|
|
def lt():
|
|
|
|
def lt():
|
|
|
|
adjustSpeed(1, -5)
|
|
|
|
adjustSpeed(1, -5)
|
|
|
|
|
|
|
|
|
|
|
|
def fw():
|
|
|
|
|
|
|
|
adjustSpeed(2, 5)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def bc():
|
|
|
|
|
|
|
|
adjustSpeed(2, -5)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def up():
|
|
|
|
def up():
|
|
|
|
adjustSpeed(3, 5)
|
|
|
|
adjustSpeed(2, 5)
|
|
|
|
|
|
|
|
|
|
|
|
def dn():
|
|
|
|
def dn():
|
|
|
|
adjustSpeed(3, -5)
|
|
|
|
adjustSpeed(2, -5)
|
|
|
|
|
|
|
|
|
|
|
|
def lr():
|
|
|
|
def lr():
|
|
|
|
adjustSpeed(4, 10)
|
|
|
|
adjustSpeed(4, 10)
|
|
|
|
|
|
|
|
|
|
|
|
def ll():
|
|
|
|
def ll():
|
|
|
|
adjustSpeed(4, -10)
|
|
|
|
adjustSpeed(4, -10)
|
|
|
|
updateLoop()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updateLoop()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
#c = Candybot()
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
#def slide_left():
|
|
|
|
|
|
|
|
# c.linear(-1)
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
#def slide_right():
|
|
|
|
|
|
|
|
# c.linear(1)
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
#def rotate_left():
|
|
|
|
|
|
|
|
# c.base(-1)
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
#def rotate_right():
|
|
|
|
|
|
|
|
# c.base(1)
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
#def forward():
|
|
|
|
|
|
|
|
# c.forearm(1)
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
#def back():
|
|
|
|
|
|
|
|
# c.forearm(-1)
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
#def up():
|
|
|
|
|
|
|
|
# c.rearArm(1)
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
#def down():
|
|
|
|
|
|
|
|
# c.rearArm(-1)
|
|
|
|
|
|
|
|
#
|
|
|
|
def stopCmp():
|
|
|
|
def stopCmp():
|
|
|
|
candy.stopcmp()
|
|
|
|
candy.stopcmp()
|
|
|
|
|
|
|
|
|
|
|
|
def grab():
|
|
|
|
def grab():
|
|
|
|
candy.gripp()
|
|
|
|
candy.gripp()
|
|
|
|
|
|
|
|
# c.stopcmp()
|
|
|
|
|
|
|
|
#
|
|
|
|
def drop():
|
|
|
|
def drop():
|
|
|
|
candy.letgo()
|
|
|
|
candy.letgo()
|
|
|
|
|
|
|
|
# c.stopcmp()
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
def stop():
|
|
|
|
def stop():
|
|
|
|
candy.panic()
|
|
|
|
candy.panic()
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
#def getCurrentCmd():
|
|
|
|
|
|
|
|
# return c.getCurrentCmd()
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
#def updateLinearSpeed():
|
|
|
|
|
|
|
|
# pass
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|