Esempio n. 1
0
def GetAndThrowiT(pos):
    if (pos == "h"):
        arm.SetPosition(-1, -1, -1, -1, 85, -1)
        WaitForMove()

    else:
        pos = arm.GetArmPosition()
        arm.SetPosition(-1, float(pos[1]) + 5, -1, -1, 160, -1)
        WaitForMove()
        arm.SetPosition(-1, -1, -1, -1, 160, -1)
        WaitForMove()
        arm.SetPosition(-1, float(pos[1]), -1, -1, 160, -1)
        WaitForMove()
        if (arm.GetTriggerStatus != "1"):
            arm.SetPosition(-1, float(pos[1]) - 2, -1, -1, 160, -1)
            WaitForMove()

    arm.Gripper(90)
    WaitForMove()
    arm.MovingSpeed(2)
    arm.SetPosition(-1, 80, -1, -1, -1, -1)
    WaitForMove()
    arm.SetPosition(6, 50, 80, 27, 85, -1)
    WaitForMove()
    arm.Gripper(20)
    WaitForMove()
    arm.SetPosition(lastpos[0], lastpos[1], lastpos[2], lastpos[3], lastpos[4],
                    lastpos[5])
    arm.MovingSpeed(5)
Esempio n. 2
0
def LookForObject():
    global ismove
    global lastpos
    while (ismove == 0):
        a = arm.GetYoloOutput()
        if len(a) > 0:
            arm.DrawTargetsOnVideo(a)
            arm.StopMovement()
            lastpos = arm.GetArmPosition()
            GetObject()
Esempio n. 3
0
        id = targets[0][2]
        arm.DrawTargetsOnVideo(targets)
        if distance == 0:
            distance = GetDistance(center[0], center[1])
            arm.SendMessage("distance = " + str(distance))

        arm.TryLockAtObject(center, 2, 25, res)

        if (last_center[0] >= center[0] - 2 and last_center[0] <= center[0] + 2
                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()
Esempio n. 4
0
    new_sck, addr = sck.accept()


def Receive():
    data = new_sck.recv(tcp_count).decode('UTF-8')
    return data


arm.InitCom()
arm.SendMessage("skript spusteny")
InitCom()
arm.SendMessage("clien pripojeny")

while (1):
    a = Receive()
    pos = arm.GetArmPosition()
    b = arm.IsMoving()
    print(b)
    if a == "0u":
        if b == 0:
            print("asd")
            arm.SetPosition(pos[0], (float(pos[1]) + 15), pos[2], pos[3],
                            pos[4], pos[5])
    elif a == "0d":
        if b == 0:
            arm.SetPosition(pos[0], (float(pos[1]) - 15), pos[2], pos[3],
                            pos[4], pos[5])
    elif a == "1d":
        if b == 0:
            arm.SetPosition(pos[0], pos[1], (float(pos[2]) - 20), pos[3],
                            pos[4], pos[5])