Gripper API Issue in Python


#1

Hello,

Basic DobotControl.py is working while I have edited this basic example as below and added gripper API which is not responding.

Can anyone tell me what could be possible reason behind this ?

import threading
import math
import DobotDllType as dType

CON_STR = { 
    dType.DobotConnect.DobotConnect_NoError:  "DobotConnect_NoError",
    dType.DobotConnect.DobotConnect_NotFound: "DobotConnect_NotFound",
    dType.DobotConnect.DobotConnect_Occupied: "DobotConnect_Occupied"}

#Load Dll 
api = dType.load()

#Connect Dobot
state = dType.ConnectDobot(api, "/dev/ttyUSB0", 115200)[0]
print("Connect status:",CON_STR[state])

if (state == dType.DobotConnect.DobotConnect_NoError):

    #Clean Command Queued
    dType.SetQueuedCmdClear(api)

    lastIndex = dType.SetPTPCmd(api, dType.PTPMode.PTPMOVLXYZMode, 147, -12, 134, 0, 1)
    dType.SetEndEffectorGripper(api, 1,  0, isQueued=1) # Gripper On, Both End Open
    dType.SetEndEffectorGripper(api, 1,  1, isQueued=1) # Gripper On, Both end Close
    dType.SetEndEffectorGripper(api, 1,  0, isQueued=1) # Gripper On, Both end Open
    dType.SetEndEffectorGripper(api, 0,  0, isQueued=1) # Gripper Off, Both End Open
    lastIndex = dType.SetPTPCmd(api, dType.PTPMode.PTPMOVLXYZMode, 292, 012, 134, 0, 1)

    #Start to Execute Command Queued
    dType.SetQueuedCmdStartExec(api)

    #Wait for Executing Last Command
    while lastIndex > dType.GetQueuedCmdCurrentIndex(api)[0]:
        dType.dSleep(2000)

    #Stop to Execute Command Queued
    dType.SetQueuedCmdStopExec(api)

#Disconnect Dobot
dType.DisconnectDobot(api)

#2

Try putting the gripper instruction to immediate and give a delay for each gripper instruction. And set setendeffectorparams.