FirstSteps with Python


#1

Hi all,

i am doing my first steps with the dobot. I am trying tu run this script, but the dobot doesn’t move. I have copied the movment Code from a script out of the DobotStudio where it is working. Any hint?

Thnx and greetings

Christian

import DobotDllType as dType

api = dType.load()

errorString = [
‘Success’,
‘NotFound’,
‘Occupied’]

result = dType.ConnectDobot(api, “”, 115200)
print(“Connect status:”,errorString[result[0]])

if (result[0] == 0):
# Set command timeout
dType.SetCmdTimeout(api, 3000)
dType.SetPTPJointParams(api,200,200,200,200,200,200,200,200)
dType.SetPTPCoordinateParams(api,200,200,200,200)
dType.SetPTPJumpParams(api, 10, 200)
dType.SetPTPCommonParams(api, 100, 100)
while(True):
for i in range(5):
dType.SetPTPCmdEx(api, 2, 200, 10, 0, 0, 1)
dType.SetWAITCmdEx(api, 1, 1)
dType.SetPTPCmdEx(api, 2, 200, 10, (-10), 0, 1)
dType.SetWAITCmdEx(api, 1, 1)
dType.SetPTPCmdEx(api, 2, 300, 10, 0, 0, 1)
dType.SetWAITCmdEx(api, 0.1, 1)


#2

OK… what i found out is, that code generated by Blocky is not 100% usable.

goto x,y,z in Blocky will generate this line of code:

dType.SetPTPCmdEx(api, 2, 200, 10, 0, 0, 1)

but if i want to use it in Python directly (not the script in the DobotStudio) i Need to use:

dType.SetPTPCmd(api, 2, 200, 10, 0, 0)

It seems, that in Dobot Studio, the EX and the last Parameter is used to trigger the next line after reaching the Position… what is great. Any idear or hint how i can Archive this in Python directly?

Thx and greetings

Christian


#3

Anyone know answer to this question?