def checkIfHasStopped(): isStopped = False check1 = CamFunctions.getPanPos() time.sleep(0.1) check2 = CamFunctions.getPanPos() time.sleep(0.1) check3 = CamFunctions.getPanPos() if (check3 - check2)<=2.0 and (check2 - check1)<=2.0: isStopped = True return isStopped
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("Etat de la connexion / Connect status : {}] \n".format(CON_STR[state])) if (state == dType.DobotConnect.DobotConnect_NoError): # Run camera in order to retrieve the position of the green dot and the size of the region delimited by the red dots result, target, screen_size = Cfonct.run() # Initialize robot Dfonct.Init(api) # Get the height of the screen's plane z_min = Dfonct.Calc_Z_Min(api) Dfonct.Touch(api, z_min) # Launch robot calibration ecran = screen.screen(api, screen_size[0], screen_size[1]) # Convert the coordinates of the green dot to the robot's basis # Largeur x = target[1] # Longueur y = target[0]
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("Etat de la connexion / Connect status : {}] \n".format(CON_STR[state])) if (state == dType.DobotConnect.DobotConnect_NoError): # Run camera to retrieve the position of the graphical objects and the size of the screen. result, centroidsTouches, screen_size = Cfonct.run() # Initialize robot Dfonct.Init(api) # Get the height of the screen's plane z_min = Dfonct.Calc_Z_Min(api) Dfonct.Touch(api, z_min) # Launch robot calibration ecran = screen.screen(api, screen_size[0], screen_size[1]) input("Open the calculatrice app.\nPress Enter to continue...") # Touch all graphical objects detected for touche in centroidsTouches: x = touche[1]
# rgb, thermal video captures #cam_rgb = cv.VideoCapture("rtsp://192.168.2.233:8554/video0") cam_thrm = cv.VideoCapture("rtsp://192.168.2.233:8555/video1") prevPanPos = 0.0 # prevPanPos = moveCamera.getPanPos() # flag == 1 move right, flag == 2 move left moveFlag = 2 angle_cnt = 0 pos_cnt = 0 # list of static camera positions camPositions = [ 0.0, 23.0, 46.0, 69.0, 92.0, 115.0, 138.0] camPos_indx = 0 camPos_indx += 1 CamFunctions.setPanPos(camPositions[camPos_indx]) CamFunctions.setZeroPos() fireCnt = 0 fire_frame = [] y_FirePix = [] while 1: # check if camera has stopped before ask for image signal while not checkIfHasStopped(): # while False, sleep for 250 milliseconds time.sleep(.1) # read rgb, thermal image #retRgb, frameRgb = cam_rgb.read() retThrm, frameThrm = cam_thrm.read()
moveFlag = 2 angle_cnt = 0 pos_cnt = 0 droneFlag = 0 fireCnt = 0 # list of static camera positions camPositions = [0.0, 23.0, 46.0, 69.0, 92.0, 115.0, 138.0] camPositions = [ 50.0, 42.0, 36.0, 28.0, 20.0, 12.0, 4.0, 12.0, 20.0, 28.0, 36.0, 42.0, 50.0 ] camPos_indx = 0 cam_thrm.set(cv.CAP_PROP_POS_FRAMES, 0) CamFunctions.setPanPos(camPositions[camPos_indx]) retThrm, frameThrm = cam_thrm.read() #if frameRgb is None: #print("\nProblem with the rgb image signal...!\n") if frameThrm is None: print("\nProblem with the thermal image signal...!\n") cnt = 0 while 1: CamFunctions.setPanPos(camPositions[camPos_indx]) camPos_indx += 1 camPos_indx = camPos_indx % 13 time.sleep(1) CamFunctions.setTiltPos(8)
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("Etat de la connexion / Connect status : {}] \n".format(CON_STR[state])) if (state == dType.DobotConnect.DobotConnect_NoError): # Run camera and in case a keyboard was detected, retrieve what position to press to write 'hello world' result, hello_im, z_min, ecran = Cfonct.run(api) if hello_im is not None: # Write 'hello world' on the keyboard for b in hello_im: x = b[1] y = b[0] [xf, yf] = ecran.Calc_Coordinates(x, y) Dfonct.Movement(api, xf, yf, z_min + 20) Dfonct.Touch(api, z_min) #Disconnect Dobot dType.DisconnectDobot(api)
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("Etat de la connexion / Connect status : {}] \n".format(CON_STR[state])) if (state == dType.DobotConnect.DobotConnect_NoError): # Run camera in order to get the filename of the scenario to launch, as well as robot calibration parameters result, filename, z_min, ecran = Cfonct.run(api) print(filename) # Read scenario filename and execute it. screen_size = None scrolling = False x, y, u, v = -1, -1, -1, -1 if result: with open(filename, 'r') as File: for line in File: if line == "###BEGIN###\n": testing = True input("Press enter to start test.")