From 08fa18fc727d34110d646f51677e078a93895846 Mon Sep 17 00:00:00 2001 From: nifrali Date: Sun, 20 Sep 2026 14:56:22 -0500 Subject: [PATCH 01/36] folder structure commit --- shout-fll-scrimmage/main.py | 6 ++++++ shout-fll-scrimmage/missions/mission_1_2_3.py | 1 + 2 files changed, 7 insertions(+) create mode 100644 shout-fll-scrimmage/main.py create mode 100644 shout-fll-scrimmage/missions/mission_1_2_3.py diff --git a/shout-fll-scrimmage/main.py b/shout-fll-scrimmage/main.py new file mode 100644 index 0000000..bf984d0 --- /dev/null +++ b/shout-fll-scrimmage/main.py @@ -0,0 +1,6 @@ +''' + +This is where you write the main code to start all mission codes +Combine all call here + +''' diff --git a/shout-fll-scrimmage/missions/mission_1_2_3.py b/shout-fll-scrimmage/missions/mission_1_2_3.py new file mode 100644 index 0000000..bf11581 --- /dev/null +++ b/shout-fll-scrimmage/missions/mission_1_2_3.py @@ -0,0 +1 @@ +#Write Code here for your missions From 37aa0e90377f4edf920425853b7a33a112a1ccc9 Mon Sep 17 00:00:00 2001 From: nifrali Date: Sun, 20 Sep 2026 15:45:48 -0500 Subject: [PATCH 02/36] added discovery phase folder --- discovery-phase/main.py | 6 ++++++ discovery-phase/missions/mission_1_2_3.py | 1 + 2 files changed, 7 insertions(+) create mode 100644 discovery-phase/main.py create mode 100644 discovery-phase/missions/mission_1_2_3.py diff --git a/discovery-phase/main.py b/discovery-phase/main.py new file mode 100644 index 0000000..bf984d0 --- /dev/null +++ b/discovery-phase/main.py @@ -0,0 +1,6 @@ +''' + +This is where you write the main code to start all mission codes +Combine all call here + +''' diff --git a/discovery-phase/missions/mission_1_2_3.py b/discovery-phase/missions/mission_1_2_3.py new file mode 100644 index 0000000..bf11581 --- /dev/null +++ b/discovery-phase/missions/mission_1_2_3.py @@ -0,0 +1 @@ +#Write Code here for your missions From 3fee5ba45c44f5cf0e07644051ffac28f9c063ca Mon Sep 17 00:00:00 2001 From: Rishabh <32mathur@elmbrookstudents.org> Date: Sun, 20 Sep 2026 22:11:53 +0000 Subject: [PATCH 03/36] 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) + + From b31f8158761b88c3ae3ccb72122111a57f6be57a Mon Sep 17 00:00:00 2001 From: Axel <32gariba@elmbrookstudents.org> Date: Sun, 20 Sep 2026 22:17:05 +0000 Subject: [PATCH 04/36] Add discovery-phase/missions/mission_9.py --- discovery-phase/missions/mission_9.py | 108 ++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 discovery-phase/missions/mission_9.py diff --git a/discovery-phase/missions/mission_9.py b/discovery-phase/missions/mission_9.py new file mode 100644 index 0000000..6caafc3 --- /dev/null +++ b/discovery-phase/missions/mission_9.py @@ -0,0 +1,108 @@ +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 = 62.4 # mm (adjust for your wheels) +AXLE_TRACK = 150 # mm (distance between wheels) +drive_base = DriveBase(left_motor, right_motor, WHEEL_DIAMETER, AXLE_TRACK) +drive_base.settings() #settings(600, 500, 300, 200) +drive_base.use_gyro(True) + + +""" +Debugging helps +""" +DEBUG = 1 # Enable when you want to show logs +# Example conversion function (adjust min/max values as needed for your hub) +async def get_battery_percentage(voltage_mV:float): + max_voltage = 8400.0 # max battery level https://assets.education.lego.com/v3/assets/blt293eea581807678a/bltb87f4ba8db36994a/5f8801b918967612e58a69a6/techspecs_techniclargehubrechargeablebattery.pdf?locale=en-us + min_voltage = 5000.0 # min battery level + percentage = ((float(voltage_mV) - min_voltage) / float(max_voltage - min_voltage) )* 100 + return max(0, min(100, percentage)) # Ensure percentage is between 0 and 100 + + +async def wait_button_release(): + """Wait for all buttons to be released""" + while hub.buttons.pressed(): + await wait(500) + await wait(1000) # Debounce delay + + +WALL_DISTANCE = 300 # mm +async def drive_forward(): + """Drive forward continuously using DriveBase.""" + drive_base.drive(1000,0) + + +async def drive_backward(): + """Drive forward continuously using DriveBase.""" + drive_base.drive(400, 0) + + + + + + + + + + +async def monitor_distance(stop_mm: int = WALL_DISTANCE): + """Monitor ultrasonic sensor and stop when wall is detected.""" + while True: + distance = await lazer_ranger.distance() + print('Distancing...', distance) + + if distance is None: + await wait(50) + continue + if distance < stop_mm: + drive_base.stop() + print(f"Wall detected at {distance}mm!") + break + + + # Small delay to prevent overwhelming the sensor + await wait(50) + + +# Use this to set default +def set_default_speed(): + drive_base.settings(600, 500, 300, 200) + + +# Use this to change drive base movement +def set_speed(straight_speed, st_acc, turn_speed, turn_acc): + drive_base.settings(straight_speed, st_acc, turn_speed, turn_acc) + + + + + + + +async def main(): + await drive_base.straight(500) + #await drive_base.turn(-15) + await right_arm.run_angle(100,-90) + await drive_base.straight(-176) + await drive_base.turn(15) + await right_arm.run_angle(100,90) + +run_task(main()) \ No newline at end of file From 1ffcfceae7159d276927976bd11c2079df81a8a2 Mon Sep 17 00:00:00 2001 From: Parthiv <31vadlap@elmbrookstudents.org> Date: Sun, 20 Sep 2026 23:19:09 +0000 Subject: [PATCH 05/36] Add discovery-phase/missions/mission_15_Parthiv.py --- .../missions/mission_15_Parthiv.py | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 discovery-phase/missions/mission_15_Parthiv.py diff --git a/discovery-phase/missions/mission_15_Parthiv.py b/discovery-phase/missions/mission_15_Parthiv.py new file mode 100644 index 0000000..2b5caed --- /dev/null +++ b/discovery-phase/missions/mission_15_Parthiv.py @@ -0,0 +1,53 @@ +#Solution for biosentric center +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(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) + +async def run_both_arms(): + + await multitask( + left_arm.run_angle(200,80), + right_arm.run_angle(200,-100) + ) + +async def main (): + await left_arm.run_angle(200,-80) + await right_arm.run_angle(200,-70) + await drive_base.arc(-400,angle=90) + await drive_base.turn(55) + await drive_base.straight(240) + await drive_base.turn(-40) + await drive_base.straight(85) + await drive_base.straight(-32) + await run_both_arms() + await drive_base.straight(-53) + await right_arm.run_angle(200,100) + await drive_base.turn(30) + await drive_base.straight(-775) + await drive_base.stop + + +run_task(main()) From 4748e170305f51281e109fa200bc0328751fa722 Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Mon, 21 Sep 2026 04:16:18 +0000 Subject: [PATCH 06/36] Add discovery-phase/missions/Mission 3_4_5 Johannes.py --- .../missions/Mission 3_4_5 Johannes.py | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 discovery-phase/missions/Mission 3_4_5 Johannes.py diff --git a/discovery-phase/missions/Mission 3_4_5 Johannes.py b/discovery-phase/missions/Mission 3_4_5 Johannes.py new file mode 100644 index 0000000..7edcf01 --- /dev/null +++ b/discovery-phase/missions/Mission 3_4_5 Johannes.py @@ -0,0 +1,56 @@ +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 = 62.4 # mm (adjust for your wheels) +AXLE_TRACK = 150 # mm (distance between wheels) +drive_base = DriveBase(left_motor, right_motor, WHEEL_DIAMETER, AXLE_TRACK) +drive_base.settings(600, 500, 300, 200) +drive_base.use_gyro(True) + +def set_default_speed(): + drive_base.settings(600, 500, 300, 200) + +def set_speed(straight_speed, st_acc, turn_speed, turn_acc): + drive_base.settings(straight_speed, st_acc, turn_speed, turn_acc) + +async def main(): + + await set_speed(600,200,300,200) + await drive_base.straight(500) + await multitask( + drive_base.straight(-200) + right_arm.run_angle(400,-150) + ) + await set_speed(600,500,100,200) + await drive_base.turn(45) + await drive_base.straight(346) + await drive_base.turn(-68) + await multitask( + left_arm.run_angle(600,240) + set_speed(300,200,300,200) + drive_base.straight(280) + ) + await left_arm.run_angle(600,-100) + await drive_base.turn(22) + await drive_base.straight(-100) + await right_arm.run_angle(5000,45) + await set_speed(600,500,100,200) + await drive_base.straight(200) + await drive_base.arc(-1500,None,-1000) + +run_task(main()) \ No newline at end of file From ddbc8a63905b0034176264a5c252347ae2fa4e2a Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Mon, 21 Sep 2026 04:17:23 +0000 Subject: [PATCH 07/36] Add discovery-phase/missions/mission_2_johannes.py --- .../missions/mission_2_johannes.py | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 discovery-phase/missions/mission_2_johannes.py diff --git a/discovery-phase/missions/mission_2_johannes.py b/discovery-phase/missions/mission_2_johannes.py new file mode 100644 index 0000000..8b7c87f --- /dev/null +++ b/discovery-phase/missions/mission_2_johannes.py @@ -0,0 +1,44 @@ +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 = 62.4 # mm (adjust for your wheels) +AXLE_TRACK = 150 # mm (distance between wheels) +drive_base = DriveBase(left_motor, right_motor, WHEEL_DIAMETER, AXLE_TRACK) +drive_base.settings(600, 500, 300, 200) +drive_base.use_gyro(True) + +def set_default_speed(): + drive_base.settings(600, 500, 300, 200) + +def set_speed(straight_speed, st_acc, turn_speed, turn_acc): + drive_base.settings(straight_speed, st_acc, turn_speed, turn_acc) + +right_arm.run_angle(400,100) +set_speed(600,200,300,200) +drive_base.straight(300) +set_speed(600,500,300,200) +drive_base.straight(470) +drive_base.turn(-15) +drive_base.straight(55) +drive_base.straight(-280) +drive_base.turn(15) +right_arm.run_angle(400,-100) +drive_base.straight(40) +drive_base.turn(-15) +drive_base.straight(50) +drive_base.turn(-25) \ No newline at end of file From 99826dad195949bb8c051fc18329210395827c6c Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Mon, 21 Sep 2026 04:17:55 +0000 Subject: [PATCH 08/36] Add discovery-phase/missions/mission_1_johannes.py --- .../missions/mission_1_johannes.py | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 discovery-phase/missions/mission_1_johannes.py diff --git a/discovery-phase/missions/mission_1_johannes.py b/discovery-phase/missions/mission_1_johannes.py new file mode 100644 index 0000000..9f9ef7d --- /dev/null +++ b/discovery-phase/missions/mission_1_johannes.py @@ -0,0 +1,38 @@ +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 = 62.4 # mm (adjust for your wheels) +AXLE_TRACK = 150 # mm (distance between wheels) +drive_base = DriveBase(left_motor, right_motor, WHEEL_DIAMETER, AXLE_TRACK) +drive_base.settings(600, 500, 300, 200) +drive_base.use_gyro(True) + +def set_default_speed(): + drive_base.settings(600, 500, 300, 200) + +def set_speed(straight_speed, st_acc, turn_speed, turn_acc): + drive_base.settings(straight_speed, st_acc, turn_speed, turn_acc) + +right_arm.run_angle(400,-100) +left_arm.run_angle(300,100) +drive_base.arc(150,None,115) +drive_base.straight(270) +left_arm.run_angle(300,-100) +drive_base.straight(-100) +left_arm.run_angle(300,-100) +drive_base.arc(-1000,None,-800) \ No newline at end of file From d8bf319fdf39b5d60d6b6b9bff714657bb38c2f5 Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Mon, 21 Sep 2026 04:18:59 +0000 Subject: [PATCH 09/36] Add discovery-phase/missions/mission_experimental_johannes.py --- .../missions/mission_experimental_johannes.py | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 discovery-phase/missions/mission_experimental_johannes.py diff --git a/discovery-phase/missions/mission_experimental_johannes.py b/discovery-phase/missions/mission_experimental_johannes.py new file mode 100644 index 0000000..eeb48be --- /dev/null +++ b/discovery-phase/missions/mission_experimental_johannes.py @@ -0,0 +1,49 @@ +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 = 62.4 # mm (adjust for your wheels) +AXLE_TRACK = 150 # mm (distance between wheels) +drive_base = DriveBase(left_motor, right_motor, WHEEL_DIAMETER, AXLE_TRACK) +drive_base.settings(600, 500, 300, 200) +drive_base.use_gyro(True) + +def set_default_speed(): + drive_base.settings(600, 500, 300, 200) + +def set_speed(straight_speed, st_acc, turn_speed, turn_acc): + drive_base.settings(straight_speed, st_acc, turn_speed, turn_acc) + +async def multilift_up(rotation_angle): + await multitask( + right_arm.run_angle(400,rotation_angle), + left_arm.run_angle(400,-1*rotation_angle) + ) + +async def multilift_down(rotation_angle): + await multitask( + right_arm.run_angle(1000,-1*rotation_angle), + left_arm.run_angle(1000,rotation_angle) + ) + +async def main(): + + await multilift_up(1200) + await multilift_down(300) + await drive_base.straight(50) + +run_task(main()) \ No newline at end of file From 4c9b7607f6f05293048e4e5bf0deaf14d26d6999 Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Mon, 21 Sep 2026 04:19:29 +0000 Subject: [PATCH 10/36] Add discovery-phase/missions/mission_experimental_johannes_2.py --- .../mission_experimental_johannes_2.py | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 discovery-phase/missions/mission_experimental_johannes_2.py diff --git a/discovery-phase/missions/mission_experimental_johannes_2.py b/discovery-phase/missions/mission_experimental_johannes_2.py new file mode 100644 index 0000000..acdf272 --- /dev/null +++ b/discovery-phase/missions/mission_experimental_johannes_2.py @@ -0,0 +1,64 @@ +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 = 62.4 # mm (adjust for your wheels) +AXLE_TRACK = 150 # mm (distance between wheels) +drive_base = DriveBase(left_motor, right_motor, WHEEL_DIAMETER, AXLE_TRACK) +drive_base.settings(600, 500, 300, 200) +drive_base.use_gyro(True) + +def set_default_speed(): + drive_base.settings(600, 500, 300, 200) + +def set_speed(straight_speed, st_acc, turn_speed, turn_acc): + drive_base.settings(straight_speed, st_acc, turn_speed, turn_acc) + +async def main(): + + await drive_base.straight(110) + await drive_base.turn(-45) + await drive_base.straight(240) + await right_arm.run_angle(300,120) + await drive_base.straight(290) + await drive_base.turn(50) + await drive_base.straight(300) + await drive_base.turn(40) + set_speed(100,200,300,200) + await drive_base.straight(130) + await drive_base.straight(-115) + await drive_base.turn(87) + await drive_base.straight(230) + set_speed(600, 500, 300, 200) + await drive_base.straight(-135) + await multitask( + drive_base.turn(-40), + right_arm.run_angle(100,-110) + ) + set_speed(100,200,300,200) + await drive_base.straight(220) + await right_arm.run_angle(300,85) + await wait(500) + await drive_base.straight(142) + await drive_base.arc(110,None,-166) + await drive_base.straight(140) + await drive_base.straight(-150) + set_speed(600,500,300,200) + await drive_base.straight(150) + await drive_base.arc(800,None,-900) + +run_task(main()) \ No newline at end of file From 54b58c64c3d0e1dc9f0bbc737349acb2671993ee Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Mon, 21 Sep 2026 04:19:47 +0000 Subject: [PATCH 11/36] Update discovery-phase/missions/mission 3_4_5_johannes.py --- .../{Mission 3_4_5 Johannes.py => mission 3_4_5_johannes.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename discovery-phase/missions/{Mission 3_4_5 Johannes.py => mission 3_4_5_johannes.py} (100%) diff --git a/discovery-phase/missions/Mission 3_4_5 Johannes.py b/discovery-phase/missions/mission 3_4_5_johannes.py similarity index 100% rename from discovery-phase/missions/Mission 3_4_5 Johannes.py rename to discovery-phase/missions/mission 3_4_5_johannes.py From 9125c0b4aae5b8f0ae25589f09e91d4740c1b83f Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Mon, 21 Sep 2026 04:20:37 +0000 Subject: [PATCH 12/36] Update discovery-phase/missions 3, 4, 5/Mission 3, 4, & 5.py --- .../missions 3, 4, 5/{Mission 3, 4, & 5 => Mission 3, 4, & 5.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename discovery-phase/missions 3, 4, 5/{Mission 3, 4, & 5 => Mission 3, 4, & 5.py} (100%) diff --git a/discovery-phase/missions 3, 4, 5/Mission 3, 4, & 5 b/discovery-phase/missions 3, 4, 5/Mission 3, 4, & 5.py similarity index 100% rename from discovery-phase/missions 3, 4, 5/Mission 3, 4, & 5 rename to discovery-phase/missions 3, 4, 5/Mission 3, 4, & 5.py From ad69b7560dcb73b74430c9f3fffea1110e6d5056 Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Mon, 21 Sep 2026 04:22:59 +0000 Subject: [PATCH 13/36] Update discovery-phase/missions/mission_experimental_hirohitus.py --- ...experimental_johannes.py => mission_experimental_hirohitus.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename discovery-phase/missions/{mission_experimental_johannes.py => mission_experimental_hirohitus.py} (100%) diff --git a/discovery-phase/missions/mission_experimental_johannes.py b/discovery-phase/missions/mission_experimental_hirohitus.py similarity index 100% rename from discovery-phase/missions/mission_experimental_johannes.py rename to discovery-phase/missions/mission_experimental_hirohitus.py From 8c7bec48ffa81fb62a96016eebd6e2992a99f425 Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Mon, 21 Sep 2026 04:23:15 +0000 Subject: [PATCH 14/36] Update discovery-phase/missions/mission_experimental_stalinus.py --- ...xperimental_johannes_2.py => mission_experimental_stalinus.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename discovery-phase/missions/{mission_experimental_johannes_2.py => mission_experimental_stalinus.py} (100%) diff --git a/discovery-phase/missions/mission_experimental_johannes_2.py b/discovery-phase/missions/mission_experimental_stalinus.py similarity index 100% rename from discovery-phase/missions/mission_experimental_johannes_2.py rename to discovery-phase/missions/mission_experimental_stalinus.py From 3fcbb794391ba03bdf196b4cf56556c1e99f90b4 Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Tue, 22 Sep 2026 20:58:48 +0000 Subject: [PATCH 15/36] Add discovery-phase/missions/Showcase_codes.py --- discovery-phase/missions/Showcase_codes.py | 398 +++++++++++++++++++++ 1 file changed, 398 insertions(+) create mode 100644 discovery-phase/missions/Showcase_codes.py diff --git a/discovery-phase/missions/Showcase_codes.py b/discovery-phase/missions/Showcase_codes.py new file mode 100644 index 0000000..6de9cda --- /dev/null +++ b/discovery-phase/missions/Showcase_codes.py @@ -0,0 +1,398 @@ +""" +PID Straight Drive — heading-corrected forward / backward movement. + +Improvements over baseline: + • Derivative on measurement (not error) — no derivative kick on setpoint change + • Fixed-interval dt — loop sleeps a constant 20 ms, so /dt is dropped from the + derivative term (dividing by 0.02 was silently multiplying KD by 50) + • prev_error seeded from first real heading — eliminates first-tick spike + • Per-motor speed clamping — prevents one side pivoting at low speeds + • Deceleration ramp — smooth stop in the last RAMP_MM millimetres + • Dual-motor exit + timeout — survives stall on either wheel + • Integral freeze near target — stops windup right where it matters most +""" + +from pybricks.tools import StopWatch, wait +import umath + +WHEEL_DIAMETER = 68.8 # mm — adjust to your wheel (Done) +AXLE_TRACK = 180 # mm — used only if you add turning later (Done) +LOOP_MS = 20 # fixed control loop period +RAMP_MM = 50 # begin decelerating this far from target +MIN_SPEED = 80 # floor speed during ramp (avoid stall) +TIMEOUT_MS = 8_000 # safety abort +# Tuning sequence + +KP = 4.8 # Wide chassis = stable platform, can afford higher P gain + # without oscillation. Pushes harder through corrections. + +KI = 0.012 # Slightly lower than default — large wheels cover distance + # fast so the integrator has less time to build up per run. + # Raise to 0.012 if you see consistent sideways drift at end. + +KD = 7.5 # Higher than default. Big wheels = more rotational momentum, + # needs stronger damping to prevent overshoot on corrections. + +def _mm_to_deg(mm: float) -> float: + return (abs(mm) / (umath.pi * WHEEL_DIAMETER)) * 360.0 + + +def _motor_avg_angle(m1, m2) -> float: + return (abs(m1.angle()) + abs(m2.angle())) / 2.0 + + +async def pid_straight(distance_mm: float, speed: int = 600): + """ + Drive straight for distance_mm at speed (deg/s). + Positive = forward, negative = reverse. + """ + direction = 1 if distance_mm >= 0 else -1 + degrees_need = _mm_to_deg(distance_mm) + target_hdg = hub.imu.heading() + + left_motor.reset_angle(0) + right_motor.reset_angle(0) + + # ── seed integral and prev_error from the real opening heading ── + first_error = target_hdg - hub.imu.heading() # 0.0 on a perfect start, + integral = 0.0 # non-zero if robot is tilted + prev_heading = hub.imu.heading() # for derivative-on-measurement + + watchdog = StopWatch() + + while True: + traveled = _motor_avg_angle(left_motor, right_motor) + + # ── exit: distance reached or timeout ── + if traveled >= degrees_need: + break + if watchdog.time() > TIMEOUT_MS: + break + + # ── heading error with wrap ── + heading = hub.imu.heading() + error = target_hdg - heading + if error > 180: error -= 360 + if error < -180: error += 360 + + # ── derivative on measurement — no kick when target changes ── + d_heading = heading - prev_heading # raw delta (deg / loop) + if d_heading > 180: d_heading -= 360 + if d_heading < -180: d_heading += 360 + prev_heading = heading + + # ── integral with freeze near target ── + near_target = (degrees_need - traveled) < _mm_to_deg(RAMP_MM / 2) + if not near_target: + integral = max(-50.0, min(50.0, integral + error)) # dt=const → no *dt + + # ── PID output ── + # derivative term: -KD * d_heading (measurement, not error difference) + correction = KP * error + KI * integral - KD * d_heading + correction = max(-200.0, min(200.0, correction)) + + # ── ramp speed near end ── + remaining = degrees_need - traveled + ramp_degrees = _mm_to_deg(RAMP_MM) + if remaining < ramp_degrees and ramp_degrees > 0: + ramp_factor = max(float(MIN_SPEED) / speed, + remaining / ramp_degrees) + run_speed = int(speed * ramp_factor) + else: + run_speed = speed + + # ── per-motor clamping — prevents pivot at low speeds ── + l_cmd = max(-speed, min(speed, direction * run_speed + int(correction))) + r_cmd = max(-speed, min(speed, direction * run_speed - int(correction))) + + left_motor.run(l_cmd) + right_motor.run(r_cmd) + await wait(LOOP_MS) + + left_motor.brake() + right_motor.brake() + +#Important Notice: All codes should be tested while the robot's battery is at 100%, and all updates must be made when the robot is at full charge. +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 = 62.4 # mm (adjust for your wheels) +AXLE_TRACK = 150 # mm (distance between wheels) +drive_base = DriveBase(left_motor, right_motor, WHEEL_DIAMETER, AXLE_TRACK) +drive_base.settings(600, 500, 300, 200) +drive_base.use_gyro(True) + +""" +Debugging helps +""" +DEBUG = 1 # Enable when you want to show logs +# Example conversion function (adjust min/max values as needed for your hub) +async def get_battery_percentage(voltage_mV:float): + max_voltage = 8400.0 # max battery level https://assets.education.lego.com/v3/assets/blt293eea581807678a/bltb87f4ba8db36994a/5f8801b918967612e58a69a6/techspecs_techniclargehubrechargeablebattery.pdf?locale=en-us + min_voltage = 5000.0 # min battery level + percentage = ((float(voltage_mV) - min_voltage) / float(max_voltage - min_voltage) )* 100 + return max(0, min(100, percentage)) # Ensure percentage is between 0 and 100 + +async def wait_button_release(): + """Wait for all buttons to be released""" + while hub.buttons.pressed(): + await wait(500) + await wait(1000) # Debounce delay + +WALL_DISTANCE = 300 # mm +async def drive_forward(): + """Drive forward continuously using DriveBase.""" + drive_base.drive(1000,0) + +async def drive_backward(): + """Drive forward continuously using DriveBase.""" + drive_base.drive(400, 0) + + +async def monitor_distance(stop_mm: int = WALL_DISTANCE): + """Monitor ultrasonic sensor and stop when wall is detected.""" + while True: + distance = await lazer_ranger.distance() + print('Distancing...', distance) + + if distance is None: + await wait(50) + continue + if distance < stop_mm: + drive_base.stop() + print(f"Wall detected at {distance}mm!") + break + + # Small delay to prevent overwhelming the sensor + await wait(50) + +# Use this to set default +def set_default_speed(): + drive_base.settings(600, 500, 300, 200) + +# Use this to change drive base movement +def set_speed(straight_speed, st_acc, turn_speed, turn_acc): + drive_base.settings(straight_speed, st_acc, turn_speed, turn_acc) + +async def multilift_up(rotation_angle): + await multitask( + right_arm.run_angle(400,rotation_angle), + left_arm.run_angle(400,-1*rotation_angle) + ) + +async def multilift_down(rotation_angle): + await multitask( + right_arm.run_angle(1000,-1*rotation_angle), + left_arm.run_angle(1000,rotation_angle) + ) + + +async def Run1(): # Flip The Rock, Lucky Leaves, Reaching Roots - Johannes + + await set_speed(600,200,300,200) + await drive_base.straight(500) + await multitask( + drive_base.straight(-200), + right_arm.run_angle(400,-150) + ) + await set_speed(600,500,100,200) + await drive_base.turn(45) + await drive_base.straight(346) + await drive_base.turn(-68) + await multitask( + left_arm.run_angle(600,240), + set_speed(300,200,300,200), + drive_base.straight(280) + ) + await left_arm.run_angle(600,-100) + await drive_base.turn(22) + await drive_base.straight(-100) + await right_arm.run_angle(5000,45) + await set_speed(600,500,100,200) + await drive_base.straight(200) + await drive_base.arc(-1500,None,-1000) + +async def Run2(): # Exploding Seeds - Johannes + + await multitask( + right_arm.run_angle(400,-100) + left_arm.run_angle(300,100) + drive_base.arc(150,None,115) + ) + await drive_base.straight(270) + await left_arm.run_angle(300,-100) + await drive_base.straight(-100) + await left_arm.run_angle(300,-100) + await drive_base.arc(-1000,None,-800) + + +async def Run2_1(): # Drone Survey, Experimental - Johannes + + await multitask( + right_arm.run_angle(400,100), + set_speed(600,200,300,200), + drive_base.straight(300) + ) + set_speed(600,500,300,200) + await drive_base.straight(470) + await drive_base.turn(-15) + await drive_base.straight(55) + await drive_base.straight(-280) + await drive_base.turn(15) + await right_arm.run_angle(400,-100) + await drive_base.straight(40) + await drive_base.turn(-15) + await drive_base.straight(50) + await drive_base.turn(-25) + + +async def Run3(): # Window to the Past, Leaf Cutter, Humongous Fungus, Experimental - Johannes + + await drive_base.straight(110) + await drive_base.turn(-45) + await drive_base.straight(240) + await right_arm.run_angle(300,120) + await drive_base.straight(290) + await drive_base.turn(50) + await drive_base.straight(300) + await drive_base.turn(40) + set_speed(100,200,300,200) + await drive_base.straight(130) + await drive_base.straight(-115) + await drive_base.turn(87) + await drive_base.straight(230) + set_speed(600, 500, 300, 200) + await drive_base.straight(-135) + await multitask( + drive_base.turn(-40), + right_arm.run_angle(100,-110) + ) + set_speed(100,200,300,200) + await drive_base.straight(220) + await right_arm.run_angle(300,85) + await wait(500) + await drive_base.straight(142) + await drive_base.arc(110,None,-166) + await drive_base.straight(140) + await drive_base.straight(-150) + set_speed(600,500,300,200) + await drive_base.straight(150) + await drive_base.arc(800,None,-900) + + +async def Run4(): + + +async def Run5(): + + +async def Run6_7(): + + +async def Run10(): + + +async def Run11(): + + +async def Run12(): # Experimental Research Platform Lifter + + await multilift_up(1200) + await multilift_down(300) + await drive_base.straight(50) + + +# Function to classify color based on HSV +def detect_color(h, s, v, reflected): + if reflected > 4: + if h < 4 or h > 350: # red + return "Red" + elif 3 < h < 40 and s > 70: # orange + return "Orange" + elif 47 < h < 56: # yellow + return "Yellow" + elif 70 < h < 160: # green - do it vertically not horizontally for accuracy + return "Green" + elif 195 < h < 198: # light blue + return "Light_Blue" + elif 210 < h < 225: # blue - do it vertically not horizontally for accuracy + return "Blue" + elif 260 < h < 350: # purple + return "Purple" + + else: + return "Unknown" + return "Unknown" + + +async def main(): + while True: + pressed = hub.buttons.pressed() + h, s, v = await color_sensor.hsv() + reflected = await color_sensor.reflection() + color = detect_color(h, s, v, reflected) + if DEBUG : + #print(color_sensor.color()) + #print(h,s,v) + #print(color) + print(f"button pressed: {pressed}") + + + if color == "Green": + print('Running Mission 1') + await Run1() + elif color == "Red": + print('Running Mission 2') + await Run2() + elif color == "Yellow": + print('Running Mission 3') + await Run3() + elif color == "Blue": + print('Running Mission 4') + await Run4() + elif color == "Orange": + print('Running Mission 5') + await Run3() + elif color == "Purple": + print('Running Mission 11') + await Run11() + elif color == "Light_Blue": + print("Running Mission 12") + await Run12() + else: + print(f"Unknown color detected (Hue: {h}, Sat: {s}, Val: {v})") + #pass + + # Show battery % for debugging + if Button.BLUETOOTH in pressed: # using bluetooth button here since away from color sensor + # Get the battery voltage in millivolts (mV) + battery_voltage_mV = hub.battery.voltage() + # Use the function with your voltage reading + percentage = await get_battery_percentage(float(battery_voltage_mV)) + if DEBUG: + print(f"Battery voltage: {battery_voltage_mV} mV") + print(f"Battery level: {percentage:.3f}%") + print("FLL Robot System Ready!") + await hub.display.text(f"{percentage:.0f}") + break + elif pressed == None: + continue + + await wait(10) +# Run the main function +run_task(main()) \ No newline at end of file From de8a3455b07864aad924df07eae256c73c54b4b6 Mon Sep 17 00:00:00 2001 From: Vihaan <33mangav@elmbrookstudents.org> Date: Tue, 22 Sep 2026 23:56:31 +0000 Subject: [PATCH 16/36] Add discovery-phase/missions/drone survey.py --- discovery-phase/missions/drone survey.py | 40 ++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 discovery-phase/missions/drone survey.py diff --git a/discovery-phase/missions/drone survey.py b/discovery-phase/missions/drone survey.py new file mode 100644 index 0000000..dd49e3d --- /dev/null +++ b/discovery-phase/missions/drone survey.py @@ -0,0 +1,40 @@ +from pybricks.hubs import PrimeHub +from pybricks.pupdevices import Motor, ColorSensor, UltrasonicSensor, ForceSensor +from pybricks.parameters import Button, Color, Direction, Port, Side, Stop +from pybricks.robotics import DriveBase +from pybricks.tools import wait, StopWatch +from pybricks.tools import multitask, run_task + +# 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 = 62.4 # mm (adjust for your wheels) +AXLE_TRACK = 150 # mm (distance between wheels) +drive_base = DriveBase(left_motor, right_motor, WHEEL_DIAMETER, AXLE_TRACK) +drive_base.settings(600, 500, 300, 200) +drive_base.use_gyro(True) + +async def set_default_speed(): + drive_base.settings(600, 500, 300, 200) + +async def set_speed(straight_speed, st_acc, turn_speed, turn_acc): + drive_base.settings(straight_speed, st_acc, turn_speed, turn_acc) +async def main(): + + await drive_base.straight(850) + await drive_base.turn(-20) + await drive_base.straight(100) + await drive_base.straight(-30) + await drive_base.turn(-50) + await drive_base.turn(60) + await drive_base.straight(-200) + await drive_base.turn(15) + await drive_base.straight(-800) +run_task(main()) From 64a296a84e273fe9354dde6ac9e269b5213de086 Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Sun, 27 Sep 2026 04:12:58 +0000 Subject: [PATCH 17/36] Update discovery-phase/missions/Showcase_codes.py --- discovery-phase/missions/Showcase_codes.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/discovery-phase/missions/Showcase_codes.py b/discovery-phase/missions/Showcase_codes.py index 6de9cda..3543c97 100644 --- a/discovery-phase/missions/Showcase_codes.py +++ b/discovery-phase/missions/Showcase_codes.py @@ -295,7 +295,23 @@ async def Run3(): # Window to the Past, Leaf Cutter, Humongous Fungus, Experimen await drive_base.arc(800,None,-900) -async def Run4(): +async def Run4(): #Flip the Rock, Lucky Leaves, Reaching Roots - Rishabh + + #Run + await drive_base.straight(550)#Works (600(Previous)) + await drive_base.straight(-200) + await drive_base.turn(45) + await drive_base.straight(575) + await drive_base.turn(-90)#-90 for Coach Cisco table + await left_arm.run_angle(200,270) + await drive_base.straight(300) + await left_arm.run_angle(200,-265) + await right_arm.run_angle(200, -200) + await drive_base.straight(-105)#Use -105 for Coach Cisco table(-105 for school) + await drive_base.turn(32)#was 24-Use 24 for Coach Cisco's table(32 for school) + await right_arm.run_angle(1500, 180) + await drive_base.turn(30) + await drive_base.straight(-1000) async def Run5(): From e332b0c3247698a099b4486d67f77f8e074e96f7 Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Sun, 27 Sep 2026 04:15:25 +0000 Subject: [PATCH 18/36] Update discovery-phase/missions/Showcase_codes.py --- discovery-phase/missions/Showcase_codes.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/discovery-phase/missions/Showcase_codes.py b/discovery-phase/missions/Showcase_codes.py index 3543c97..aa52f08 100644 --- a/discovery-phase/missions/Showcase_codes.py +++ b/discovery-phase/missions/Showcase_codes.py @@ -323,8 +323,22 @@ async def Run6_7(): async def Run10(): -async def Run11(): +async def Run11(): # Interchangable Mission - Parthiv + await left_arm.run_angle(200,-80) + await right_arm.run_angle(200,-70) + await drive_base.arc(-400,angle=90) + await drive_base.turn(55) + await drive_base.straight(240) + await drive_base.turn(-40) + await drive_base.straight(85) + await drive_base.straight(-32) + await run_both_arms() + await drive_base.straight(-53) + await right_arm.run_angle(200,100) + await drive_base.turn(30) + await drive_base.straight(-775) + await drive_base.stop async def Run12(): # Experimental Research Platform Lifter From 74b363f97ea4daa05e5b65e055a66afd2fedad15 Mon Sep 17 00:00:00 2001 From: Rishabh <32mathur@elmbrookstudents.org> Date: Sun, 27 Sep 2026 23:28:22 +0000 Subject: [PATCH 19/36] Add discovery-phase/missions/Mission 11, 6+More --- discovery-phase/missions/Mission 11, 6+More | 60 +++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 discovery-phase/missions/Mission 11, 6+More diff --git a/discovery-phase/missions/Mission 11, 6+More b/discovery-phase/missions/Mission 11, 6+More new file mode 100644 index 0000000..9ca2a2b --- /dev/null +++ b/discovery-phase/missions/Mission 11, 6+More @@ -0,0 +1,60 @@ +#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) + +def set_default_speed(): + drive_base.settings(600,450,300,200) + +def set_speed(straight_speed, st_acc, turn_speed, turn_acc): + drive_base.settings(straight_speed, st_acc, turn_speed, turn_acc) + +#Run code +drive_base.straight(50)#Was 50 +drive_base.turn(-43.75)#42 Mostly works +drive_base.straight(735)#Was 750 +#left_arm.run_angle(1500,-100)#Was 1000,And was -30 +#wait(1000) +#drive_base.straight(330) +drive_base.turn(80)#Was 80 +set_speed(100,300,300,200) +drive_base.straight(350)#Was 400 +drive_base.straight(-110)#Was -125 +set_default_speed +drive_base.turn(87)#Was 90 +#right_arm.run_angle(1000, -30)#Was -47 +drive_base.straight(100) +drive_base.turn(-70) +left_arm.run_angle(1000,180) +drive_base.straight(55) +drive_base.turn(-30)#Was Positive 30 +#left_arm.run_angle(2000,-180) +drive_base.straight(-20) +drive_base.straight(-200) +drive_base.turn(120) +#Going back +drive_base.straight(700) + + + + From 57844e8b1af789d680ba83cf1e6fdec80b8d70f2 Mon Sep 17 00:00:00 2001 From: Rishabh <32mathur@elmbrookstudents.org> Date: Sun, 27 Sep 2026 23:29:13 +0000 Subject: [PATCH 20/36] Add discovery-phase/missions/Mission 3, 4, 5 - Rishabh --- .../missions/Mission 3, 4, 5 - Rishabh | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 discovery-phase/missions/Mission 3, 4, 5 - Rishabh diff --git a/discovery-phase/missions/Mission 3, 4, 5 - Rishabh b/discovery-phase/missions/Mission 3, 4, 5 - Rishabh new file mode 100644 index 0000000..b201b37 --- /dev/null +++ b/discovery-phase/missions/Mission 3, 4, 5 - Rishabh @@ -0,0 +1,46 @@ +#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(600)#Works (600(Previous)) +drive_base.straight(-200) +drive_base.turn(45) +drive_base.straight(575) +drive_base.turn(-90)#-90 for 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 Cisco table(-105 for school) +drive_base.turn(32)#was 24-Use 24 for Cisco's table(32 for school) +#drive_base.straight(20)#Sometimes there +right_arm.run_angle(1500, 180) +drive_base.turn(30) +drive_base.straight(-1000) +#right_arm.run_angle(400, 150) +#drive_base.straight(-20) +#right_arm.run_angle(400, 150) +#drive_base.turn(-45) + From b1783a2fcef5ab496bc65dd78252516812a032ab Mon Sep 17 00:00:00 2001 From: Rishabh <32mathur@elmbrookstudents.org> Date: Sun, 27 Sep 2026 23:29:44 +0000 Subject: [PATCH 21/36] Update discovery-phase/missions/Mission 11, 6+More-Rishabh --- .../missions/{Mission 11, 6+More => Mission 11, 6+More-Rishabh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename discovery-phase/missions/{Mission 11, 6+More => Mission 11, 6+More-Rishabh} (100%) diff --git a/discovery-phase/missions/Mission 11, 6+More b/discovery-phase/missions/Mission 11, 6+More-Rishabh similarity index 100% rename from discovery-phase/missions/Mission 11, 6+More rename to discovery-phase/missions/Mission 11, 6+More-Rishabh 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 22/36] 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 From 19912d759ecbe245caa9c3c9e32717b20273a09d Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Mon, 28 Sep 2026 12:43:43 +0000 Subject: [PATCH 23/36] Update discovery-phase/missions/Showcase_codes.py --- discovery-phase/missions/Showcase_codes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/discovery-phase/missions/Showcase_codes.py b/discovery-phase/missions/Showcase_codes.py index aa52f08..ff22e53 100644 --- a/discovery-phase/missions/Showcase_codes.py +++ b/discovery-phase/missions/Showcase_codes.py @@ -230,8 +230,8 @@ async def Run1(): # Flip The Rock, Lucky Leaves, Reaching Roots - Johannes async def Run2(): # Exploding Seeds - Johannes await multitask( - right_arm.run_angle(400,-100) - left_arm.run_angle(300,100) + right_arm.run_angle(400,-100), + left_arm.run_angle(300,100), drive_base.arc(150,None,115) ) await drive_base.straight(270) From 98b987fe71725d4f3f8247d3480ce4df0e8498d2 Mon Sep 17 00:00:00 2001 From: Rishabh <32mathur@elmbrookstudents.org> Date: Wed, 30 Sep 2026 00:59:14 +0000 Subject: [PATCH 24/36] Update discovery-phase/missions/Mission 11, 6+More-Rishabh --- .../missions/Mission 11, 6+More-Rishabh | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/discovery-phase/missions/Mission 11, 6+More-Rishabh b/discovery-phase/missions/Mission 11, 6+More-Rishabh index 9ca2a2b..8bc3582 100644 --- a/discovery-phase/missions/Mission 11, 6+More-Rishabh +++ b/discovery-phase/missions/Mission 11, 6+More-Rishabh @@ -31,30 +31,31 @@ def set_speed(straight_speed, st_acc, turn_speed, turn_acc): #Run code drive_base.straight(50)#Was 50 -drive_base.turn(-43.75)#42 Mostly works -drive_base.straight(735)#Was 750 +drive_base.turn(-49)#42 Mostly works +drive_base.straight(700)#Was 735 #left_arm.run_angle(1500,-100)#Was 1000,And was -30 #wait(1000) #drive_base.straight(330) -drive_base.turn(80)#Was 80 +drive_base.turn(40)#Was 80 set_speed(100,300,300,200) -drive_base.straight(350)#Was 400 +drive_base.straight(100) +drive_base.turn(47)#Was 37 +drive_base.straight(320)#Was 300-350 drive_base.straight(-110)#Was -125 set_default_speed -drive_base.turn(87)#Was 90 +drive_base.turn(85)#Was 87 #right_arm.run_angle(1000, -30)#Was -47 -drive_base.straight(100) -drive_base.turn(-70) -left_arm.run_angle(1000,180) -drive_base.straight(55) -drive_base.turn(-30)#Was Positive 30 -#left_arm.run_angle(2000,-180) -drive_base.straight(-20) -drive_base.straight(-200) -drive_base.turn(120) -#Going back -drive_base.straight(700) - +drive_base.straight(50)#150 +drive_base.turn(-67)#Was -73 +print("Mycellium") +left_arm.run_angle(1000,180)#Towards Mycellium +drive_base.straight(75)#Was 75 +drive_base.turn(-10)#Was Positive 30 +drive_base.straight(3) +set_speed(1000,300,300,200) +left_arm.run_angle(102020,-180) +drive_base.turn(70)#Orignal 120 +drive_base.straight(300) From 0e1e580fb0be9abfae3db2d5650e9865c848826e Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Fri, 2 Oct 2026 21:07:59 +0000 Subject: [PATCH 25/36] Update discovery-phase/missions/Showcase_codes.py --- discovery-phase/missions/Showcase_codes.py | 30 ++++++++++------------ 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/discovery-phase/missions/Showcase_codes.py b/discovery-phase/missions/Showcase_codes.py index ff22e53..36f9933 100644 --- a/discovery-phase/missions/Showcase_codes.py +++ b/discovery-phase/missions/Showcase_codes.py @@ -265,33 +265,31 @@ async def Run3(): # Window to the Past, Leaf Cutter, Humongous Fungus, Experimen await drive_base.straight(110) await drive_base.turn(-45) - await drive_base.straight(240) + await drive_base.straight(300) await right_arm.run_angle(300,120) await drive_base.straight(290) await drive_base.turn(50) - await drive_base.straight(300) + await drive_base.straight(250) await drive_base.turn(40) set_speed(100,200,300,200) - await drive_base.straight(130) - await drive_base.straight(-115) - await drive_base.turn(87) + await drive_base.straight(170) + await drive_base.straight(-135) + await drive_base.turn(80) await drive_base.straight(230) set_speed(600, 500, 300, 200) - await drive_base.straight(-135) + await drive_base.straight(-145) await multitask( - drive_base.turn(-40), - right_arm.run_angle(100,-110) + drive_base.turn(-36), + right_arm.run_angle(200,-140) ) set_speed(100,200,300,200) - await drive_base.straight(220) - await right_arm.run_angle(300,85) - await wait(500) - await drive_base.straight(142) - await drive_base.arc(110,None,-166) - await drive_base.straight(140) - await drive_base.straight(-150) + await drive_base.straight(230) + await right_arm.run_angle(300,160) + await wait(200) + await drive_base.turn(-90) + await drive_base.straight(-170) set_speed(600,500,300,200) - await drive_base.straight(150) + await drive_base.straight(100) await drive_base.arc(800,None,-900) From a60078d89d0dd655c9a550c21cb010b045682880 Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Fri, 2 Oct 2026 21:29:41 +0000 Subject: [PATCH 26/36] Update discovery-phase/missions/Showcase_codes.py --- discovery-phase/missions/Showcase_codes.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/discovery-phase/missions/Showcase_codes.py b/discovery-phase/missions/Showcase_codes.py index 36f9933..967f9ff 100644 --- a/discovery-phase/missions/Showcase_codes.py +++ b/discovery-phase/missions/Showcase_codes.py @@ -324,15 +324,17 @@ async def Run10(): async def Run11(): # Interchangable Mission - Parthiv await left_arm.run_angle(200,-80) - await right_arm.run_angle(200,-70) - await drive_base.arc(-400,angle=90) - await drive_base.turn(55) - await drive_base.straight(240) - await drive_base.turn(-40) + await drive_base.arc(-350,angle=90) + await drive_base.turn(50) + await drive_base.straight(238) + await drive_base.turn(-33) await drive_base.straight(85) - await drive_base.straight(-32) - await run_both_arms() - await drive_base.straight(-53) + await drive_base.straight(-33) + await multitask( + left_arm.run_angle(200,80), + right_arm.run_angle(200,-100) + ) + await drive_base.straight(-60) await right_arm.run_angle(200,100) await drive_base.turn(30) await drive_base.straight(-775) From 788745f4f43b93f69a8fa9410a76984aab1b49e1 Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Fri, 2 Oct 2026 21:52:26 +0000 Subject: [PATCH 27/36] Update discovery-phase/missions/Showcase_codes.py --- discovery-phase/missions/Showcase_codes.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/discovery-phase/missions/Showcase_codes.py b/discovery-phase/missions/Showcase_codes.py index 967f9ff..a4288a1 100644 --- a/discovery-phase/missions/Showcase_codes.py +++ b/discovery-phase/missions/Showcase_codes.py @@ -263,7 +263,7 @@ async def Run2_1(): # Drone Survey, Experimental - Johannes async def Run3(): # Window to the Past, Leaf Cutter, Humongous Fungus, Experimental - Johannes - await drive_base.straight(110) + await drive_base.straight(98) await drive_base.turn(-45) await drive_base.straight(300) await right_arm.run_angle(300,120) @@ -272,19 +272,19 @@ async def Run3(): # Window to the Past, Leaf Cutter, Humongous Fungus, Experimen await drive_base.straight(250) await drive_base.turn(40) set_speed(100,200,300,200) - await drive_base.straight(170) - await drive_base.straight(-135) - await drive_base.turn(80) - await drive_base.straight(230) - set_speed(600, 500, 300, 200) + await drive_base.straight(177) await drive_base.straight(-145) + await drive_base.turn(85) + await drive_base.straight(232) + set_speed(600, 500, 300, 200) + await drive_base.straight(-138) await multitask( drive_base.turn(-36), right_arm.run_angle(200,-140) ) set_speed(100,200,300,200) await drive_base.straight(230) - await right_arm.run_angle(300,160) + await right_arm.run_angle(300,105) await wait(200) await drive_base.turn(-90) await drive_base.straight(-170) From c15d8f0fd62d687a62aea75fd2069ecba982e95b Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Wed, 7 Oct 2026 02:02:12 +0000 Subject: [PATCH 28/36] Update discovery-phase/missions/Showcase_codes.py --- discovery-phase/missions/Showcase_codes.py | 231 ++++++++++----------- 1 file changed, 114 insertions(+), 117 deletions(-) diff --git a/discovery-phase/missions/Showcase_codes.py b/discovery-phase/missions/Showcase_codes.py index a4288a1..caa2744 100644 --- a/discovery-phase/missions/Showcase_codes.py +++ b/discovery-phase/missions/Showcase_codes.py @@ -15,8 +15,8 @@ Improvements over baseline: from pybricks.tools import StopWatch, wait import umath -WHEEL_DIAMETER = 68.8 # mm — adjust to your wheel (Done) -AXLE_TRACK = 180 # mm — used only if you add turning later (Done) +WHEEL_DIAMETER = 62.4 # mm — adjust to your wheel (Done) +AXLE_TRACK = 150 # mm — used only if you add turning later (Done) LOOP_MS = 20 # fixed control loop period RAMP_MM = 50 # begin decelerating this far from target MIN_SPEED = 80 # floor speed during ramp (avoid stall) @@ -202,100 +202,8 @@ async def multilift_down(rotation_angle): ) -async def Run1(): # Flip The Rock, Lucky Leaves, Reaching Roots - Johannes +async def Run1(): # Flip The Rock, Lucky Leaves, Reaching Roots - Rishabh - await set_speed(600,200,300,200) - await drive_base.straight(500) - await multitask( - drive_base.straight(-200), - right_arm.run_angle(400,-150) - ) - await set_speed(600,500,100,200) - await drive_base.turn(45) - await drive_base.straight(346) - await drive_base.turn(-68) - await multitask( - left_arm.run_angle(600,240), - set_speed(300,200,300,200), - drive_base.straight(280) - ) - await left_arm.run_angle(600,-100) - await drive_base.turn(22) - await drive_base.straight(-100) - await right_arm.run_angle(5000,45) - await set_speed(600,500,100,200) - await drive_base.straight(200) - await drive_base.arc(-1500,None,-1000) - -async def Run2(): # Exploding Seeds - Johannes - - await multitask( - right_arm.run_angle(400,-100), - left_arm.run_angle(300,100), - drive_base.arc(150,None,115) - ) - await drive_base.straight(270) - await left_arm.run_angle(300,-100) - await drive_base.straight(-100) - await left_arm.run_angle(300,-100) - await drive_base.arc(-1000,None,-800) - - -async def Run2_1(): # Drone Survey, Experimental - Johannes - - await multitask( - right_arm.run_angle(400,100), - set_speed(600,200,300,200), - drive_base.straight(300) - ) - set_speed(600,500,300,200) - await drive_base.straight(470) - await drive_base.turn(-15) - await drive_base.straight(55) - await drive_base.straight(-280) - await drive_base.turn(15) - await right_arm.run_angle(400,-100) - await drive_base.straight(40) - await drive_base.turn(-15) - await drive_base.straight(50) - await drive_base.turn(-25) - - -async def Run3(): # Window to the Past, Leaf Cutter, Humongous Fungus, Experimental - Johannes - - await drive_base.straight(98) - await drive_base.turn(-45) - await drive_base.straight(300) - await right_arm.run_angle(300,120) - await drive_base.straight(290) - await drive_base.turn(50) - await drive_base.straight(250) - await drive_base.turn(40) - set_speed(100,200,300,200) - await drive_base.straight(177) - await drive_base.straight(-145) - await drive_base.turn(85) - await drive_base.straight(232) - set_speed(600, 500, 300, 200) - await drive_base.straight(-138) - await multitask( - drive_base.turn(-36), - right_arm.run_angle(200,-140) - ) - set_speed(100,200,300,200) - await drive_base.straight(230) - await right_arm.run_angle(300,105) - await wait(200) - await drive_base.turn(-90) - await drive_base.straight(-170) - set_speed(600,500,300,200) - await drive_base.straight(100) - await drive_base.arc(800,None,-900) - - -async def Run4(): #Flip the Rock, Lucky Leaves, Reaching Roots - Rishabh - - #Run await drive_base.straight(550)#Works (600(Previous)) await drive_base.straight(-200) await drive_base.turn(45) @@ -311,17 +219,99 @@ async def Run4(): #Flip the Rock, Lucky Leaves, Reaching Roots - Rishabh await drive_base.turn(30) await drive_base.straight(-1000) +async def Run2(): # Exploding Seeds - Johannes -async def Run5(): + await multitask( + right_arm.run_angle(400,-100), + drive_base.arc(150,None,115), + ) + await drive_base.straight(270) + await left_arm.run_angle(300,-80) + await drive_base.straight(-100) + await left_arm.run_angle(300,-100) + await drive_base.arc(-1000,None,-800) -async def Run6_7(): +async def Run3(): # Drone Survey - Johannes + + await multitask( + left_arm.run_angle(400,-300), + right_arm.run_angle(400,100), + drive_base.straight(900) + ) + await drive_base.turn(-25) + await drive_base.straight(110) + await drive_base.turn(-35) + await drive_base.turn(35) + await drive_base.straight(-30) + await drive_base.turn(25) + await drive_base.straight(-200) + await drive_base.turn(-45) + await drive_base.straight(500) + await drive_base.turn(75) + await drive_base.straight(700) -async def Run10(): - +async def Run4(): # Window to the Past, Leaf Cutter, Humongous Fungus, Experimental - Johannes -async def Run11(): # Interchangable Mission - Parthiv + await drive_base.straight(110) + await drive_base.turn(-45) + await drive_base.straight(280) + await right_arm.run_angle(300,120) + await left_arm.run_angle(400,200) + await drive_base.straight(-70) + await left_arm.run_angle(600,-110) + await drive_base.straight(370) + await drive_base.turn(50) + await multitask( + drive_base.straight(250), + left_arm.run_angle(600,-60) + ) + await drive_base.turn(40) + set_speed(100,200,300,200) + await drive_base.straight(170) + await drive_base.straight(-135) + await drive_base.turn(80) + await drive_base.straight(85) + await multitask( + drive_base.turn(-36), + right_arm.run_angle(200,-140) + ) + set_speed(100,200,300,200) + await drive_base.straight(235) + await multitask( + right_arm.run_angle(300,100), + left_arm.run_angle(200,140) + ) + await wait(200) + await drive_base.straight(30) + await drive_base.turn(-90) + await drive_base.straight(-170) + set_speed(600,500,300,200) + await drive_base.straight(100) + await drive_base.arc(800,None,-900) + + +async def Run5(): # Forest Elder - Parthiv + + await drive_base.straight(475) + await right_arm.run_angle(300,25) + await drive_base.turn(-20) + await left_arm.run_angle(200,245) + await drive_base.straight(60) + await drive_base.turn(25) + await left_arm.run_angle(100,-56.5) + await drive_base.straight(-50) + await drive_base.straight(50) + await drive_base.turn(-25) + await left_arm.run_angle(200,-200) + await drive_base.straight(-240) + await drive_base.turn(15) + await right_arm.run_angle(200,-200) + await drive_base.straight(-200) + await drive_base.stop + +async def Run6(): # Interchangable Mission - Parthiv await left_arm.run_angle(200,-80) await drive_base.arc(-350,angle=90) @@ -340,11 +330,15 @@ async def Run11(): # Interchangable Mission - Parthiv await drive_base.straight(-775) await drive_base.stop -async def Run12(): # Experimental Research Platform Lifter +async def Run7(): # Seed Dispersal - Parthiv + + set_speed(700,500,400,200) + await drive_base.straight(490) + await left_arm.run_angle(50,100) + await drive_base.straight(-490) + + - await multilift_up(1200) - await multilift_down(300) - await drive_base.straight(50) # Function to classify color based on HSV @@ -352,9 +346,9 @@ def detect_color(h, s, v, reflected): if reflected > 4: if h < 4 or h > 350: # red return "Red" - elif 3 < h < 40 and s > 70: # orange + elif 3 < h < 24 and s > 80: # orange return "Orange" - elif 47 < h < 56: # yellow + elif 30 < h < 60 and v > 50: # yellow return "Yellow" elif 70 < h < 160: # green - do it vertically not horizontally for accuracy return "Green" @@ -364,7 +358,8 @@ def detect_color(h, s, v, reflected): return "Blue" elif 260 < h < 350: # purple return "Purple" - + elif s < 15 and v > 70: # white + return "White" else: return "Unknown" return "Unknown" @@ -384,26 +379,28 @@ async def main(): if color == "Green": - print('Running Mission 1') + print('Running Mission 1, Detect Green') await Run1() elif color == "Red": - print('Running Mission 2') + print('Running Mission 2, Detect Red') await Run2() elif color == "Yellow": - print('Running Mission 3') + print('Running Mission 3, Detect Yellow') await Run3() elif color == "Blue": - print('Running Mission 4') + print('Running Mission 4, Detect Blue') await Run4() elif color == "Orange": - print('Running Mission 5') - await Run3() + print('Running Mission 5, Detect Orange') + await Run5() elif color == "Purple": - print('Running Mission 11') - await Run11() + print('Running Mission 6, Detect Purple') + await Run6() elif color == "Light_Blue": - print("Running Mission 12") - await Run12() + print('Running Mission 7, Detect Cyan') + await Run7() + elif color == "White": + print('Detect White') else: print(f"Unknown color detected (Hue: {h}, Sat: {s}, Val: {v})") #pass From 83363ed0c4d7ef2e50d7202353a5078f19846b7d Mon Sep 17 00:00:00 2001 From: Vihaan <33mangav@elmbrookstudents.org> Date: Fri, 9 Oct 2026 20:43:02 +0000 Subject: [PATCH 29/36] Add discovery-phase/missions/Exploding Seeds --- discovery-phase/missions/Exploding Seeds | 35 ++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 discovery-phase/missions/Exploding Seeds diff --git a/discovery-phase/missions/Exploding Seeds b/discovery-phase/missions/Exploding Seeds new file mode 100644 index 0000000..a0d0542 --- /dev/null +++ b/discovery-phase/missions/Exploding Seeds @@ -0,0 +1,35 @@ +from pybricks.hubs import PrimeHub +from pybricks.pupdevices import Motor, ColorSensor, UltrasonicSensor, ForceSensor +from pybricks.parameters import Button, Color, Direction, Port, Side, Stop +from pybricks.robotics import DriveBase +from pybricks.tools import wait, StopWatch + +# 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 = 62.4 # mm (adjust for your wheels) +AXLE_TRACK = 150 # mm (distance between wheels) +drive_base = DriveBase(left_motor, right_motor, WHEEL_DIAMETER, AXLE_TRACK) +drive_base.settings(600, 500, 300, 200) +drive_base.use_gyro(True) + +def set_default_speed(): + drive_base.settings(600, 500, 300, 200) + +def set_speed(straight_speed, st_acc, turn_speed, turn_acc): + drive_base.settings(straight_speed, st_acc, turn_speed, turn_acc) + +left_arm.run_angle(300,100) +drive_base.arc(150,None,115) +drive_base.straight(270) +left_arm.run_angle(300,-90) +drive_base.straight(-80) +left_arm.run_angle(300,-100) +drive_base.arc(-1000,None,-800) \ No newline at end of file From f3041b0483e823a6691fb43bd974871005fd5749 Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Sun, 11 Oct 2026 22:21:06 +0000 Subject: [PATCH 30/36] Update discovery-phase/missions/mission_experimental_hirohitus.py --- .../missions/mission_experimental_hirohitus.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/discovery-phase/missions/mission_experimental_hirohitus.py b/discovery-phase/missions/mission_experimental_hirohitus.py index eeb48be..dcf74b7 100644 --- a/discovery-phase/missions/mission_experimental_hirohitus.py +++ b/discovery-phase/missions/mission_experimental_hirohitus.py @@ -42,8 +42,13 @@ async def multilift_down(rotation_angle): async def main(): - await multilift_up(1200) - await multilift_down(300) - await drive_base.straight(50) + await drive_base.arc(900,None,400) + await drive_base.arc(-500,None,250) + set_speed(100,400,300,200) + await drive_base.straight(200) + await multilift_up(1950) + await multilift_down(500) + set_speed(1000,500,300,200) + await drive_base.arc(-1000,None,-900) run_task(main()) \ No newline at end of file From e608f7ea1f4abbd313489dcd4adb8fc682d3b25e Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Sun, 11 Oct 2026 22:21:31 +0000 Subject: [PATCH 31/36] Update discovery-phase/missions/mission_experimental_stalinus.py --- .../missions/mission_experimental_stalinus.py | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/discovery-phase/missions/mission_experimental_stalinus.py b/discovery-phase/missions/mission_experimental_stalinus.py index acdf272..93f8ef2 100644 --- a/discovery-phase/missions/mission_experimental_stalinus.py +++ b/discovery-phase/missions/mission_experimental_stalinus.py @@ -32,33 +32,39 @@ async def main(): await drive_base.straight(110) await drive_base.turn(-45) - await drive_base.straight(240) + await drive_base.straight(280) await right_arm.run_angle(300,120) - await drive_base.straight(290) + await left_arm.run_angle(400,200) + await drive_base.straight(-70) + await left_arm.run_angle(600,-110) + await drive_base.straight(370) await drive_base.turn(50) - await drive_base.straight(300) + await multitask( + drive_base.straight(250), + left_arm.run_angle(600,-60) + ) await drive_base.turn(40) set_speed(100,200,300,200) - await drive_base.straight(130) - await drive_base.straight(-115) - await drive_base.turn(87) - await drive_base.straight(230) - set_speed(600, 500, 300, 200) + await drive_base.straight(170) await drive_base.straight(-135) + await drive_base.turn(80) + await drive_base.straight(85) await multitask( - drive_base.turn(-40), - right_arm.run_angle(100,-110) + drive_base.turn(-36), + right_arm.run_angle(200,-140) ) set_speed(100,200,300,200) - await drive_base.straight(220) - await right_arm.run_angle(300,85) - await wait(500) - await drive_base.straight(142) - await drive_base.arc(110,None,-166) - await drive_base.straight(140) - await drive_base.straight(-150) + await drive_base.straight(230) + await multitask( + right_arm.run_angle(300,160), + left_arm.run_angle(300,150) + ) + await wait(200) + await drive_base.straight(30) + await drive_base.turn(-90) + await drive_base.straight(-170) set_speed(600,500,300,200) - await drive_base.straight(150) + await drive_base.straight(100) await drive_base.arc(800,None,-900) run_task(main()) \ No newline at end of file From a9d3cd971edb938f8e0c33828d6e06da532c222d Mon Sep 17 00:00:00 2001 From: Parthiv <31vadlap@elmbrookstudents.org> Date: Sun, 11 Oct 2026 23:57:01 +0000 Subject: [PATCH 32/36] Update discovery-phase/missions/Showcase_codes.py --- discovery-phase/missions/Showcase_codes.py | 47 +++++++++++++--------- 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/discovery-phase/missions/Showcase_codes.py b/discovery-phase/missions/Showcase_codes.py index caa2744..c3f471a 100644 --- a/discovery-phase/missions/Showcase_codes.py +++ b/discovery-phase/missions/Showcase_codes.py @@ -202,22 +202,27 @@ async def multilift_down(rotation_angle): ) -async def Run1(): # Flip The Rock, Lucky Leaves, Reaching Roots - Rishabh +async def Run1(): # Flip The Rock, Lucky Leaves, Reaching Roots - Parthiv - await drive_base.straight(550)#Works (600(Previous)) - await drive_base.straight(-200) + + await drive_base.straight(415) + await drive_base.straight(-150) await drive_base.turn(45) - await drive_base.straight(575) - await drive_base.turn(-90)#-90 for Coach Cisco table - await left_arm.run_angle(200,270) + await drive_base.straight(600) + await drive_base.turn(-90) + await multitask( + left_arm.run_angle(200,300), + right_arm.run_angle(200,-290) + ) + set_speed(100,500,300,200) await drive_base.straight(300) - await left_arm.run_angle(200,-265) - await right_arm.run_angle(200, -200) - await drive_base.straight(-105)#Use -105 for Coach Cisco table(-105 for school) - await drive_base.turn(32)#was 24-Use 24 for Coach Cisco's table(32 for school) - await right_arm.run_angle(1500, 180) - await drive_base.turn(30) - await drive_base.straight(-1000) + await left_arm.run_angle(200,-300) + await drive_base.straight(-95) + await drive_base.turn(22) + await right_arm.run_angle(5000,100) + await drive_base.straight(90) + set_speed(700,500,300,200) + await drive_base.arc(-700,angle=-150) async def Run2(): # Exploding Seeds - Johannes @@ -330,12 +335,18 @@ async def Run6(): # Interchangable Mission - Parthiv await drive_base.straight(-775) await drive_base.stop -async def Run7(): # Seed Dispersal - Parthiv +async def Run7(): # Seed Dispersal and Keystone - Parthiv - set_speed(700,500,400,200) - await drive_base.straight(490) - await left_arm.run_angle(50,100) - await drive_base.straight(-490) + await drive_base.straight(600) + await drive_base.arc(400,angle=35) + await drive_base.straight(-40) + await right_arm.run_angle(150,-70) + await drive_base.arc(400,angle=-35) + await drive_base.straight(-540) + await drive_base.turn(-90) + await drive_base.straight(200) + await left_arm.run_angle(100,100) + await drive_base.straight(-350) From d444fb97c55544ba53f7e67b8a98166f6926c06c Mon Sep 17 00:00:00 2001 From: Rishabh <32mathur@elmbrookstudents.org> Date: Sun, 20 Sep 2026 20:35:22 +0000 Subject: [PATCH 33/36] Add Mission 3, 4, & 5 --- Mission 3, 4, & 5 | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Mission 3, 4, & 5 diff --git a/Mission 3, 4, & 5 b/Mission 3, 4, & 5 new file mode 100644 index 0000000..7fedb23 --- /dev/null +++ b/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) + + From 2888d96d3099d32203a23dc6a2de6ed09d4c0c06 Mon Sep 17 00:00:00 2001 From: nifrali Date: Fri, 25 Sep 2026 18:28:21 +0000 Subject: [PATCH 34/36] Cleaning up main branh --- Mission 3, 4, & 5 | 42 ------------------------------------------ 1 file changed, 42 deletions(-) delete mode 100644 Mission 3, 4, & 5 diff --git a/Mission 3, 4, & 5 b/Mission 3, 4, & 5 deleted file mode 100644 index 7fedb23..0000000 --- a/Mission 3, 4, & 5 +++ /dev/null @@ -1,42 +0,0 @@ -#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) - - From 0cd478fde176d2e8b1be260b276447c732f21170 Mon Sep 17 00:00:00 2001 From: nifrali Date: Mon, 12 Oct 2026 11:15:42 -0500 Subject: [PATCH 35/36] resolving --- discovery-phase/missions/Showcase_codes.py | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/discovery-phase/missions/Showcase_codes.py b/discovery-phase/missions/Showcase_codes.py index c3f471a..933a963 100644 --- a/discovery-phase/missions/Showcase_codes.py +++ b/discovery-phase/missions/Showcase_codes.py @@ -261,13 +261,18 @@ async def Run4(): # Window to the Past, Leaf Cutter, Humongous Fungus, Experimen await drive_base.straight(110) await drive_base.turn(-45) +<<<<<<< HEAD await drive_base.straight(280) +======= + await drive_base.straight(300) +>>>>>>> 2b44156 (Update discovery-phase/missions/Showcase_codes.py) await right_arm.run_angle(300,120) await left_arm.run_angle(400,200) await drive_base.straight(-70) await left_arm.run_angle(600,-110) await drive_base.straight(370) await drive_base.turn(50) +<<<<<<< HEAD await multitask( drive_base.straight(250), left_arm.run_angle(600,-60) @@ -278,11 +283,23 @@ async def Run4(): # Window to the Past, Leaf Cutter, Humongous Fungus, Experimen await drive_base.straight(-135) await drive_base.turn(80) await drive_base.straight(85) +======= + await drive_base.straight(250) + await drive_base.turn(40) + set_speed(100,200,300,200) + await drive_base.straight(170) + await drive_base.straight(-145) + await drive_base.turn(80) + await drive_base.straight(230) + set_speed(600, 500, 300, 200) + await drive_base.straight(-138) +>>>>>>> 2b44156 (Update discovery-phase/missions/Showcase_codes.py) await multitask( drive_base.turn(-36), right_arm.run_angle(200,-140) ) set_speed(100,200,300,200) +<<<<<<< HEAD await drive_base.straight(235) await multitask( right_arm.run_angle(300,100), @@ -290,6 +307,11 @@ async def Run4(): # Window to the Past, Leaf Cutter, Humongous Fungus, Experimen ) await wait(200) await drive_base.straight(30) +======= + await drive_base.straight(230) + await right_arm.run_angle(300,105) + await wait(200) +>>>>>>> 2b44156 (Update discovery-phase/missions/Showcase_codes.py) await drive_base.turn(-90) await drive_base.straight(-170) set_speed(600,500,300,200) @@ -316,7 +338,11 @@ async def Run5(): # Forest Elder - Parthiv await drive_base.straight(-200) await drive_base.stop +<<<<<<< HEAD async def Run6(): # Interchangable Mission - Parthiv +======= +async def Run11(): # Interchangable Mission - Parthiv +>>>>>>> 2b44156 (Update discovery-phase/missions/Showcase_codes.py) await left_arm.run_angle(200,-80) await drive_base.arc(-350,angle=90) From ff561e51a09334f9a83b0fa02dcc5c9a80c670f6 Mon Sep 17 00:00:00 2001 From: Parthiv <31vadlap@elmbrookstudents.org> Date: Sun, 11 Oct 2026 23:57:01 +0000 Subject: [PATCH 36/36] Update discovery-phase/missions/Showcase_codes.py --- discovery-phase/missions/Showcase_codes.py | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/discovery-phase/missions/Showcase_codes.py b/discovery-phase/missions/Showcase_codes.py index 933a963..869e5d7 100644 --- a/discovery-phase/missions/Showcase_codes.py +++ b/discovery-phase/missions/Showcase_codes.py @@ -202,7 +202,12 @@ async def multilift_down(rotation_angle): ) +<<<<<<< HEAD async def Run1(): # Flip The Rock, Lucky Leaves, Reaching Roots - Parthiv +======= +<<<<<<< HEAD +async def Run1(): # Flip The Rock, Lucky Leaves, Reaching Roots - Johannes +>>>>>>> 3cd1849 (Update discovery-phase/missions/Showcase_codes.py) await drive_base.straight(415) @@ -336,7 +341,33 @@ async def Run5(): # Forest Elder - Parthiv await drive_base.turn(15) await right_arm.run_angle(200,-200) await drive_base.straight(-200) +<<<<<<< HEAD await drive_base.stop +======= +======= +async def Run1(): # Flip The Rock, Lucky Leaves, Reaching Roots - Parthiv + + + await drive_base.straight(415) + await drive_base.straight(-150) +>>>>>>> a9d3cd9 (Update discovery-phase/missions/Showcase_codes.py) + await drive_base.turn(45) + await drive_base.straight(600) + await drive_base.turn(-90) + await multitask( + left_arm.run_angle(200,300), + right_arm.run_angle(200,-290) + ) + set_speed(100,500,300,200) + await drive_base.straight(300) + await left_arm.run_angle(200,-300) + await drive_base.straight(-95) + await drive_base.turn(22) + await right_arm.run_angle(5000,100) + await drive_base.straight(90) + set_speed(700,500,300,200) + await drive_base.arc(-700,angle=-150) +>>>>>>> 3cd1849 (Update discovery-phase/missions/Showcase_codes.py) <<<<<<< HEAD async def Run6(): # Interchangable Mission - Parthiv @@ -361,6 +392,12 @@ async def Run11(): # Interchangable Mission - Parthiv await drive_base.straight(-775) await drive_base.stop +<<<<<<< HEAD +======= +<<<<<<< HEAD +async def Run12(): # Experimental Research Platform Lifter +======= +>>>>>>> 3cd1849 (Update discovery-phase/missions/Showcase_codes.py) async def Run7(): # Seed Dispersal and Keystone - Parthiv await drive_base.straight(600) @@ -375,6 +412,10 @@ async def Run7(): # Seed Dispersal and Keystone - Parthiv await drive_base.straight(-350) +<<<<<<< HEAD +======= +>>>>>>> a9d3cd9 (Update discovery-phase/missions/Showcase_codes.py) +>>>>>>> 3cd1849 (Update discovery-phase/missions/Showcase_codes.py)