Exemplo n.º 1
0
def gyroRight (degrees):
    startingAngle = gyro.angle()
    finishAngle = startingAngle + degrees
    print("Right --> Starting at: " + str(startingAngle) + " need to turn " + str(degrees) + " Will stop at: " + str(finishAngle))

    turnSpeed = 150
    while gyro.angle() <= finishAngle:
            r_DriveMotor.run(-1 * turnSpeed)
            l_DriveMotor.run(turnSpeed)
    driver.stop()
Exemplo n.º 2
0
def run4():#creats a function for run 4
    driver.stop() #stops for membory problem
    driver.settings(straight_speed=500) #definig straight speed
    driver.straight(600) #going straight to get out near sc
    driver.stop() #stoping to try and drop
    driver.straight(150) #goes forward more; closer to the step counter
    driver.stop()#trys to drop again just incase
    driver.straight(600) #dives all the way back to push back the stepcounter
    driver.stop() #stops
    driver.straight(-1300) #drives back to hime
Exemplo n.º 3
0
def run3():
    driver.straight(-10) #making run three a function for main to cut down on start up time
    driver.stop()
    driver.settings(straight_speed=400) #setting the speed when you go straight to always be 200
    driver.straight(300)
    driver.stop()
    gyroRight(6)
    driver.straight(125) #goes straight to bench driving health units and innovation challenge
    door.run_until_stalled(300)
    driver.stop() #stops
    gyroLeft(130)
    driver.stop() #stops for gyro
    #gyroRight(10)
    #driver.straight(-350) #drives backwards to home
    #driver.stop()
    #gyroLeft(70)
    driver.straight(550)
    driver.stop() #stops to end program
Exemplo n.º 4
0
def run1():
    driver.settings(straight_speed=450)
    ev3.speaker.beep()  # notify done
    # drive until black
    gyro.reset_angle(0)
    driver.stop()
    driver.straight(75)
    driver.stop()
    gyroRight(79)
    driver.stop()
    driver.straight(1450)
    driver.stop()
    gyroRight(80)
    driver.straight(250)
    driver.straight(-150)
    driver.stop()
    gyroRight(85)
    driver.straight(-250)
    driver.stop()
    driver.settings(straight_speed=500)
    l_DriveMotor.run_time(-500, 4300)
    driver.stop()
    driver.straight(260)
    driver.stop()
    gyroLeft(50)
    driver.straight(200)
    driver.straight(-160)
    driver.stop()
    gyroRight(88)
    driver.straight(2000)
Exemplo n.º 5
0
def run5():
    #reset gyro
    gyro.reset_angle(0)
    driver.settings(straight_speed=350)
    driver.straight(-10)
    #positioned the robot for the run
    driver.straight(100)
    driver.stop()
    gyroRight(53)
    driver.stop()
    # find the black line and turns to go straight back
    driver.straight(410)
    driver.stop()
    gyroLeft(53)
    driver.stop()
    driver.straight(325)  #drives straight to be parrallle to bball hoop
    driver.stop()
    gyroLeft(28)  #turn to bball hoop
    driver.stop()
    driver.settings(straight_speed=100)
    driver.straight(187)  #goes to bball hoop
    driver.straight(-50)
    driver.stop()  #stop because its important
    gyroRight(gyro.angle() * -0.91)  #turns over to botci
    driver.stop()
    driver.settings(straight_speed=150)
    driver.straight(70)  #goes to botchi tipping red cube out
    driver.stop()
    driver.straight(-75)  #backs up from botchi
    driver.stop()
    driver.settings(straight_speed=350)
    gyroRight(90)  #turns to be paralelle to dance floor
    driver.stop()
    driver.straight(320)  #goes to be next to dance floor
    driver.stop()
    gyroLeft(90)  #turns to dance floor
    driver.straight(150)  #
    while True:  #basicly a forever loop
        driver.straight(20)  #danceeeee like theres no tommorow
        driver.stop()
        gyroRight(180)
        driver.stop()
        driver.straight(-20)
        driver.straight(10)
        driver.stop()
        gyroLeft(140)
        driver.stop()
        gyroRight(100)
        driver.stop()
        gyroLeft(90)
        driver.straight(10)
        ev3.speaker.set_volume(
            100)  #telling the speker to talk at volume 100 aka 100%
        ev3.speaker.set_speech_options(
            language='el', voice='f3',
            speed=60)  #settieng the accent to greek the
        #voice to female and the speed 100 wpm
        ev3.speaker.say("bootsandcatsaandbootsandcats"
                        )  #telling it to say whatever we want
Exemplo n.º 6
0
def run2():
    driver.settings(straight_speed=450)
    driver.straight(250)
    driver.straight(-140)
    driver.stop()
    gyroRight(85)
    driver.straight(-250)
    driver.stop()
    driver.settings(straight_speed=500)
    l_DriveMotor.run_time(-600, 4000)  #runs treadmill
    driver.stop()
    driver.straight(260)  #gets off treadmill
    driver.stop()
    gyroLeft(70)  #facing wall
    driver.straight(200)
    driver.straight(-160)
    driver.stop()
    gyroRight(87)  #facing home
    driver.straight(300)
    driver.stop()
    while r_color.reflection() < 90:
        driver.drive(150, 0)
    driver.stop()
    driver.straight(150)
    driver.stop()
    #run2 starts
    driver.settings(straight_speed=450)
    gyroLeft(90)
    driver.straight(350)  #wall square
    driver.straight(-690)
    driver.stop()
    driver.settings(straight_speed=300)
    dumper.down(350, 95)  #moves dumper down 90% to dump blocks
    #driver.straight(470) #move forward to GO UNDER BRIDGE
    #driver.straight(-375) #goes backwards go go back to target
    driver.stop()
    driver.straight(100)
    dumper.up(300, 30)  #dumper moves up 30% to get lined up with flip
    #moves forward to be at right distance to flip
    driver.stop()  #stops for gyro
    gyroRight(30)  #turns to line up wiht flip
    driver.straight(-55)  #backward so flip is in dump and turn flip
    driver.straight(
        10)  #forward for +special effects+ (also so we knock flip sligly)
    dumper.run_until_stalled(100)
    driver.straight(50)  #goes forward to finish the dump
    driver.stop()
    driver.settings(straight_speed=500
                    )  #changing the speed so its faster to cut down on time
    #(we get speedy)
    driver.stop()  #stops for gyro
    gyroRight(20)  #turns overso we are in line with the slide
    driver.stop()  #stops because its inportant to do that
    driver.straight(30)  #goes forward so we are by the slide
    driver.stop()
    pct = door.up(300, 48)
    print("PCT: " + str(pct))
    while pct <= 47.5:
        driver.straight(-20)
        driver.stop()
        pct = door.up(500, 48 - pct)
        print("PCT: " + str(pct))
    driver.stop()
    driver.straight(95)  #goes straight to actually knock them down
    driver.stop()
    driver.straight(
        -120)  #goes backwards so we down hurt our robot by turning them
    driver.stop()
    door.down(100, 45)  #brings door down so we don't accidently hit something
    dumper.run_until_stalled(
        300)  #brings dump up becuse we don't want to forget and get penilized
    driver.stop()
    gyroRight(41)  #turns so we are facing bench/baskitball area
    driver.straight(440)  #drives so we are parallel
    driver.stop()  #stops because the gyro dosn't like us when we don't
    gyroLeft(88)  #turns so we are facing little dudes
    driver.settings(straight_speed=250)
    door.up(100, 80)  #brings door up to prepare to trap little dudes
    driver.straight(530)  #drives forward to trap little dudes
    driver.stop()
    driver.settings(straight_speed=400)
    door.down(100, 80)  #now actually finally traps little dudes
    gyroRight(80)  #turns right to face home
    driver.straight(803)  #drives into home
Exemplo n.º 7
0
def runB():
    driver.settings(straight_speed=450)
    driver.stop()
    driver.straight(-10)
    ev3.speaker.beep() # notify done
    gyro.reset_angle(0)
    driver.stop()
    driver.straight(80)
    driver.stop()
    gyroRight(79)
    driver.stop()#turrning out to face challange zone
    driver.straight(1380)#getting out to zone
    driver.stop()
    gyroLeft(80)
    driver.straight(300)
    driver.stop()
    while r_color.reflection()>10:#sensing white by weight machine 
        driver.drive(200,0)
    driver.stop()
    driver.straight(20)
    driver.stop()
    driver.straight(80)
    driver.stop()
    gyroRight(80)
    while l_color.reflection()>12:#
        driver.drive(200,0)
    driver.stop()
    door.up(300,95)#door up
    driver.stop()
    gyroLeft(78)#turn so door is over weight machine
    driver.settings(straight_speed=350)
    pct = door.down(300,95)
    print("PCT: " + str(pct))
    while pct >= 20:
        door.up(300,30)
        gyroLeft(2)
        pct = door.down(300,70)
        print("PCT: " + str(pct))
    #door down to get machine
    driver.stop()
    gyroRight(93)
    door.run_until_stalled(500)
    driver.stop()
    driver.straight(500)#wall square
    while l_color.reflection()<85:#goes back to white line
        driver.drive(-200,0)
    driver.stop()
    gyroRight(52)#turns to row machine
    door.up(300,30)
    driver.straight(190)#does row
    driver.stop()
    door.down(300,25)
    driver.stop()
    gyroRight(55)
    driver.straight(-10)#finishes row
    driver.stop()
    door.run_until_stalled(-300)
    driver.straight(-50)
    driver.stop()
    gyroRight(35)
    driver.stop()
    driver.straight(250)
    driver.stop()
    gyroLeft(63)
    door.run_until_stalled(300)
    while l_color.reflection()<85:
        driver.drive(300,0)
    driver.stop()
    gyroLeft(55)
    driver.stop()
    driver.straight(100)
    driver.stop()
    gyroRight(50)
    driver.straight(200)
    driver.stop()