Dobot Magician get stuck while executing Home


#1

From time to time Dobot Magician gets stuck while executing Home command. It goes to his right most position and then stops and does not go to the desired home position. Below is my program, the problem also occurs with Dobot studio.

Right now the problem has occurred again. I have turned Dobot Magician off and disconnected the cables (power and USB). Then I connected the cables back and turned the Dobot on, ran Home on Dobot Studio, but it is still stuck on the right most position. On the Dobot Studio there is constantly running “Blockly loading”.

Please help.

def home():
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):
    try:
        #Clean Command Queued
        dType.SetQueuedCmdClear(api)

        #Async Motion Params Setting
        dType.SetHOMEParams(api, 200, 200, 200, 200, isQueued = 1)
        dType.SetPTPJointParams(api, 200, 200, 200, 200, 200, 200, 200, 200, isQueued = 1)
        dType.SetPTPCommonParams(api, 100, 100, isQueued = 1)

        #Async Home
        lastIndex = dType.SetHOMECmd(api, temp = 0, isQueued = 1)

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

        #Wait for Executing Last Command
        while lastIndex[0] > dType.GetQueuedCmdCurrentIndex(api)[0]:
            time.sleep(2)

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


    except Exception as e:
        print(e)
        #Stop to Execute Command Queued
        dType.SetQueuedCmdStopExec(api)
        #Disconnect Dobot
        dType.DisconnectDobot(api)
        exit()
    #Disconnect Dobot
    dType.DisconnectDobot(api)

if name == ‘main’:
home()


#2

After I couldn’t get it work again with Dobot Studio I tried with my program and it magically went to the Home position.

I need this Home command executed from time to time, because I do large number of tests on mobile phones. Sometimes the stepper motors apparently slip some steps. After Home command this is corrected.