From e9b42189b0375679dff3ced49301f37bfa04e18c Mon Sep 17 00:00:00 2001 From: Rishabh <32mathur@elmbrookstudents.org> Date: Sun, 27 Sep 2026 23:30:23 +0000 Subject: [PATCH] Add discovery-phase/missions/Mission 1-Rishabh --- discovery-phase/missions/Mission 1-Rishabh | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 discovery-phase/missions/Mission 1-Rishabh diff --git a/discovery-phase/missions/Mission 1-Rishabh b/discovery-phase/missions/Mission 1-Rishabh new file mode 100644 index 0000000..69d789f --- /dev/null +++ b/discovery-phase/missions/Mission 1-Rishabh @@ -0,0 +1,39 @@ +import umath +from pybricks.pupdevices import Motor, ColorSensor, UltrasonicSensor +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(700, 500, 300, 200) +drive_base.use_gyro(True) + +def set_speed(straight_speed, st_acc, turn_speed, turn_acc): + drive_base.settings(straight_speed, st_acc, turn_speed, turn_acc) + +set_speed(400,500,300,200) +drive_base.straight(950)#Was 950 +drive_base.turn(-35) +drive_base.straight(70)#Was 40 +drive_base.turn(-30) +set_speed(800,500,300,200) +drive_base.turn(30) +drive_base.straight(-60) +drive_base.turn(30)#Test Code-detelte if not working +drive_base.straight(-900) \ No newline at end of file