Пример #1
0
def routineMid():
    robot.sonarSpin(-angle)
    robot.followWallLeft(half-earlystop, diswall)
    robot.sonarSpin(-(90-angle)) # look at right wall 
    runToWallAt21()

    robot.turnRightDeg(90)
    distance = robot.getSonarSingle() - 21

    robot.sonarSpin((90-angle)) 

    robot.followWallLeft(distance,diswall)
    print "!! I AM AT POINT 1 !!"
    time.sleep(1)

    robot.sonarSpin(angle*2)
    robot.followWallBackwards(small,diswall)
    robot.turnLeftDeg(90)
    robot.followWallBackwards(full-earlystop, diswall)
    robot.sonarSpin((90-angle)) # look at right wall 
    runToWallAt21(-1)
   
    robot.turnLeftDeg(90)
    distance = robot.getSonarSingle() - 21 + 2 
    robot.sonarSpin(-(90-angle))

    robot.followWallBackwards(distance, diswall)
    print "!! I AM AT POINT 3 !!"
    time.sleep(1)

    robot.sonarSpin(-angle*2)
    robot.followWallLeft(small,diswall)
    robot.turnRightDeg(90)
    
    robot.followWallLeft(half/2,diswall)
    robot.sonarSpin(90+angle)
    distance = half_fromwall - robot.getSonarSingle()
    robot.sonarSpin(-(90+angle))
    robot.followWallLeft(distance, diswall)

    robot.turnRightDeg(90)

    robot.sonarSpin(-(90-angle)) # 
    runToWallAt21()

    print "!! I AM AT POINT 2 !!"
Пример #2
0
def routineMid():
    robot.sonarSpin(-angle)
    robot.followWallLeft(half - earlystop, diswall)
    robot.sonarSpin(-(90 - angle))  # look at right wall
    runToWallAt21()

    robot.turnRightDeg(90)
    distance = robot.getSonarSingle() - 21

    robot.sonarSpin((90 - angle))

    robot.followWallLeft(distance, diswall)
    print "!! I AM AT POINT 1 !!"
    time.sleep(1)

    robot.sonarSpin(angle * 2)
    robot.followWallBackwards(small, diswall)
    robot.turnLeftDeg(90)
    robot.followWallBackwards(full - earlystop, diswall)
    robot.sonarSpin((90 - angle))  # look at right wall
    runToWallAt21(-1)

    robot.turnLeftDeg(90)
    distance = robot.getSonarSingle() - 21 + 2
    robot.sonarSpin(-(90 - angle))

    robot.followWallBackwards(distance, diswall)
    print "!! I AM AT POINT 3 !!"
    time.sleep(1)

    robot.sonarSpin(-angle * 2)
    robot.followWallLeft(small, diswall)
    robot.turnRightDeg(90)

    robot.followWallLeft(half / 2, diswall)
    robot.sonarSpin(90 + angle)
    distance = half_fromwall - robot.getSonarSingle()
    robot.sonarSpin(-(90 + angle))
    robot.followWallLeft(distance, diswall)

    robot.turnRightDeg(90)

    robot.sonarSpin(-(90 - angle))  #
    runToWallAt21()

    print "!! I AM AT POINT 2 !!"
Пример #3
0
def routineRight():
    robot.sonarSpin(angle)
    robot.followWallBackwards(half/2, diswall)
    robot.sonarSpin(-(90+angle))
    distance = half_fromwall - robot.getSonarSingle()
    robot.sonarSpin(90+angle)
    robot.followWallBackwards(distance, diswall)
    robot.turnRightDeg(90)
    #turn sonar to wall and take measurement
    robot.sonarSpin(-(90+angle)) # i am looking at small wall
    runToWallAt21() 
    print "!! I AM AT POINT 2 !!"
    time.sleep(1)

    robot.forward(-42)
    robot.turnLeftDeg(90)
    robot.sonarSpin(90+angle)# turn back to look at left wall

    robot.followWallBackwards(half-earlystop, diswall)
    robot.sonarSpin(90-angle) # look at right wall 
    runToWallAt21(-1)

    robot.turnLeftDeg(90)
    distance = robot.getSonarSingle() - 21 + 2 
    robot.sonarSpin(-(90-angle)) #turn back for wall following

    robot.followWallBackwards(distance, diswall)
    print "!! I AM AT POINT 3 !!"
    time.sleep(1)

    robot.sonarSpin(-(angle*2))
    robot.followWallLeft(small,diswall)
    robot.turnRightDeg(90)
    robot.followWallLeft(full-earlystop, diswall)
    
    robot.sonarSpin(-(90-angle)) # look at right wall 
    runToWallAt21()

    robot.turnRightDeg(90)
    distance = robot.getSonarSingle() - 21
    robot.sonarSpin(90-angle) #turn back for wall following
    
    robot.followWallLeft(distance, diswall)
    print "!! I AM AT POINT 1 !!"
Пример #4
0
def routineRight():
    robot.sonarSpin(angle)
    robot.followWallBackwards(half / 2, diswall)
    robot.sonarSpin(-(90 + angle))
    distance = half_fromwall - robot.getSonarSingle()
    robot.sonarSpin(90 + angle)
    robot.followWallBackwards(distance, diswall)
    robot.turnRightDeg(90)
    #turn sonar to wall and take measurement
    robot.sonarSpin(-(90 + angle))  # i am looking at small wall
    runToWallAt21()
    print "!! I AM AT POINT 2 !!"
    time.sleep(1)

    robot.forward(-42)
    robot.turnLeftDeg(90)
    robot.sonarSpin(90 + angle)  # turn back to look at left wall

    robot.followWallBackwards(half - earlystop, diswall)
    robot.sonarSpin(90 - angle)  # look at right wall
    runToWallAt21(-1)

    robot.turnLeftDeg(90)
    distance = robot.getSonarSingle() - 21 + 2
    robot.sonarSpin(-(90 - angle))  #turn back for wall following

    robot.followWallBackwards(distance, diswall)
    print "!! I AM AT POINT 3 !!"
    time.sleep(1)

    robot.sonarSpin(-(angle * 2))
    robot.followWallLeft(small, diswall)
    robot.turnRightDeg(90)
    robot.followWallLeft(full - earlystop, diswall)

    robot.sonarSpin(-(90 - angle))  # look at right wall
    runToWallAt21()

    robot.turnRightDeg(90)
    distance = robot.getSonarSingle() - 21
    robot.sonarSpin(90 - angle)  #turn back for wall following

    robot.followWallLeft(distance, diswall)
    print "!! I AM AT POINT 1 !!"
Пример #5
0
# (273,21,-90), (525,21,-90), (21,21,-90)

startTime = datetime.now()
measurements = robot.turnSonarTakingMeasurements()

# Change sonar to move FASTAAAAAAAAAAAAR!
robot.setMotorAngleControllerParameters(robot.sonar_motor, fastParams)

# place.get_Loc(measurements)

robot.sonarSpin(-90)
toturn = robot.getMeanAngle(measurements) -13
toturn = toturn if toturn <= 180 else toturn - 360 

robot.turnLeftDeg(toturn)

robot.forward(disout)




#### ***Decide location
sonarRight = robot.getSonarMeasurements(1)[0]


robot.sonarSpin(-180)

sonarLeft = robot.getSonarMeasurements(1)[0]

if sonarRight > 30:
Пример #6
0
# (273,21,-90), (525,21,-90), (21,21,-90)

startTime = datetime.now()
measurements = robot.turnSonarTakingMeasurements()

# Change sonar to move FASTAAAAAAAAAAAAR!
robot.setMotorAngleControllerParameters(robot.sonar_motor, fastParams)

# place.get_Loc(measurements)

robot.sonarSpin(-90)
toturn = robot.getMeanAngle(measurements) - 13
toturn = toturn if toturn <= 180 else toturn - 360

robot.turnLeftDeg(toturn)

robot.forward(disout)

#### ***Decide location
sonarRight = robot.getSonarMeasurements(1)[0]

robot.sonarSpin(-180)

sonarLeft = robot.getSonarMeasurements(1)[0]

if sonarRight > 30:
    if sonarLeft > 30:
        position = "middle"
    else:
        position = "left"