From 9788fae8cdbd368b88953843ccb75a833baf8f49 Mon Sep 17 00:00:00 2001 From: Rishabh <32mathur@elmbrookstudents.org> Date: Sun, 20 Sep 2026 22:11:53 +0000 Subject: [PATCH] Upload files to "discovery-phase/missions 3, 4, 5" --- .../missions 3, 4, 5/Mission 3, 4, & 5 | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 discovery-phase/missions 3, 4, 5/Mission 3, 4, & 5 diff --git a/discovery-phase/missions 3, 4, 5/Mission 3, 4, & 5 b/discovery-phase/missions 3, 4, 5/Mission 3, 4, & 5 new file mode 100644 index 0000000..7fedb23 --- /dev/null +++ b/discovery-phase/missions 3, 4, 5/Mission 3, 4, & 5 @@ -0,0 +1,42 @@ +#SETTING UP +import umath +from pybricks.pupdevices import Motor, ColorSensor, UltrasonicSensor, ForceSensor +from pybricks.parameters import Button, Color, Direction, Port, Side, Stop +from pybricks.tools import run_task, multitask +from pybricks.tools import wait, StopWatch +from pybricks.robotics import DriveBase +from pybricks.hubs import PrimeHub + +# Initialize hub and devices +hub = PrimeHub() +left_motor = Motor(Port.A, Direction.COUNTERCLOCKWISE) +right_motor = Motor(Port.B,Direction.CLOCKWISE) # Specify default direction +left_arm = Motor(Port.C, Direction.CLOCKWISE, [[12,36]],[[12,20,24]] ) # Specify default direction +right_arm = Motor(Port.D, Direction.CLOCKWISE,[[12,36],[12,20,24]]) #Added gear train list for gear ration +lazer_ranger = UltrasonicSensor(Port.E) +color_sensor = ColorSensor(Port.F) + +# DriveBase configuration +WHEEL_DIAMETER = 68.8 # mm (adjust for your wheels) +AXLE_TRACK = 180 # mm (distance between wheels) +drive_base = DriveBase(left_motor, right_motor, WHEEL_DIAMETER, AXLE_TRACK) +drive_base.settings(600, 450, 300, 200) +drive_base.use_gyro(True) + +#Run +drive_base.straight(550)#Works (600(Previous)) +drive_base.straight(-200) +drive_base.turn(45) +drive_base.straight(575) +drive_base.turn(-90)#-90 for Coach Cisco table +left_arm.run_angle(200,270) +drive_base.straight(300) +left_arm.run_angle(200,-265) +right_arm.run_angle(200, -200) +drive_base.straight(-105)#Use -105 for Coach Cisco table(-105 for school) +drive_base.turn(32)#was 24-Use 24 for Coach Cisco's table(32 for school) +right_arm.run_angle(1500, 180) +drive_base.turn(30) +drive_base.straight(-1000) + +