Esempio n. 1
0
def noObstacle():

    tolerance = 700

    if (getObstacle()[0] < tolerance and getObstacle()[1] < tolerance
            and getObstacle()[2] < tolerance):
        return True
    else:
        return False


setName("OG_Loc")

print("Started")

functions.moveUntilBlocked(1, 800)
blocked = True

stepTime = 0.5
timeOffCourse = 0

while (blocked == True):
    functions.turn(90)
    functions.moveForward(1, stepTime)
    functions.turn(-90)

    timeOffCourse += stepTime

    printSensorVals()

    if (noObstacle()):
Esempio n. 2
0
from myro import *
import functions

print("Started")

def blocked():
       return (getObstacle()[0] > 1000)

functions.moveUntilBlocked(0.4, 1000)

r = 87

functions.turn(88)

slopeUp = False

if(blocked() == True):
       slopeUp = True

turnTolerance = 900

max = 20
sidesTraversed = 0
actions = 0

while(sidesTraversed != 3):
       
       if(sidesTraversed != 2):
       
              if(slopeUp == True):
                  clearanceTest = functions.limitedMoveUntilBlocked(0.4, turnTolerance, 20)
Esempio n. 3
0
    print(getObstacle())

def noObstacle():
    
    tolerance = 700
    
    if(getObstacle()[0] < tolerance and getObstacle()[1] < tolerance and getObstacle()[2] < tolerance):
        return True
    else:
        return False

setName("OG_Loc")

print("Started")

functions.moveUntilBlocked(1, 800)
blocked = True

stepTime = 0.5
timeOffCourse = 0;

while(blocked == True):
    functions.turn(90)
    functions.moveForward(1, stepTime)
    functions.turn(-90)
    
    timeOffCourse += stepTime
    
    printSensorVals()
    
    if(noObstacle()):
Esempio n. 4
0
from myro import *
import functions

print("Started")


def blocked():
    return (getObstacle()[0] > 1000)


functions.moveUntilBlocked(0.4, 1000)

r = 87

functions.turn(88)

slopeUp = False

if (blocked() == True):
    slopeUp = True

turnTolerance = 900

max = 20
sidesTraversed = 0
actions = 0

while (sidesTraversed != 3):

    if (sidesTraversed != 2):
Esempio n. 5
0
from myro import *
import functions

tolerance = 300

def blocked():
    return (getObstacle()[0] >= tolerance)

print("Started")

functions.moveUntilBlocked(0.2, 500) #move forward until an obstacle sensor reaches 500

while(blocked()):
    functions.turn(10)            #the robot will keep turning right until it becomes parallel with the box
    
functions.turn(50)                 #an additional little turn to avoid collisions with the box; now the robot should be parallel with the box's side 

timeOffCourse = 0
i = 0

for i in range(0, 2):             #go through the 'turn left when safe to do so' process twice

    turnBlocked = True            #assume turn is blocked

    while(turnBlocked):
        
        if(i == 0):
            timeOffCourse += 1      #if going laterally, add time spent going the other way later
        
        functions.moveForward(0.7, 1)   #move forward slightly
        functions.turn(-90)             #turn left