def trip3(): robot = Ev3Robot() #push all 13 blocks into the black circle robot.go_straight_forward(47.5) robot.go_straight_backward(cm=10, speed=20) robot.spin_right(90) #go back to home today robot.go_straight_backward(cm=40, speed=40)
def trip4(): robot = Ev3Robot() robot.read_calibration() # push innovative architecture, sustainability upgrade, and red block robot.go_straight_forward(cm=87) robot.dog_gear(degrees=180, motor=3, speed=-100) robot.spin_left(degrees=30) robot.go_straight_forward(cm=22) robot.align(t=15, direction=-1) robot.go_straight_forward(8.5) robot.spin_right(90) robot.go_straight_backward(22) robot.go_straight_forward(15) robot.go_straight_backward(82, 50, 3) robot.dog_gear(degrees=180, motor=3, speed=90) while True: robot.stop()
def trip2(): #defining robot = Ev3Robot() robot.read_calibration() # solving mission 6, traffic jam robot.go_straight_forward(cm = 67.5, speed=35) robot.go_straight_forward(cm = 10, speed=40) robot.spin_right(degrees = 8) sleep(0.1) robot.spin_left(degrees = 98) robot.go_straight_backward(cm = 10, speed=30) robot.align(5) robot.go_straight_forward(12, 30) robot.spin_right(60) robot.go_straight_forward(25, 35) robot.align(15) robot.go_straight_forward(20, 25) robot.spin_right(90) robot.go_straight_backward(6, 25) robot.align(15) robot.go_straight_forward(7, 25) robot.spin_left(90) robot.go_straight_forward(12, 25) # turns to flip elevator robot.spin_right(30) robot.go_straight_backward(15, 25) robot.spin_right(60) robot.go_straight_backward(8, 25) robot.align(15) robot.go_straight_forward(13, 25) robot.spin_left(50) # aligns at the safety factor robot.go_straight_forward(13, 25) robot.go_straight_forward(cm=7, speed=5) robot.go_straight_backward(2, 25) robot.spin_right(25, 20) robot.go_straight_backward(5, 25) robot.spin_right(20) robot.go_straight_backward(5, 25) robot.spin_right(50) robot.go_straight_forward(11,25) robot.spin_left(25) robot.go_straight_backward(12, 30) robot.spin_left(75) robot.go_straight_backward(180, 60)
def trip1(): # hangs the bat on the tree robot = Ev3Robot() robot.spin_right(35) robot.go_straight_forward(65.5) robot.spin_right(8, 25) robot.go_straight_backward(3.5) # deposits the blue block into the treehouse robot.dog_gear(motor=4, degrees=135, speed=-30) robot.go_straight_forward(2) robot.spin_left(15) robot.dog_gear(degrees=405, motor=4, speed=40) robot.spin_right(29) robot.go_straight_forward(9, 15) robot.dog_gear(degrees=250, motor=3, speed=-10) # raises the lever on the crane, releasing the blue block robot.go_straight_backward(39, speed=30) robot.spin_left(75) robot.go_straight_forward(24.5) robot.go_straight_forward(1, 5) robot.go_straight_backward(12) robot.spin_right(60, speed=40) robot.go_straight_backward(80, speed=55)
#!/usr/bin/env micropython from ev3_robot import Ev3Robot robot = Ev3Robot() robot.calibrate()
#!/usr/bin/env python3 from ev3_robot import Ev3Robot move = Ev3Robot() move.move_in_cm(centimeters=41, speed=20)