示例#1
0
def line_follow_right(time):
    sec = seconds()
    while (seconds() - sec < time):
        if (u.onBlackFront()):
            drive(60, 55)
        else:
            drive(55, 60)
    drive(0, 0)
示例#2
0
def line_follow_left(time):
    sec = seconds()
    while (seconds() - sec < time):
        if (u.onBlackFront()):
            drive(40, 70)  #was 45
        else:
            drive(70, 40)  #was 45
    drive(0, 0)
示例#3
0
def lineFollowConditionSlow(testFunction, state):
    print "lineFollowCondition"
    while testFunction() is state:
        if (u.onBlackFront()):
            drive(60, 45)
        else:
            drive(45, 60)
    drive(0, 0)
示例#4
0
def lineFollowCondition(testFunction, state):
    print "lineFollowCondition"
    while testFunction() is state:
        if (u.onBlackFront()):
            drive(70, 100)
        else:
            drive(100, 70)
    drive(0, 0)
示例#5
0
def lineFollowRight(time):  #robot is to the right of the line
    sec = seconds()
    while(seconds()-sec<time):
        if(u.onBlackFront()):
            drive(60,45)
        else:
            drive(45,60)
    drive(0,0)
示例#6
0
def lineFollowLeft(time): #robot is to the left of the line
    sec = seconds()
    while(seconds()-sec<time):
        if(u.onBlackFront()):
            drive(45,60)#was 45
        else:
            drive(60,45) #was 45
    drive(0,0)