import threading import DobotDll.DobotDllType as dType import random from pynput import keyboard from pynput.keyboard import KeyCode 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, "", 115200)[0] print("Connect status:", CON_STR[state]) if (state == dType.DobotConnect.DobotConnect_NoError): #Clean Command Queued dType.SetQueuedCmdClear(api) #Async Motion Params Setting dType.SetHOMEParams(api, 172, -120, 50, 0, isQueued=1) dType.SetPTPJointParams(api, 200, 200, 200, 200,
import time from DobotDll import DobotDllType as dType CON_STR = { dType.DobotConnect.DobotConnect_NoError: "DobotConnect_NoError", dType.DobotConnect.DobotConnect_NotFound: "DobotConnect_NotFound", dType.DobotConnect.DobotConnect_Occupied: "DobotConnect_Occupied" } api = dType.load() # Load Dll postion = [237.7514, 49.2358, -25.7501, 7.1569] def init(speed=100, coordinate=4000): dType.SetQueuedCmdClear(api) dType.SetPTPJointParams(api, 200, 200, 200, 200, 200, 200, 200, 200, isQueued=1) # dType.SetPTPJointParams(api, speed, speed, speed, speed, speed, speed, speed, speed, isQueued=1) dType.SetPTPCoordinateParams(api, coordinate, coordinate, coordinate, coordinate, isQueued=1)