Exemplo n.º 1
0
def GetObject():
    global lastpos
    base = float(lastpos[1])
    compensation = float(lastpos[3])
    pos = "w"
    while (1):
        a = arm.GetYoloOutput()
        if len(a) > 0:
            pos = a[0][3]
            arm.DrawTargetsOnVideo(a)
            lock = arm.TryLockAtObject(a[0], 3, 40, res)
            if (lock == 1):
                base = base - 3
                compensation = compensation - 3
                arm.SetPosition(-1, base, -1, compensation, -1, -1)
                WaitForMove()
                trigger = arm.GetTriggerStatus()
                if (trigger == "1"):
                    break

    GetAndThrowiT(pos)
Exemplo n.º 2
0
                and last_center[1] >= center[1] - 2
                and last_center[1] <= center[1] + 2):
            conf = conf + 1
        else:
            conf = 0
        if (conf == 3):
            act_pos = arm.GetArmPosition()
            f_pos = BruteForcePos(distance)
            conf = 0
            arm.SetPosition(
                float(act_pos[0]) - 3, -1, f_pos[1] - 14.75, f_pos[2], -1, -1)
            WaitForMove()
            arm.SetPosition(-1, f_pos[0], -1, -1, -1, -1)
            WaitForMove()
            time.sleep(0.500)
            trigger = arm.GetTriggerStatus()

            if (trigger == "0"):
                arm.SetPosition(-1, -1, -1, f_pos[2] + 10, -1, -1)
                WaitForMove()
                time.sleep(0.500)
                trigger = arm.GetTriggerStatus()
                if (trigger == "0"):
                    arm.SetPosition(-1, -1, -1, f_pos[2] - 10, -1, -1)
                    WaitForMove()
                    time.sleep(0.500)
                    arm.Gripper(70)
                    WaitForMove()
                else:
                    arm.Gripper(70)
                    WaitForMove()