def btn_alarm_check_clear_f(id_, btn):
    print(dType.GetAlarmsState(api, id_))
    #TODO 1st: check AlarmsState, mark color btn, 2nd press if marked red - clear
    #btn.setStyleSheet("background-color: #00ff00")
    dType.ClearAllAlarmsState(api, id_)

    print("after clear", dType.GetAlarmsState(api, id_))
def btnHome_f(id_, btn=None):
    #print (id_, id_nms_default[id_])
    if (id_ == id_m1):  #do not home m1, only clear err !!TODO and goto initial
        dType.ClearAllAlarmsState(api, id_)
        m1.movJ([-5, -5, None, None])
        return

    if (btn is not None):
        tskStart_mark(btn, id_)
    dType.ClearAllAlarmsState(api, id_)
    dType.SetQueuedCmdClear(api, id_)
    dType.SetHOMECmdEx_mon(api, id_, 1, 1)
    dobotStates[id_].posHome = dType.GetPose(api, id_)
    #dType.printPos(api, id_,0, 0, 0, 0, True)
    if (btn is not None):
        tskEnd_mark(btn)
def connectDobot(id_, id_nm, c, checkbox, label, bRail=False):

    checkbox.setChecked(id_ != -1)  # TODO mark red if fail connect COM
    label.setText(str(id_))  # f'{10}'

    onNow = False
    if id_ > -1:
        onNow = True
        dType.SetQueuedCmdClear(api, id_)
        dType.SetQueuedCmdStartExec(api, id_)
        dType.ClearAllAlarmsState(api, id_)
        dType.SetPTPCommonParams(
            api, id_, 40, 30, 1)  #??Ex #speed, acceleration max is 100, 1000

    if (id_ == -1):
        id_ = id_default(
            id_nm)  #initial id, for debug or create functions w.o robots

    dobotStates[id_] = DobotState(id_nm, id_, c, onNow, bRail)
    '''
	   
    dType.SetQueuedCmdClear(api)  #Clean Command Queued

    #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)

    dType.SetHOMECmd(api, temp = 0, isQueued = 1)
	
	dType.DisconnectDobot(api)
	'''

    #print(dType.GetDeviceName(api, id_))
    return dobotStates[id_], id_
def btnStop_f(id_):
    tskMarks_clear_all(True)

    queue_clear(thread_m1_queue)
    queue_clear(thread_magL_queue)
    queue_clear(thread_magR_queue)

    dType.SetQueuedCmdForceStopExec(api, id_)
    dType.ClearAllAlarmsState(api, id_)
Пример #5
0
    #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)

        dType.SetPTPJointParams(api, 100, 100, 100, 100, 100, 100, 100, 100)
        dType.SetPTPCoordinateParams(api, 200, 200, 200, 200)
        dType.SetPTPCommonParams(api, 100, 100)
        dType.SetPTPJumpParams(api, 20, 200)
        dType.SetHOMEParams(api, 180, -19, 42, -6, isQueued=1)
        # dType.SetPTPJumpParams(api,40,30,isQueued=1)

        dType.ClearAllAlarmsState(api)
        dType.SetQueuedCmdStartExec(api)

        x3 = homex
        y3 = homey
        z3 = homez
        r3 = 0
        #箱子上方
        x4 = x3
        y4 = y3
        z4 = -28
        r4 = 0
        #箱子里

        #移动到home处,将机械臂移除视野
        dType.SetPTPCmd(api,