Ejemplo n.º 1
0
def angleAdjust(dist_target):
    QR_FOUND = True
    image_data = IT.takeImage()
    if image_data == []:
        QR_FOUND = False
        final_dist = dist_target
    elif QR_FOUND:
        dist_target = IT.getQRdist(image_data)  #cm
        theta = IT.getAngle(image_data)
        print("theta1 = ", theta)
        Motors.turnDegrees(theta)
        time.sleep(1)
    time.sleep(2)
    print("QR FOUND from angle = ", QR_FOUND)
    return (QR_FOUND, dist_target)
Ejemplo n.º 2
0

# def QRdistance(h):
#   F = 50*274/7.1
#   d = 7.1*F/h -8
#   return d

# initialise variables
mtr_speed = 10  #cm/s
turn_inc = 10  #degrees
min_obj_IRdist = 50  #cm
min_obj_Ultradist = 30  #cm
evade_dist = 10  #cm
# Define final goal

final_dist = IT.getQRdist(IT.takeImage())  #cm
print("final_dist = ", final_dist)
dist_target = final_dist  # Initialise the distance from the Jankanator to the flagpole

# Initial states
AVOIDING = False  # Status of the Jankanator while it is avoiding an object
target_timer = False  # Timer used to record time elapsed while moving in the avoiding stage -> Initialise to off
AVOIDING_TIMER = False  # Timer used to record time elapsed while moving towards target -> Initialise to off
dist_moved_calc = False  # Initialise
INITIAL_EVADE = False  # When an object is sensed the first manouever is to move 10cm in the clear direction and then run checks on the left ir

# Initialise orientation, turning increment
orig_orient = 0  # degrees -> Facing the target
orient = orig_orient  #initialise

# Start engine
Ejemplo n.º 3
0
from micromelon import *
from micromelon.comms_constants import MicromelonType as OPTYPE
import math
#from picamera.array import PiRGBArray
#from picamera import PiCamera
from timeit import default_timer as timer
import time
import cv2
import time
import numpy as np
import timeit
from pyzbar import pyzbar
import imageTester as IT

rc = RoverController()
rc.connectIP()
data = IT.takeImage()
dist = IT.getQRdist(data)
print("dist = ", dist)
angle = IT.getAngle(data)
print("theta = ", angle)

# phi = [360/8 for i in range(8)]
# print(phi)
# for i in phi:
#   Motors.turnDegrees(i)