def Stream(): while (1): time.sleep(0.05) a = arm.GetYoloOutput() print(len(a)) if len(a) > 0: arm.DrawTargetsOnVideo(a)
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()
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)
import Arm as arm import numpy as np import cv2 arm.InitCom() add = arm.GetStreamAddress() print(add) arm.SendMessage(add) arm.InitYolo(add, "C:\\Users\\mt2si\\Documents\\RoboticArm\\yolo") while (1): a = arm.GetYoloOutput() print(a) arm.DrawTargetsOnVideo(a) arm.CloseCom()