Esempio n. 1
0
                angleOrientation = abs(360 - angleOrientation)
            if angleOrientation < 180:
                controleurDeplacement.rotationAHoraire(angleOrientation, 0.5)
            else:
                angleOrientation = abs(360 - angleOrientation)
                controleurDeplacement.rotationHoraire(angleOrientation, 0.5)
            controleurCamera.set_camera_angle_x(90)
            controleurCamera.set_camera_angle_y(20)

            photo = cameraRobot.prendrePhoto()
            cv2.imshow('photo',photo)
            cv2.waitKey(0)
            distanceAjuste = 1000
            distanceAStation = 0
            while distanceAjuste > 30:
                distanceAjuste,distanceAStation = ajustement.determineAjustement(photo, 90, positionXRobot, positionYRobot, repereX, repereY, ratioCMPixel)
                if distanceAjuste < 0:
                    controleurDeplacement.gauche(distanceAjuste * ratioCMPixel, 0.3)
                else:
                    controleurDeplacement.droite(distanceAjuste * ratioCMPixel, 0.3)

                direction = orientationRobot % 180
                erreurAngle = 30
                piAngle = 90
                if direction < erreurAngle and direction > -erreurAngle:
                    positionYRobot = positionYRobot - distanceAjuste
                elif direction < piAngle + erreurAngle and direction > piAngle - erreurAngle:
                    positionXRobot = positionXRobot - distanceAjuste

            if distanceAStation < 0:
                distanceAStation = abs(distanceAStation)
Esempio n. 2
0
            directionAjustement = 1000
            distanceAavantAjustement = 0
            distanceUnPasAjustement = 0.5
            vitesseDeplacement = 0.3

            deltaX = 10
            deltaY = 900

            voltageMaximum = 4.5
            perimetreMinimum = 400
            perimetreMaximum = 800

            while abs(directionAjustement) > deltaX or distanceAavantAjustement < deltaY:
                photot = None
                photot = cameraRobot.prendrePhoto()
                directionAjustement, distanceAavantAjustement = ajustement.determineAjustement(photot,localisationTresor.haut_vert,localisationTresor.bas_vert, perimetreMinimum, perimetreMaximum)
                print(distanceAavantAjustement, directionAjustement)
                if directionAjustement < 0 and abs(directionAjustement) > deltaX:
                    controleurDeplacement.gauche(distanceUnPasAjustement, vitesseDeplacement)
                elif abs(directionAjustement) > deltaX:
                    controleurDeplacement.droite(distanceUnPasAjustement, vitesseDeplacement)
                if distanceAavantAjustement < deltaY:
                    controleurDeplacement.avancer(distanceUnPasAjustement, vitesseDeplacement)
                    distanceAvance += distanceUnPasAjustement

            code = decodeur.demanderCode()
            demande = 'https://192.168.1.2/?code=' + code
            while reponse == '':
                try:
                    reponse = requests.get(demande, 443, verify = False)
                except: