From a902f29952144dbcc8f24c3075cff1f3a2705802 Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Mon, 22 Dec 2025 23:00:02 +0000 Subject: [PATCH 01/41] Add competition_codes/state/sunprarie_state_main.py --- .../state/sunprarie_state_main.py | 382 ++++++++++++++++++ 1 file changed, 382 insertions(+) create mode 100644 competition_codes/state/sunprarie_state_main.py diff --git a/competition_codes/state/sunprarie_state_main.py b/competition_codes/state/sunprarie_state_main.py new file mode 100644 index 0000000..942e488 --- /dev/null +++ b/competition_codes/state/sunprarie_state_main.py @@ -0,0 +1,382 @@ +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, 500, 300, 200) +drive_base.use_gyro(True) + +WALL_DISTANCE = 200 # mm + +async def drive_forward(): + """Drive forward continuously using DriveBase.""" + drive_base.drive(400, 0) + +async def drive_backward(): + """Drive forward continuously using DriveBase.""" + drive_base.drive(400, 0) + + +async def monitor_distance(): + """Monitor ultrasonic sensor and stop when wall is detected.""" + while True: + distance = await lazer_ranger.distance() + print('Distancing...',distance) + + if distance < WALL_DISTANCE: + # Stop the drivebase + drive_base.stop() + print(f"Wall detected at {distance}mm!") + break + if distance is None: + continue + + + # Small delay to prevent overwhelming the sensor + await wait(50) + +""" +Run#1 +- Removed forge and who lived here part +- What's on sale + Silo +- Green Key +""" +async def Run1(): + + await left_arm.run_until_stalled(1500 ,duty_limit=15) + left_arm.reset_angle(0) + await solve_whats_on_sale() + await solve_silo() + + # return to base + await drive_base.straight(-90) + #await drive_base.turn(-100) + await drive_base.arc(200,None,-300) + drive_base.stop() + +async def solve_whats_on_sale(): + + right_arm.run_angle(500,30) + left_arm.run_angle(500,-119.5) + await drive_base.straight(180) + + await drive_base.turn(-40) + await drive_base.straight(335) + await left_arm.run_angle(500,-20) + + await drive_base.straight(-100) + await drive_base.straight(60) + await left_arm.run_angle(500,50) + + await drive_base.straight(-100) + left_arm.run_angle(500,-50) + await drive_base.turn(-20) + left_arm.run_angle(1000,180) + await drive_base.turn(15) + +async def solve_silo(): + await drive_base.straight(-80) + await drive_base.turn(42) + await drive_base.straight(90) + + + await right_arm.run_angle(10000,-80, Stop.HOLD) + await right_arm.run_angle(10000,80, Stop.HOLD) + await right_arm.run_angle(10000,-80, Stop.HOLD) + await right_arm.run_angle(10000,80, Stop.HOLD) + await right_arm.run_angle(10000,-80, Stop.HOLD) + await right_arm.run_angle(10000,80, Stop.HOLD) + await right_arm.run_angle(10000,-80, Stop.HOLD) + right_arm.run_angle(4000,60, Stop.HOLD) + + +""" +Run#2 +- This to solve forge, who lived here and heavy lifting combined +- Red Key +""" +async def Run2(): + await solve_forge() + await solve_heavy_lifting() + await solve_who_lived_here() + + # return to base + await drive_base.arc(-500,None,600) + drive_base.stop() + +async def solve_forge(): + await right_arm.run_target(50,50) + # await right_arm.run_angle(50,-30) + await drive_base.arc(350,113, None) + + await drive_base.straight(20) + await drive_base.turn(-60) + await drive_base.straight(-47) + +async def solve_heavy_lifting(): + await right_arm.run_angle(2000,-160) # arm down + await wait(100) + await drive_base.turn(30) # turn right a little bit + await right_arm.run_angle(2000,160) #arm up + await drive_base.turn(-30) #reset position + +async def solve_who_lived_here(): + await drive_base.straight(50) + await drive_base.turn(-15) + await drive_base.straight(50) + await drive_base.turn(-25) + await drive_base.straight(-50) + await drive_base.turn(-40) + await drive_base.straight(50) + right_arm.run_angle(1000,-160) + await drive_base.turn(-60) + await right_arm.run_angle(2000,160) + +""" +Run#2.1 +- Alternate solution for Forge, Who lived here and Heavy Lifting combined +- Light Blue Key +- Different alignment +""" +async def Run2_1(): + await solve_forge_straight() + await solve_heavy_lifting() + await solve_who_lived_here() + + # return to base + await drive_base.arc(-500,None,600) + drive_base.stop() + +async def solve_forge_straight(): + await right_arm.run_target(50,50) + await right_arm.run_angle(50,-30) + await drive_base.straight(700) + # await drive_base.turn(-30) + # await drive_base.straight(20) + await drive_base.turn(-40) + await drive_base.straight(-30) + +""" +Run#3 +- Combined angler artifacts and tip the scale +- Yellow key +""" +async def Run3(): + await solve_angler_artifacts() + await solve_tip_the_scale() + + #cross over to red side + await multitask( + drive_forward(), + monitor_distance() + ) + +async def solve_angler_artifacts(): + await drive_base.straight(940) + await drive_base.turn(-90,Stop.HOLD) + await drive_base.straight(65) + #Solve + drive_base.turn(-10) + await left_arm.run_angle(10000,-3000) + await drive_base.straight(-110) + + await drive_base.turn(90) + await drive_base.arc(-150,-103, None) + +async def solve_tip_the_scale(): + await drive_base.turn(3) + await drive_base.straight(142.5) + await right_arm.run_angle(800,-150) + await right_arm.run_angle(900,150) + + await drive_base.straight(-100) + await drive_base.turn(-65) + await drive_base.straight(300,Stop.COAST_SMART) + await drive_base.arc(10,-47, None) + #await drive_base.turn(-23, Stop.COAST_SMART) + + + + + + +""" +Run #4 +- Solves the Mineshaft explorer + 2/3 Surface Brush + 1/3 Map Reveal +- Blue Key +""" +async def Run4(): + await drive_base.straight(700) + await drive_base.turn(-18) + await drive_base.straight(120) + await drive_base.straight(-210) + await drive_base.turn(61) + await drive_base.straight(133) + await right_arm.run_angle(400, -200) + await drive_base.straight(90) + await right_arm.run_angle(100, 95) + await drive_base.straight(-875) + +async def solve_brush_reveal(): + await drive_base.straight(700) + await drive_base.turn(-20) + await drive_base.straight(110) + await drive_base.straight(-210) + +async def solve_mineshaft_explorer(): + await drive_base.turn(63) + await drive_base.straight(130) + await right_arm.run_angle(1000, -90) + await drive_base.straight(84) + await right_arm.run_angle(300, 90) + +""" +Run#5 +- Solves Salvage Operation + Statue Rebuild +- Orange Key +""" +async def Run5(): + await drive_base.straight(550) + await right_arm.run_angle(300,100) + await drive_base.straight(-75) + await right_arm.run_angle(300, -100) + await drive_base.straight(300) + await drive_base.straight(-200) + await drive_base.turn(-15) + #solving statue + await drive_base.straight(350) + await drive_base.turn(-104) + await drive_base.straight(-80) + await left_arm.run_angle(500, -900) + await drive_base.straight(120) + await drive_base.turn(5) + await left_arm.run_angle(500, 290) + await drive_base.turn(18) + await drive_base.straight(-100) + await drive_base.turn(-90) + await drive_base.straight(900) + drive_base.stop() + + +async def solve_salvage_operation(): + await drive_base.straight(500) + await right_arm.run_angle(300,500) + await drive_base.straight(-75) + await right_arm.run_angle(300, -900) + await drive_base.straight(-350) + await wait(1000) + await drive_base.straight(800) + await drive_base.straight(-200) + await drive_base.turn(-15) + await drive_base.straight(350) + +async def solve_statue_rebuild(): + await drive_base.turn(-100) + await drive_base.straight(-80) + await left_arm.run_angle(500, -900) + await drive_base.straight(50) + await drive_base.straight(50) + await left_arm.run_angle(700, 250) + await drive_base.turn(30) + +""" +Run#6 +- Solve 2/3 Site Markings +- Run only if have time +- Purple Key +""" +async def Run6_7(): # experiment with ferris wheel for Site Markings + solve_site_mark_1() + solve_site_mark_2() + #return to base + await drive_base.straight(-300) + drive_base.stop() + +async def solve_site_mark_1(): + await drive_base.straight(500) + await right_arm.run_angle(100, -10) + await wait(50) + await drive_base.straight(-300) + await drive_base.arc(-150, -140, None) + +async def solve_site_mark_2(): + await drive_base.straight(-300) + await wait(50) + await right_arm.run_angle(50, 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: + h, s, v = await color_sensor.hsv() + print(color_sensor.color()) + print(h,s,v) + reflected = await color_sensor.reflection() + color = detect_color(h, s, v, reflected) + print(color) + + + 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 Run5() + elif color == "Purple": + print('Running Mission 6') + await Run6_7() + elif color == "Light_Blue": + print("Running Mission 2_1") + await Run2_1() + else: + print(f"Unknown color detected (Hue: {h}, Sat: {s}, Val: {v})") + await wait(10) +# Run the main function +run_task(main()) From 5a5b6d2d16d2eedff3c6709ccecc720cf4eb798e Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Wed, 24 Dec 2025 16:34:38 +0000 Subject: [PATCH 02/41] Update competition_codes/state/sunprarie_state_main.py Code optimization and additions to 1st run. --- .../state/sunprarie_state_main.py | 41 +++++++++++++------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/competition_codes/state/sunprarie_state_main.py b/competition_codes/state/sunprarie_state_main.py index 942e488..29f4509 100644 --- a/competition_codes/state/sunprarie_state_main.py +++ b/competition_codes/state/sunprarie_state_main.py @@ -50,6 +50,9 @@ async def monitor_distance(): # Small delay to prevent overwhelming the sensor await wait(50) + +def set_default_speed(): + drive_base.settings(600, 500, 300, 200) """ Run#1 - Removed forge and who lived here part @@ -58,11 +61,16 @@ Run#1 """ async def Run1(): - await left_arm.run_until_stalled(1500 ,duty_limit=15) + # Fast approach to near-stall position + await left_arm.run_angle(2000, 180) # Fast movement upward + + # Gentle stall detection (shorter distance = faster) + await left_arm.run_until_stalled(1500, duty_limit=15) left_arm.reset_angle(0) + await solve_whats_on_sale() await solve_silo() - + # return to base await drive_base.straight(-90) #await drive_base.turn(-100) @@ -94,14 +102,14 @@ async def solve_silo(): await drive_base.turn(42) await drive_base.straight(90) + SPEED = 10000 # speed in degree per second + SWING_ANGLE = 80 # the angle! + + # Repeat this motion 4 times + for _ in range(4): + await right_arm.run_angle(SPEED,SWING_ANGLE, Stop.COAST) # Swing up + await right_arm.run_angle(SPEED,(-1 * SWING_ANGLE),Stop.COAST) # Swing down - await right_arm.run_angle(10000,-80, Stop.HOLD) - await right_arm.run_angle(10000,80, Stop.HOLD) - await right_arm.run_angle(10000,-80, Stop.HOLD) - await right_arm.run_angle(10000,80, Stop.HOLD) - await right_arm.run_angle(10000,-80, Stop.HOLD) - await right_arm.run_angle(10000,80, Stop.HOLD) - await right_arm.run_angle(10000,-80, Stop.HOLD) right_arm.run_angle(4000,60, Stop.HOLD) @@ -319,7 +327,16 @@ async def solve_site_mark_2(): await wait(50) await right_arm.run_angle(50, 50) - +async def Run10(): # experiment with ferris wheel for Site Markings + + await drive_base.straight(680) + drive_base.settings(150, 750, 50, 750) + await drive_base.turn(-45) + await drive_base.straight(200) + set_default_speed() + await drive_base.straight(-100) + await drive_base.turn(45) + drive_base.stop() # Function to classify color based on HSV def detect_color(h, s, v, reflected): @@ -371,7 +388,7 @@ async def main(): await Run5() elif color == "Purple": print('Running Mission 6') - await Run6_7() + await Run10() elif color == "Light_Blue": print("Running Mission 2_1") await Run2_1() @@ -379,4 +396,4 @@ async def main(): print(f"Unknown color detected (Hue: {h}, Sat: {s}, Val: {v})") await wait(10) # Run the main function -run_task(main()) +run_task(main()) \ No newline at end of file From d9dec685c3e266f1447fcefe18dd419426e07184 Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Sun, 28 Dec 2025 01:55:38 +0000 Subject: [PATCH 03/41] Update competition_codes/state/sunprarie_state_main.py Slight updates to Send over and the first mission run. --- .../state/sunprarie_state_main.py | 32 ++++++++----------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/competition_codes/state/sunprarie_state_main.py b/competition_codes/state/sunprarie_state_main.py index 29f4509..7fd5991 100644 --- a/competition_codes/state/sunprarie_state_main.py +++ b/competition_codes/state/sunprarie_state_main.py @@ -25,7 +25,7 @@ WALL_DISTANCE = 200 # mm async def drive_forward(): """Drive forward continuously using DriveBase.""" - drive_base.drive(400, 0) + drive_base.drive(1000,0) async def drive_backward(): """Drive forward continuously using DriveBase.""" @@ -80,7 +80,11 @@ async def Run1(): async def solve_whats_on_sale(): right_arm.run_angle(500,30) - left_arm.run_angle(500,-119.5) + + #Automated inconsistency + #left_arm.run_angle(500,-119.5) + left_arm.run_target(500,-121.5, Stop.HOLD) + await drive_base.straight(180) await drive_base.turn(-40) @@ -195,28 +199,20 @@ async def Run3(): ) async def solve_angler_artifacts(): - await drive_base.straight(940) + await drive_base.straight(890) await drive_base.turn(-90,Stop.HOLD) - await drive_base.straight(65) + await drive_base.straight(45) #Solve drive_base.turn(-10) - await left_arm.run_angle(10000,-3000) - await drive_base.straight(-110) + await left_arm.run_angle(10000,-750) + await drive_base.straight(-130) - await drive_base.turn(90) - await drive_base.arc(-150,-103, None) + await drive_base.turn(67) async def solve_tip_the_scale(): - await drive_base.turn(3) - await drive_base.straight(142.5) - await right_arm.run_angle(800,-150) - await right_arm.run_angle(900,150) - - await drive_base.straight(-100) - await drive_base.turn(-65) - await drive_base.straight(300,Stop.COAST_SMART) - await drive_base.arc(10,-47, None) - #await drive_base.turn(-23, Stop.COAST_SMART) + await drive_base.straight(-200) + await drive_base.straight(60) + await drive_base.turn(22) From 6755e783f49c550475b7ebdf1e541cb5af423c63 Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Mon, 29 Dec 2025 05:44:11 +0000 Subject: [PATCH 04/41] Add competition_codes/state/run10_experimental.py --- competition_codes/state/run10_experimental.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 competition_codes/state/run10_experimental.py diff --git a/competition_codes/state/run10_experimental.py b/competition_codes/state/run10_experimental.py new file mode 100644 index 0000000..95dd75b --- /dev/null +++ b/competition_codes/state/run10_experimental.py @@ -0,0 +1,16 @@ +await drive_base.straight(600) + drive_base.settings(150, 750, 50, 500) + await drive_base.turn(-30) + await drive_base.straight(260) + left_arm.run_angle(300,218) + + set_default_speed() + await drive_base.straight(-80) + await drive_base.turn(30) + await drive_base.straight(-300) + await drive_base.straight(400) + #await left_arm.run_angle(50,120) + await drive_base.straight(-200) + await left_arm.run_angle(300,-215) + await drive_base.straight(-600) + drive_base.stop() From d5e7e5816a08baecb4cb49caa43230e5595ae919 Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Mon, 29 Dec 2025 05:44:44 +0000 Subject: [PATCH 05/41] Add competition_codes/state/run11_experimental.py --- competition_codes/state/run11_experimental.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 competition_codes/state/run11_experimental.py diff --git a/competition_codes/state/run11_experimental.py b/competition_codes/state/run11_experimental.py new file mode 100644 index 0000000..c342307 --- /dev/null +++ b/competition_codes/state/run11_experimental.py @@ -0,0 +1,16 @@ +await drive_base.straight(600) + drive_base.settings(150, 750, 50, 500) + await drive_base.turn(-30) + await drive_base.straight(250) + #left_arm.run_angle(300,218) + + set_default_speed() + await drive_base.straight(-80) + await drive_base.turn(30) + await drive_base.straight(-180) + #await drive_base.straight(400) + #await left_arm.run_angle(50,120) + #await drive_base.straight(-200) + await left_arm.run_angle(300,-300) + await drive_base.straight(-600) + drive_base.stop() From aa69eed5344307b6dbce26f456177b2c8105a6c6 Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Mon, 29 Dec 2025 19:25:24 +0000 Subject: [PATCH 06/41] Update competition_codes/state/sunprarie_state_main.py Updates to run 10. --- .../state/sunprarie_state_main.py | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/competition_codes/state/sunprarie_state_main.py b/competition_codes/state/sunprarie_state_main.py index 7fd5991..6d96528 100644 --- a/competition_codes/state/sunprarie_state_main.py +++ b/competition_codes/state/sunprarie_state_main.py @@ -325,13 +325,21 @@ async def solve_site_mark_2(): async def Run10(): # experiment with ferris wheel for Site Markings - await drive_base.straight(680) - drive_base.settings(150, 750, 50, 750) - await drive_base.turn(-45) - await drive_base.straight(200) + await drive_base.straight(600) + drive_base.settings(150, 750, 50, 500) + await drive_base.turn(-30) + await drive_base.straight(250) + #left_arm.run_angle(300,218) + set_default_speed() - await drive_base.straight(-100) - await drive_base.turn(45) + await drive_base.straight(-80) + await drive_base.turn(30) + await drive_base.straight(-180) + #await drive_base.straight(400) + #await left_arm.run_angle(50,120) + #await drive_base.straight(-200) + await left_arm.run_angle(300,-300) + await drive_base.straight(-600) drive_base.stop() # Function to classify color based on HSV From 54aa537877cf09f3b8d925edc2cc3d745430e12a Mon Sep 17 00:00:00 2001 From: Vickram <31kapoov@elmbrookstudents.org> Date: Mon, 29 Dec 2025 22:45:02 +0000 Subject: [PATCH 07/41] Fixed motor angles for the left arm --- competition_codes/state/sunprarie_state_main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/competition_codes/state/sunprarie_state_main.py b/competition_codes/state/sunprarie_state_main.py index 6d96528..568d5ad 100644 --- a/competition_codes/state/sunprarie_state_main.py +++ b/competition_codes/state/sunprarie_state_main.py @@ -266,10 +266,10 @@ async def Run5(): await drive_base.straight(350) await drive_base.turn(-104) await drive_base.straight(-80) - await left_arm.run_angle(500, -900) + await left_arm.run_angle(500, -300) await drive_base.straight(120) await drive_base.turn(5) - await left_arm.run_angle(500, 290) + await left_arm.run_angle(500, 120) await drive_base.turn(18) await drive_base.straight(-100) await drive_base.turn(-90) From 6dbcfbe146750b79312e248b79a476d1b5388be9 Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Sat, 3 Jan 2026 18:38:23 +0000 Subject: [PATCH 08/41] Update competition_codes/state/sunprarie_state_main.py Changes to Run 12 --- .../state/sunprarie_state_main.py | 72 +++++++++++++++++-- 1 file changed, 66 insertions(+), 6 deletions(-) diff --git a/competition_codes/state/sunprarie_state_main.py b/competition_codes/state/sunprarie_state_main.py index 568d5ad..95646be 100644 --- a/competition_codes/state/sunprarie_state_main.py +++ b/competition_codes/state/sunprarie_state_main.py @@ -323,7 +323,26 @@ async def solve_site_mark_2(): await wait(50) await right_arm.run_angle(50, 50) -async def Run10(): # experiment with ferris wheel for Site Markings +async def Run10(): # experimental map reveal attachment + + await drive_base.straight(600) + drive_base.settings(150, 750, 50, 500) + await drive_base.turn(-30) + await drive_base.straight(260) + left_arm.run_angle(300,218) + + set_default_speed() + await drive_base.straight(-80) + await drive_base.turn(30) + await drive_base.straight(-300) + await drive_base.straight(400) + #await left_arm.run_angle(50,120) + await drive_base.straight(-200) + await left_arm.run_angle(300,-215) + await drive_base.straight(-600) + drive_base.stop() + +async def Run11(): # experimental surface brushing attachment await drive_base.straight(600) drive_base.settings(150, 750, 50, 500) @@ -342,6 +361,46 @@ async def Run10(): # experiment with ferris wheel for Site Markings await drive_base.straight(-600) drive_base.stop() +async def Run12(): # experimental careful recovery attachment + + right_arm.reset_angle(0) + # This raises the left arm to avoid entanglement when turning + await left_arm.run_angle(2000, 180) # Fast movement upward + # Gentle stall detection (shorter distance = faster) + await left_arm.run_until_stalled(1500, duty_limit=15) + left_arm.reset_angle(0) + + # Drive the robot to the wall + await drive_base.straight(900) + await drive_base.turn(83) # Align robot to Mineshaft entrance + + # This change robot movement to slow + drive_base.settings(100, 100, 50, 500) + + # Bring down left arm to position + await left_arm.run_angle(2000, -180) + await left_arm.run_until_stalled(-1500,duty_limit=15) + left_arm.reset_angle(0) + + # Bring down right arm to position + await right_arm.run_target(2000,-120) + right_arm.reset_angle(0) + + await drive_base.straight(190) # Slowly move straight to mineshaft 190 mm + + await right_arm.run_angle(100,95,Stop.HOLD) # Raise mineshaft + await wait(50) + await left_arm.run_angle(100,60) # recover artifact by lifting arm 60 degrees + + # Moving back + await drive_base.straight(-200) + + # Return home + set_default_speed() # change movement robot movement to fast + await drive_base.turn(100) + await drive_base.straight(700) + drive_base.stop() + # Function to classify color based on HSV def detect_color(h, s, v, reflected): if reflected > 4: @@ -368,11 +427,11 @@ def detect_color(h, s, v, reflected): async def main(): while True: h, s, v = await color_sensor.hsv() - print(color_sensor.color()) - print(h,s,v) + #print(color_sensor.color()) + #print(h,s,v) reflected = await color_sensor.reflection() color = detect_color(h, s, v, reflected) - print(color) + #print(color) if color == "Green": @@ -392,12 +451,13 @@ async def main(): await Run5() elif color == "Purple": print('Running Mission 6') - await Run10() + await Run11() elif color == "Light_Blue": print("Running Mission 2_1") - await Run2_1() + await Run12() else: print(f"Unknown color detected (Hue: {h}, Sat: {s}, Val: {v})") + #pass await wait(10) # Run the main function run_task(main()) \ No newline at end of file From 4233cc5f742193b52aebac3f8e55b402b5fdd0f9 Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Sun, 4 Jan 2026 18:09:47 +0000 Subject: [PATCH 09/41] Update competition_codes/state/sunprarie_state_main.py Various updates to a few of the codes. --- competition_codes/state/sunprarie_state_main.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/competition_codes/state/sunprarie_state_main.py b/competition_codes/state/sunprarie_state_main.py index 95646be..16e2bc3 100644 --- a/competition_codes/state/sunprarie_state_main.py +++ b/competition_codes/state/sunprarie_state_main.py @@ -1,3 +1,5 @@ +#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. + 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 @@ -104,7 +106,7 @@ async def solve_whats_on_sale(): async def solve_silo(): await drive_base.straight(-80) await drive_base.turn(42) - await drive_base.straight(90) + await drive_base.straight(95) SPEED = 10000 # speed in degree per second SWING_ANGLE = 80 # the angle! @@ -199,7 +201,7 @@ async def Run3(): ) async def solve_angler_artifacts(): - await drive_base.straight(890) + await drive_base.straight(870) await drive_base.turn(-90,Stop.HOLD) await drive_base.straight(45) #Solve @@ -386,14 +388,14 @@ async def Run12(): # experimental careful recovery attachment await right_arm.run_target(2000,-120) right_arm.reset_angle(0) - await drive_base.straight(190) # Slowly move straight to mineshaft 190 mm + await drive_base.straight(180) # Slowly move straight to mineshaft 180 mm await right_arm.run_angle(100,95,Stop.HOLD) # Raise mineshaft await wait(50) await left_arm.run_angle(100,60) # recover artifact by lifting arm 60 degrees # Moving back - await drive_base.straight(-200) + await drive_base.straight(-190) # Return home set_default_speed() # change movement robot movement to fast From 3efdf8ecbcfaf41fe0e9288908b35826182192cf Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Mon, 5 Jan 2026 01:24:12 +0000 Subject: [PATCH 10/41] Update competition_codes/state/sunprarie_state_main.py Slight changes to motor angles in Run_5. --- competition_codes/state/sunprarie_state_main.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/competition_codes/state/sunprarie_state_main.py b/competition_codes/state/sunprarie_state_main.py index 16e2bc3..46d8021 100644 --- a/competition_codes/state/sunprarie_state_main.py +++ b/competition_codes/state/sunprarie_state_main.py @@ -257,21 +257,24 @@ Run#5 - Orange Key """ async def Run5(): + # Getting the sand down await drive_base.straight(550) await right_arm.run_angle(300,100) await drive_base.straight(-75) await right_arm.run_angle(300, -100) + # Shoving the boat into place await drive_base.straight(300) await drive_base.straight(-200) await drive_base.turn(-15) - #solving statue + # Solving statue await drive_base.straight(350) await drive_base.turn(-104) await drive_base.straight(-80) await left_arm.run_angle(500, -300) await drive_base.straight(120) await drive_base.turn(5) - await left_arm.run_angle(500, 120) + # Lift up statue + await left_arm.run_angle(500, 100, Stop.HOLD) await drive_base.turn(18) await drive_base.straight(-100) await drive_base.turn(-90) @@ -297,7 +300,7 @@ async def solve_statue_rebuild(): await left_arm.run_angle(500, -900) await drive_base.straight(50) await drive_base.straight(50) - await left_arm.run_angle(700, 250) + await left_arm.run_angle(700,200) await drive_base.turn(30) """ @@ -391,7 +394,6 @@ async def Run12(): # experimental careful recovery attachment await drive_base.straight(180) # Slowly move straight to mineshaft 180 mm await right_arm.run_angle(100,95,Stop.HOLD) # Raise mineshaft - await wait(50) await left_arm.run_angle(100,60) # recover artifact by lifting arm 60 degrees # Moving back From 4942f28e67c9f88faee75fc5d564500fdf653555 Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Tue, 6 Jan 2026 22:23:43 +0000 Subject: [PATCH 11/41] Update competition_codes/state/sunprarie_state_main.py Battery diagnostics added. --- .../state/sunprarie_state_main.py | 91 +++++++++++++++---- 1 file changed, 71 insertions(+), 20 deletions(-) diff --git a/competition_codes/state/sunprarie_state_main.py b/competition_codes/state/sunprarie_state_main.py index 46d8021..fd889af 100644 --- a/competition_codes/state/sunprarie_state_main.py +++ b/competition_codes/state/sunprarie_state_main.py @@ -1,5 +1,10 @@ -#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. +Francisco Liwa +7:58 AM (8 hours ago) +to me + +#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 @@ -23,8 +28,24 @@ drive_base = DriveBase(left_motor, right_motor, WHEEL_DIAMETER, AXLE_TRACK) drive_base.settings(600, 500, 300, 200) drive_base.use_gyro(True) -WALL_DISTANCE = 200 # mm +""" +Debugging helps +""" +DEBUG = 0 # 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 = 200 # mm async def drive_forward(): """Drive forward continuously using DriveBase.""" drive_base.drive(1000,0) @@ -47,14 +68,18 @@ async def monitor_distance(): break if distance is None: continue - - + # 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) + """ Run#1 - Removed forge and who lived here part @@ -69,8 +94,9 @@ async def Run1(): # Gentle stall detection (shorter distance = faster) await left_arm.run_until_stalled(1500, duty_limit=15) left_arm.reset_angle(0) + print(f"Initial left arm angle : {left_arm.angle()}") - await solve_whats_on_sale() + await solve_whats_on_sale_v2() await solve_silo() # return to base @@ -78,7 +104,7 @@ async def Run1(): #await drive_base.turn(-100) await drive_base.arc(200,None,-300) drive_base.stop() - + async def solve_whats_on_sale(): right_arm.run_angle(500,30) @@ -86,6 +112,33 @@ async def solve_whats_on_sale(): #Automated inconsistency #left_arm.run_angle(500,-119.5) left_arm.run_target(500,-121.5, Stop.HOLD) + print(f"Position left arm angle : {left_arm.angle()}") + + await drive_base.straight(180) + + await drive_base.turn(-40) + await drive_base.straight(335) + await left_arm.run_angle(500,-20) + + await drive_base.straight(-100) + await drive_base.straight(60) + await left_arm.run_angle(500,50) + + await drive_base.straight(-100) + left_arm.run_angle(500,-50) + await drive_base.turn(-20) + left_arm.run_angle(1000,180) + await drive_base.turn(15) + +async def solve_whats_on_sale_v2(): + + right_arm.run_angle(500,30) + + # Bring down left arm to position + await left_arm.run_angle(2000, -120) + #await left_arm.run_until_stalled(-500,duty_limit=15) + print(f"Position left arm angle : {left_arm.angle()}") + left_arm.reset_angle(0) await drive_base.straight(180) @@ -109,12 +162,14 @@ async def solve_silo(): await drive_base.straight(95) SPEED = 10000 # speed in degree per second - SWING_ANGLE = 80 # the angle! + SWING_ANGLE = 60 # the angle! + REBOUND_ADJ = 20 # Repeat this motion 4 times for _ in range(4): - await right_arm.run_angle(SPEED,SWING_ANGLE, Stop.COAST) # Swing up - await right_arm.run_angle(SPEED,(-1 * SWING_ANGLE),Stop.COAST) # Swing down + await right_arm.run_angle(SPEED,SWING_ANGLE, Stop.HOLD) # Swing up + await right_arm.run_angle(SPEED,(-1 * SWING_ANGLE),Stop.HOLD) # Swing down + right_arm.run_angle(4000,60, Stop.HOLD) @@ -430,12 +485,15 @@ def detect_color(h, s, v, reflected): async def main(): while True: + pressed = hub.buttons.pressed() h, s, v = await color_sensor.hsv() - #print(color_sensor.color()) - #print(h,s,v) reflected = await color_sensor.reflection() color = detect_color(h, s, v, reflected) - #print(color) + if DEBUG : + #print(color_sensor.color()) + #print(h,s,v) + #print(color) + print(f"button pressed: {pressed}") if color == "Green": @@ -458,10 +516,3 @@ async def main(): await Run11() elif color == "Light_Blue": print("Running Mission 2_1") - await Run12() - else: - print(f"Unknown color detected (Hue: {h}, Sat: {s}, Val: {v})") - #pass - await wait(10) -# Run the main function -run_task(main()) \ No newline at end of file From a116a9b3bbb77f8d9eb8ce4727265cfdc8856593 Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Tue, 6 Jan 2026 22:24:05 +0000 Subject: [PATCH 12/41] Update competition_codes/state/sunprarie_state_main.py --- competition_codes/state/sunprarie_state_main.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/competition_codes/state/sunprarie_state_main.py b/competition_codes/state/sunprarie_state_main.py index fd889af..4c5ac54 100644 --- a/competition_codes/state/sunprarie_state_main.py +++ b/competition_codes/state/sunprarie_state_main.py @@ -1,8 +1,3 @@ - -Francisco Liwa -7:58 AM (8 hours ago) -to me - #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 50d125a09e29161ab8a47616e1e26378f0bb3d7a Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Wed, 7 Jan 2026 00:17:23 +0000 Subject: [PATCH 13/41] Update competition_codes/state/sunprarie_state_main.py Forgot to add run task before --- .../state/sunprarie_state_main.py | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/competition_codes/state/sunprarie_state_main.py b/competition_codes/state/sunprarie_state_main.py index 4c5ac54..4f79446 100644 --- a/competition_codes/state/sunprarie_state_main.py +++ b/competition_codes/state/sunprarie_state_main.py @@ -26,7 +26,7 @@ drive_base.use_gyro(True) """ Debugging helps """ -DEBUG = 0 # Enable when you want to show logs +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 @@ -511,3 +511,26 @@ async def main(): await Run11() elif color == "Light_Blue": print("Running Mission 2_1") + 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 8b152a371d3d3e46cff0c2b1da9a6a1b4ea367c7 Mon Sep 17 00:00:00 2001 From: Rishikesh Lolapu <31lolapr@elmbrookstudents.org> Date: Thu, 8 Jan 2026 23:11:34 +0000 Subject: [PATCH 14/41] Add competition_codes/state/Updated state.py --- competition_codes/state/Updated state.py | 513 +++++++++++++++++++++++ 1 file changed, 513 insertions(+) create mode 100644 competition_codes/state/Updated state.py diff --git a/competition_codes/state/Updated state.py b/competition_codes/state/Updated state.py new file mode 100644 index 0000000..4b0cebb --- /dev/null +++ b/competition_codes/state/Updated state.py @@ -0,0 +1,513 @@ +#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 = 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, 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 = 200 # 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(): + """Monitor ultrasonic sensor and stop when wall is detected.""" + while True: + distance = await lazer_ranger.distance() + print('Distancing...',distance) + + if distance < WALL_DISTANCE: + # Stop the drivebase + drive_base.stop() + print(f"Wall detected at {distance}mm!") + break + if distance is None: + continue + + # 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) + +""" +Run#1 +- Removed forge and who lived here part +- What's on sale + Silo +- Green Key +""" +async def Run1(): + + # Fast approach to near-stall position + await left_arm.run_angle(2000, 180) # Fast movement upward + + # Gentle stall detection (shorter distance = faster) + await left_arm.run_until_stalled(1500, duty_limit=15) + left_arm.reset_angle(0) + print(f"Initial left arm angle : {left_arm.angle()}") + + await solve_whats_on_sale_v2() + await solve_silo() + + # return to base + await drive_base.straight(-90) + #await drive_base.turn(-100) + await drive_base.arc(200,None,-300) + drive_base.stop() + +async def solve_whats_on_sale(): + + right_arm.run_angle(500,30) + + #Automated inconsistency + #left_arm.run_angle(500,-119.5) + left_arm.run_target(500,-121.5, Stop.HOLD) + print(f"Position left arm angle : {left_arm.angle()}") + + await drive_base.straight(180) + + await drive_base.turn(-40) + await drive_base.straight(335) + await left_arm.run_angle(500,-20) + + await drive_base.straight(-100) + await drive_base.straight(60) + await left_arm.run_angle(500,50) + + await drive_base.straight(-100) + left_arm.run_angle(500,-50) + await drive_base.turn(-20) + left_arm.run_angle(1000,180) + await drive_base.turn(15) + +async def solve_whats_on_sale_v2(): + + right_arm.run_angle(500,30) + + # Bring down left arm to position + await left_arm.run_angle(2000, -120) + #await left_arm.run_until_stalled(-500,duty_limit=15) + print(f"Position left arm angle : {left_arm.angle()}") + left_arm.reset_angle(0) + + await drive_base.straight(180) + + await drive_base.turn(-40) + await drive_base.straight(335) + await left_arm.run_angle(500,-20) + + await drive_base.straight(-100) + await drive_base.straight(60) + await left_arm.run_angle(500,50) + + await drive_base.straight(-100) + left_arm.run_angle(500,-50) + await drive_base.turn(-20) + left_arm.run_angle(1000,180) + await drive_base.turn(15) + +async def solve_silo(): + await drive_base.straight(-80) + await drive_base.turn(42) + await drive_base.straight(95) + + SPEED = 10000 # speed in degree per second + SWING_ANGLE = 60 # the angle! + REBOUND_ADJ = 20 + + # Repeat this motion 4 times + for _ in range(4): + await right_arm.run_angle(SPEED,SWING_ANGLE, Stop.HOLD) # Swing up + await right_arm.run_angle(SPEED,(-1 * SWING_ANGLE),Stop.HOLD) # Swing down + + + right_arm.run_angle(4000,60, Stop.HOLD) + + +""" +Run#2 +- This to solve forge, who lived here and heavy lifting combined +- Red Key +""" +async def Run2(): + await solve_forge() + await solve_heavy_lifting() + await solve_who_lived_here() + + # return to base + await drive_base.arc(-500,None,600) + drive_base.stop() + +async def solve_forge(): + await right_arm.run_target(50,50) + # await right_arm.run_angle(50,-30) + await drive_base.arc(350,113, None) + + await drive_base.straight(20) + await drive_base.turn(-60) + await drive_base.straight(-47) + +async def solve_heavy_lifting(): + await right_arm.run_angle(2000,-160) # arm down + await wait(100) + await drive_base.turn(30) # turn right a little bit + await right_arm.run_angle(2000,160) #arm up + await drive_base.turn(-30) #reset position + +async def solve_who_lived_here(): + await drive_base.straight(50) + await drive_base.turn(-15) + await drive_base.straight(50) + await drive_base.turn(-25) + await drive_base.straight(-50) + await drive_base.turn(-40) + await drive_base.straight(50) + right_arm.run_angle(1000,-160) + await drive_base.turn(-60) + await right_arm.run_angle(2000,160) + +""" +Run#2.1 +- Alternate solution for Forge, Who lived here and Heavy Lifting combined +- Light Blue Key +- Different alignment +""" +async def Run2_1(): + await solve_forge_straight() + await solve_heavy_lifting() + await solve_who_lived_here() + + # return to base + await drive_base.arc(-500,None,600) + drive_base.stop() + +async def solve_forge_straight(): + await right_arm.run_target(50,50) + await right_arm.run_angle(50,-30) + await drive_base.straight(700) + # await drive_base.turn(-30) + # await drive_base.straight(20) + await drive_base.turn(-40) + await drive_base.straight(-30) + +""" +Run#3 +- Combined angler artifacts and tip the scale +- Yellow key +""" +async def Run3(): + await solve_angler_artifacts() + await solve_tip_the_scale() + + #cross over to red side + await multitask( + drive_forward(), + monitor_distance() + ) + +async def solve_angler_artifacts(): + await drive_base.straight(870) + await drive_base.turn(-90,Stop.HOLD) + await drive_base.straight(45) + #Solve + drive_base.turn(-10) + await left_arm.run_angle(10000,-750) + await drive_base.straight(-130) + + await drive_base.turn(67) + +async def solve_tip_the_scale(): + await drive_base.straight(-200) + await drive_base.straight(60) + await drive_base.turn(22) + + + + + + +""" +Run #4 +- Solves the Mineshaft explorer + 2/3 Surface Brush + 1/3 Map Reveal +- Blue Key +""" +async def Run4(): + await drive_base.straight(700) + await drive_base.turn(-18) + await drive_base.straight(120) + await drive_base.straight(-210) + await drive_base.turn(61) + await drive_base.straight(133) + await right_arm.run_angle(400, -200) + await drive_base.straight(90) + await right_arm.run_angle(100, 95) + await drive_base.straight(-875) + +async def solve_brush_reveal(): + await drive_base.straight(700) + await drive_base.turn(-20) + await drive_base.straight(110) + await drive_base.straight(-210) + +async def solve_mineshaft_explorer(): + await drive_base.turn(63) + await drive_base.straight(130) + await right_arm.run_angle(1000, -90) + await drive_base.straight(84) + await right_arm.run_angle(300, 90) + +""" +Run#5 +- Solves Salvage Operation + Statue Rebuild +- Orange Key +""" +async def Run5(): + # Getting the sand down + await drive_base.straight(550) + await right_arm.run_angle(300,100) + await drive_base.straight(-75) + await right_arm.run_angle(300, -100) + # Shoving the boat into place + await drive_base.straight(300) + await drive_base.straight(-200) + await drive_base.turn(-15) + # Solving statue + await drive_base.straight(350) + await drive_base.turn(-104) + await drive_base.straight(-80) + await left_arm.run_angle(500, -300) + await drive_base.straight(120) + await drive_base.turn(5) + # Lift up statue + await left_arm.run_angle(500, 100, Stop.HOLD) + await drive_base.turn(18) + await drive_base.straight(-100) + await drive_base.turn(-90) + await drive_base.straight(900) + drive_base.stop() + + +async def solve_salvage_operation(): + await drive_base.straight(500) + await right_arm.run_angle(300,500) + await drive_base.straight(-75) + await right_arm.run_angle(300, -900) + await drive_base.straight(-350) + await wait(1000) + await drive_base.straight(800) + await drive_base.straight(-200) + await drive_base.turn(-15) + await drive_base.straight(350) + +async def solve_statue_rebuild(): + await drive_base.turn(-100) + await drive_base.straight(-80) + await left_arm.run_angle(500, -900) + await drive_base.straight(50) + await drive_base.straight(50) + await left_arm.run_angle(700,200) + await drive_base.turn(30) + +""" +Run#6 +- Solve 2/3 Site Markings +- Run only if have time +- Purple Key +""" +async def Run6_7(): # experiment with ferris wheel for Site Markings + solve_site_mark_1() + solve_site_mark_2() + #return to base + await drive_base.straight(-300) + drive_base.stop() + +async def solve_site_mark_1(): + await drive_base.straight(500) + await right_arm.run_angle(100, -10) + await wait(50) + await drive_base.straight(-300) + await drive_base.arc(-150, -140, None) + +async def solve_site_mark_2(): + await drive_base.straight(-300) + await wait(50) + await right_arm.run_angle(50, 50) + +async def Run10(): # experimental map reveal attachment + + await drive_base.straight(600) + drive_base.settings(150, 750, 50, 500) + await drive_base.turn(-30) + await drive_base.straight(260) + left_arm.run_angle(300,218) + + set_default_speed() + await drive_base.straight(-80) + await drive_base.turn(30) + await drive_base.straight(-300) + await drive_base.straight(400) + #await left_arm.run_angle(50,120) + await drive_base.straight(-200) + await left_arm.run_angle(300,-215) + await drive_base.straight(-600) + drive_base.stop() + +async def Run11(): # experimental surface brushing attachment + + await drive_base.straight(600) + drive_base.settings(150, 750, 50, 500) + await drive_base.turn(-30) + await drive_base.straight(250) + #left_arm.run_angle(300,218) + + set_default_speed() + await drive_base.straight(-100) + await drive_base.turn(30) + await drive_base.straight(-190) + #await drive_base.straight(400) + #await left_arm.run_angle(50,120) + #await drive_base.straight(-200) + await left_arm.run_angle(300,-300) + await drive_base.straight(-600) + drive_base.stop() + +async def Run12(): + await drive_base.straight(900) + await drive_base.turn(83) + await left_arm.run_angle(3000, -300) + await right_arm.run_angle(1100, -180) + drive_base.settings(150, 50, 50, 50) + await drive_base.straight(120) + left_arm.reset_angle(0) + await left_arm.run_angle(50, 50) + await right_arm.run_angle(50, 90) + await drive_base.straight(-100) + drive_base.settings(950, 750, 750, 750) + await drive_base.turn(110) + await drive_base.straight(1000) + + +# 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 Run5() + elif color == "Purple": + print('Running Mission 6') + await Run11() + elif color == "Light_Blue": + print("Running Mission 2_1") + 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 fa28fbb0864a841e40c7d2939ef1ce5a5f8e4e87 Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Thu, 8 Jan 2026 23:21:51 +0000 Subject: [PATCH 15/41] Update competition_codes/state/sunprarie_state_main.py --- .../state/sunprarie_state_main.py | 51 +++++-------------- 1 file changed, 14 insertions(+), 37 deletions(-) diff --git a/competition_codes/state/sunprarie_state_main.py b/competition_codes/state/sunprarie_state_main.py index 4f79446..4b0cebb 100644 --- a/competition_codes/state/sunprarie_state_main.py +++ b/competition_codes/state/sunprarie_state_main.py @@ -406,9 +406,9 @@ async def Run11(): # experimental surface brushing attachment #left_arm.run_angle(300,218) set_default_speed() - await drive_base.straight(-80) + await drive_base.straight(-100) await drive_base.turn(30) - await drive_base.straight(-180) + await drive_base.straight(-190) #await drive_base.straight(400) #await left_arm.run_angle(50,120) #await drive_base.straight(-200) @@ -416,44 +416,21 @@ async def Run11(): # experimental surface brushing attachment await drive_base.straight(-600) drive_base.stop() -async def Run12(): # experimental careful recovery attachment - - right_arm.reset_angle(0) - # This raises the left arm to avoid entanglement when turning - await left_arm.run_angle(2000, 180) # Fast movement upward - # Gentle stall detection (shorter distance = faster) - await left_arm.run_until_stalled(1500, duty_limit=15) - left_arm.reset_angle(0) - - # Drive the robot to the wall +async def Run12(): await drive_base.straight(900) - await drive_base.turn(83) # Align robot to Mineshaft entrance - - # This change robot movement to slow - drive_base.settings(100, 100, 50, 500) - - # Bring down left arm to position - await left_arm.run_angle(2000, -180) - await left_arm.run_until_stalled(-1500,duty_limit=15) + await drive_base.turn(83) + await left_arm.run_angle(3000, -300) + await right_arm.run_angle(1100, -180) + drive_base.settings(150, 50, 50, 50) + await drive_base.straight(120) left_arm.reset_angle(0) + await left_arm.run_angle(50, 50) + await right_arm.run_angle(50, 90) + await drive_base.straight(-100) + drive_base.settings(950, 750, 750, 750) + await drive_base.turn(110) + await drive_base.straight(1000) - # Bring down right arm to position - await right_arm.run_target(2000,-120) - right_arm.reset_angle(0) - - await drive_base.straight(180) # Slowly move straight to mineshaft 180 mm - - await right_arm.run_angle(100,95,Stop.HOLD) # Raise mineshaft - await left_arm.run_angle(100,60) # recover artifact by lifting arm 60 degrees - - # Moving back - await drive_base.straight(-190) - - # Return home - set_default_speed() # change movement robot movement to fast - await drive_base.turn(100) - await drive_base.straight(700) - drive_base.stop() # Function to classify color based on HSV def detect_color(h, s, v, reflected): From a395daba025c7d292032f371e29f4d38b7e21dab Mon Sep 17 00:00:00 2001 From: Atharv Nagavarapu <30nagava@elmbrookstudents.org> Date: Fri, 9 Jan 2026 01:29:36 +0000 Subject: [PATCH 16/41] Delete RoshoDaGoat.py --- RoshoDaGoat.py | 42 ------------------------------------------ 1 file changed, 42 deletions(-) delete mode 100644 RoshoDaGoat.py diff --git a/RoshoDaGoat.py b/RoshoDaGoat.py deleted file mode 100644 index 7d84ee2..0000000 --- a/RoshoDaGoat.py +++ /dev/null @@ -1,42 +0,0 @@ -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, run_task, multitask - -hub = PrimeHub() - -# Initialize both motors. In this example, the motor on the -# left must turn counterclockwise to make the robot go forward. -left_motor = Motor(Port.A, Direction.COUNTERCLOCKWISE) -right_motor = Motor(Port.B) - -arm_motor = Motor(Port.D, Direction.CLOCKWISE) -arm_motor_left= Motor(Port.C, Direction.CLOCKWISE) -# Initialize the drive base. In this example, the wheel diameter is 56mm. -# The distance between the two wheel-ground contact points is 112mm. -drive_base = DriveBase(left_motor, right_motor, wheel_diameter=68.8, axle_track=180) - -print('The default settings are: ' + str(drive_base.settings())) -drive_base.settings(300,1000,300,750) -# Optionally, uncomment the line below to use the gyro for improved accuracy. -drive_base.use_gyro(True) - -async def main(): - await drive_base.straight(519) - await arm_motor_left.run_angle(-10000, 300) - await arm_motor_left.run_angle(10000, 600) - await drive_base.straight(160) - await drive_base.turn(-30) - await drive_base.straight(50) - await arm_motor.run_angle(3000, 3000) - await drive_base.straight(-150) - await drive_base.turn(135) - await drive_base.straight(50) - await arm_motor.run_angle(10000, -3000) - await drive_base.straight(-100) - await drive_base.turn(-54) - await arm_motor.run_angle(10000, -3000) - await drive_base.straight(200) - await arm_motor.run_angle(10000, 10000) -run_task(main()) \ No newline at end of file From 44bbcf176dac4ef80a65c709367032eec504393d Mon Sep 17 00:00:00 2001 From: Atharv Nagavarapu <30nagava@elmbrookstudents.org> Date: Fri, 9 Jan 2026 01:29:48 +0000 Subject: [PATCH 17/41] Delete config.py --- config.py | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 config.py diff --git a/config.py b/config.py deleted file mode 100644 index f59fbfb..0000000 --- a/config.py +++ /dev/null @@ -1,40 +0,0 @@ -# config.py - Robot configuration shared across all modules -from pybricks.hubs import PrimeHub -from pybricks.pupdevices import Motor, ColorSensor, UltrasonicSensor -from pybricks.parameters import Port - -# Initialize hub -hub = PrimeHub() - -# Robot hardware configuration -ROBOT_CONFIG = { - # Drive motors - 'left_motor': Motor(Port.A), - 'right_motor': Motor(Port.B), - - # Attachment motors - 'attachment_motor': Motor(Port.C), - 'lift_motor': Motor(Port.D), - - # Sensors - #'color_left': ColorSensor(Port.E), - 'color_back': ColorSensor(Port.F), - 'ultrasonic': UltrasonicSensor(Port.E), - - # Hub reference - 'hub': hub -} - -# Speed and distance constants -SPEEDS = { - 'FAST': 400, - 'NORMAL': 250, - 'SLOW': 100, - 'PRECISE': 50 -} - -DISTANCES = { - 'TILE_SIZE': 300, # mm per field tile - 'ROBOT_LENGTH': 180, # mm - 'ROBOT_WIDTH': 140 # mm -} \ No newline at end of file From b93ab2f7881305e97f8d2b5e3d0330a4ef5f534a Mon Sep 17 00:00:00 2001 From: Atharv Nagavarapu <30nagava@elmbrookstudents.org> Date: Fri, 9 Jan 2026 01:30:03 +0000 Subject: [PATCH 18/41] Delete test_10_17_2025.py --- test_10_17_2025.py | 303 --------------------------------------------- 1 file changed, 303 deletions(-) delete mode 100644 test_10_17_2025.py diff --git a/test_10_17_2025.py b/test_10_17_2025.py deleted file mode 100644 index 1d89281..0000000 --- a/test_10_17_2025.py +++ /dev/null @@ -1,303 +0,0 @@ -# Stuff from 10/15/2025 -# Atharv trying with no avail to add more colors to the color sensor logic 😭😭😭😭😭😭😭 -from pybricks.hubs import PrimeHub -from pybricks.pupdevices import Motor, ColorSensor -from pybricks.parameters import Port, Stop, Color, Direction -from pybricks.robotics import DriveBase -from pybricks.tools import wait, StopWatch, multitask, run_task - -hub = PrimeHub() -left_motor = Motor(Port.A, Direction.COUNTERCLOCKWISE) -right_motor = Motor(Port.B) -left_arm = Motor(Port.C)#, Direction.COUNTERCLOCKWISE) -right_arm = Motor(Port.D) -drive_base = DriveBase(left_motor, right_motor, wheel_diameter=68.8, axle_track=180) -drive_base.settings(550,700,100,100) -drive_base.use_gyro(True) -color_sensor = ColorSensor(Port.F) -Color.ORANGE = Color(28, 61, 61) -Color.BLUE = Color(230,100,100) -Color.YELLOW = Color(37, 85, 95) -Color.PURPLE = Color(326, 60, 87) -color_sensor.detectable_colors([Color.ORANGE, Color.BLUE, Color.GREEN, Color.WHITE, Color.RED, Color.YELLOW, Color.NONE, Color.PURPLE]) -hub.speaker.volume(50) # Set the volume of the speaker -color_sensor.detectable_colors() -# Celebration sound types -class CelebrationSound: - VICTORY_FANFARE = 0 - LEVEL_UP = 1 - SUCCESS_CHIME = 2 - TA_DA = 3 - POWER_UP = 4 - RICKROLL_INSPIRED = 5 - -async def play_victory_fanfare(): - """Classic victory fanfare""" - notes = [ - (262, 200), # C4 - (262, 200), # C4 - (262, 200), # C4 - (349, 600), # F4 - ] - - for freq, duration in notes: - await hub.speaker.beep(freq, duration) - await wait(50) -async def play_level_up(): - """Upward scale for level completion""" - notesold = [ - (262, 100), # C4 - (294, 100), # D4 - (330, 100), # E4 - (349, 100), # F4 - (392, 100), # G4 - (440, 100), # A4 - (494, 100), # B4 - (523, 300), # C5 - ] - notes = [ - (277, 100), - (330, 100), - (277, 100), - (554, 100), - (277, 100), - (413, 100), - (330, 100), - (277, 100), - (413, 100), - (277, 100), - (554, 100), - (413, 100), - (277, 100), - (413, 100), - (554, 100), - (413, 100) - ] - - for freq, duration in notes: - await hub.speaker.beep(freq, duration) - #await wait(20) -async def play_success_chime(): - """Simple success notification""" - notes = [ - (523, 150), # C5 - (659, 150), # E5 - (784, 300), # G5 - ] - - for freq, duration in notes: - await hub.speaker.beep(freq, duration) - await wait(50) -async def play_ta_da(): - """Classic "ta-da!" sound""" - notes = [ - (392, 200), # G4 - (523, 400), # C5 - ] - - for freq, duration in notes: - await hub.speaker.beep(freq, duration) - await wait(100) -async def play_power_up(): - """Rising power-up sound""" - for freq in range(200, 800, 50): - await hub.speaker.beep(freq, 50) - await wait(10) - await hub.speaker.beep(1000, 200) -async def play_rickroll_inspired(): - """Fun 80s-style dance beat inspired sound""" - # Upbeat bouncy rhythm - pattern = [ - (392, 200), (440, 200), (494, 200), (523, 200), - (440, 200), (392, 200), (349, 200), (392, 300), - (440, 200), (392, 200), (349, 200), (330, 400), - ] - - for freq, duration in pattern: - await hub.speaker.beep(freq, duration) - await wait(50) -async def celebrate_mission_complete(sound_type=CelebrationSound.SUCCESS_CHIME): - """ - Main celebration function to call after completing a mission. - Plays a sound and shows light animation. - - Args: - sound_type: CelebrationSound enum value (default: SUCCESS_CHIME) - """ - # Light show - hub.light.on(Color.GREEN) - - # Play the selected celebration sound - if sound_type == CelebrationSound.VICTORY_FANFARE: - await play_victory_fanfare() - elif sound_type == CelebrationSound.LEVEL_UP: - await play_level_up() - elif sound_type == CelebrationSound.SUCCESS_CHIME: - await play_success_chime() - elif sound_type == CelebrationSound.TA_DA: - await play_ta_da() - elif sound_type == CelebrationSound.POWER_UP: - await play_power_up() - elif sound_type == CelebrationSound.RICKROLL_INSPIRED: - await play_rickroll_inspired() - else: - await play_success_chime() # Default fallback - - # Blink the light - for _ in range(3): - hub.light.off() - await wait(100) - hub.light.on(Color.GREEN) - await wait(100) - - hub.light.off() - -async def Run1(): - left_arm.run_angle(1000, -300) - right_arm.run_angle(1000,500) - await drive_base.straight(320) - await right_arm.run_angle(5000,-500, Stop.HOLD) - await right_arm.run_angle(5000,500, Stop.HOLD) - await right_arm.run_angle(5000,-500, Stop.HOLD) - await right_arm.run_angle(5000,500, Stop.HOLD) - await right_arm.run_angle(5000,-500, Stop.HOLD) - await drive_base.turn(-20) - await drive_base.straight(277) - await drive_base.turn(20) - await drive_base.straight(65) - await drive_base.turn(-30) - right_arm.run_angle(50,500) - await drive_base.turn(45) - await drive_base.straight(-145) - await drive_base.turn(-60) - await drive_base.straight(90) - await left_arm.run_angle(1000, 450) - await drive_base.straight(-145) - await left_arm.run_angle(1000,-450) - await drive_base.straight(10) - await drive_base.turn(35) - await drive_base.straight(-700) - -async def Run2(): - await drive_base.straight(200) - await drive_base.turn(-20) - await drive_base.straight(525) - await drive_base.turn(60) - - await drive_base.straight(50) - await right_arm.run_angle(2000,1000) - await drive_base.straight(-50) - await drive_base.turn(45) - await drive_base.straight(50) - await right_arm.run_angle(350,-1000) - await drive_base.straight(-100) - await drive_base.turn(-100) - await drive_base.straight(-750) - - -async def Run3(): - await drive_base.straight(920) - await drive_base.turn(-90) - await drive_base.straight(60) - drive_base.turn(-10) - await left_arm.run_angle(10000,-4000) - await drive_base.straight(-110) - await drive_base.turn(90) - await drive_base.straight(2000) - -async def Run4(): - await drive_base.straight(519) - await drive_base.straight(519) - await arm_motor_left.run_angle(-10000, 300) - await arm_motor_left.run_angle(10000, 600) - await drive_base.straight(160) - await drive_base.turn(-30) - await drive_base.straight(50) - await arm_motor.run_angle(3000, 3000) - await drive_base.straight(-150) - await drive_base.turn(135) - await drive_base.straight(50) - await arm_motor.run_angle(10000, -3000) - await drive_base.straight(-100) - await drive_base.turn(-54) - await arm_motor.run_angle(10000, -3000) - await drive_base.straight(250) - await drive_base.turn(-5) - await arm_motor.run_angle(10000, 7000) - await drive_base.straight(-50) - await drive_base.turn(68) - await arm_motor.run_angle(10000, -6000) - await drive_base.straight(200) - await arm_motor.run_angle(10000, 4000) - await drive_base.turn(-40) - await arm_motor.run_angle(10000, 7000) - -async def Run5(): - await drive_base.straight(420) - await right_arm.run_angle(300,-100) - await drive_base.straight(-100) - await right_arm.run_angle(300, 100) - await drive_base.straight(-350) - - -async def Run6(): - left_arm.run_angle(500,200) - right_arm.run_angle(500,200) - await drive_base.straight(70) - - await drive_base.turn(-55) - await drive_base.straight(900) - await drive_base.turn(92.5) - - await drive_base.straight(75) - await drive_base.straight(21) - await right_arm.run_angle(500,-250) - await right_arm.run_angle(500,250) - await drive_base.turn(55) - - await left_arm.run_angle(300,-400) - - await drive_base.turn(46.5) - await drive_base.turn(-40) - await drive_base.straight(900) -async def main(): - while True: - - #await celebrate_mission_complete(CelebrationSound.LEVEL_UP) - color_reflected_percent = await color_sensor.reflection() - print(color_reflected_percent) - - color_detected = await color_sensor.color() - print(f'Detected color: {color_detected.h}, {color_detected.s}, {color_detected.v}') - if color_reflected_percent > 1: - if color_detected == Color.GREEN: - print('Running Mission 1') - await Run1() - #await celebrate_mission_complete(CelebrationSound.VICTORY_FANFARE) - elif color_detected == Color.WHITE: - print('Running Mission 2') - await Run2() - #await celebrate_mission_complete(CelebrationSound.RICKROLL_INSPIRED) - elif color_detected == Color.YELLOW: - print('Running Mission 3') - await Run3() - #await celebrate_mission_complete(CelebrationSound.SUCCESS_CHIME ) - elif color_detected == Color.BLUE: - print('Running Mission 4') - await Run4() - #await celebrate_mission_complete(CelebrationSound.POWER_UP) - elif color_detected == Color.ORANGE: - print('Running Mission 5') - await Run5() - #await celebrate_mission_complete(CelebrationSound.LEVEL_UP) - elif color_detected == Color.PURPLE: - print('Running Mission 6 (this is ayaan\'s code)') - await Run6() - #await celebrate_mission_complete(CelebrationSound.LEVEL_UP) - else: - hub.light.off() - left_motor.stop() - right_motor.stop() - await wait(1000) #prevent loop from iterating fast -# Main execution loop -run_task(main()) From 79158d0f15af2766ddf1e0dcf6877c2ca129c93e Mon Sep 17 00:00:00 2001 From: Atharv Nagavarapu <30nagava@elmbrookstudents.org> Date: Fri, 9 Jan 2026 13:22:24 +0000 Subject: [PATCH 19/41] Update competition_codes/regional-final/RegionalFinalOld.py --- .../regional-final/RegionalFinalOld.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename RegionalFinal.py => competition_codes/regional-final/RegionalFinalOld.py (100%) diff --git a/RegionalFinal.py b/competition_codes/regional-final/RegionalFinalOld.py similarity index 100% rename from RegionalFinal.py rename to competition_codes/regional-final/RegionalFinalOld.py From 3bbf3fb2e6dcfebf0667a75577aa6fc51920df0b Mon Sep 17 00:00:00 2001 From: Atharv Nagavarapu <30nagava@elmbrookstudents.org> Date: Fri, 9 Jan 2026 13:22:47 +0000 Subject: [PATCH 20/41] Update competition_codes/twist_scrimmagetwist_scrimmage.py --- .../twist_scrimmagetwist_scrimmage.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename twist_scrimmage.py => competition_codes/twist_scrimmagetwist_scrimmage.py (100%) diff --git a/twist_scrimmage.py b/competition_codes/twist_scrimmagetwist_scrimmage.py similarity index 100% rename from twist_scrimmage.py rename to competition_codes/twist_scrimmagetwist_scrimmage.py From ba3e83343404b97433f7ec1d733cee0fa53fd300 Mon Sep 17 00:00:00 2001 From: Atharv Nagavarapu <30nagava@elmbrookstudents.org> Date: Fri, 9 Jan 2026 13:22:52 +0000 Subject: [PATCH 21/41] Update competition_codes/twist_scrimmage/twist_scrimmage.py --- .../twist_scrimmage.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename competition_codes/{twist_scrimmagetwist_scrimmage.py => twist_scrimmage/twist_scrimmage.py} (100%) diff --git a/competition_codes/twist_scrimmagetwist_scrimmage.py b/competition_codes/twist_scrimmage/twist_scrimmage.py similarity index 100% rename from competition_codes/twist_scrimmagetwist_scrimmage.py rename to competition_codes/twist_scrimmage/twist_scrimmage.py From b3ab479bc43c65f9fb590ac8c563f18f3fd669a9 Mon Sep 17 00:00:00 2001 From: Atharv Nagavarapu <30nagava@elmbrookstudents.org> Date: Fri, 9 Jan 2026 13:24:33 +0000 Subject: [PATCH 22/41] Update final/old_combined/1main.py --- final/{ => old_combined}/1main.py | 1 - 1 file changed, 1 deletion(-) rename final/{ => old_combined}/1main.py (99%) diff --git a/final/1main.py b/final/old_combined/1main.py similarity index 99% rename from final/1main.py rename to final/old_combined/1main.py index f535603..4912045 100644 --- a/final/1main.py +++ b/final/old_combined/1main.py @@ -1,4 +1,3 @@ - from pybricks.hubs import PrimeHub from pybricks.pupdevices import Motor, ColorSensor from pybricks.parameters import Port, Stop, Color, Direction From dbf5fc4880176662854bf5bc2559154427d9b0ee Mon Sep 17 00:00:00 2001 From: Atharv Nagavarapu <30nagava@elmbrookstudents.org> Date: Fri, 9 Jan 2026 13:24:59 +0000 Subject: [PATCH 23/41] Update old_combined/1main.py --- {final/old_combined => old_combined}/1main.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {final/old_combined => old_combined}/1main.py (100%) diff --git a/final/old_combined/1main.py b/old_combined/1main.py similarity index 100% rename from final/old_combined/1main.py rename to old_combined/1main.py From b0fd33d6b063e2b36471043e0d0fbece7930ad44 Mon Sep 17 00:00:00 2001 From: Atharv Nagavarapu <30nagava@elmbrookstudents.org> Date: Fri, 9 Jan 2026 13:25:06 +0000 Subject: [PATCH 24/41] Update old_combined/2main.py --- {final => old_combined}/2main.py | 1 - 1 file changed, 1 deletion(-) rename {final => old_combined}/2main.py (99%) diff --git a/final/2main.py b/old_combined/2main.py similarity index 99% rename from final/2main.py rename to old_combined/2main.py index 7c0940d..892e31c 100644 --- a/final/2main.py +++ b/old_combined/2main.py @@ -1,4 +1,3 @@ - from pybricks.hubs import PrimeHub from pybricks.pupdevices import Motor, ColorSensor from pybricks.parameters import Port, Stop, Color, Direction From 664defae7347bab73914b5ce205502dd2b26a51d Mon Sep 17 00:00:00 2001 From: Atharv Nagavarapu <30nagava@elmbrookstudents.org> Date: Fri, 9 Jan 2026 13:25:14 +0000 Subject: [PATCH 25/41] Update old_combined/3main.py --- {final => old_combined}/3main.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {final => old_combined}/3main.py (100%) diff --git a/final/3main.py b/old_combined/3main.py similarity index 100% rename from final/3main.py rename to old_combined/3main.py From ccd30af870c0ddb48a2e0007e8bdf6e82497956d Mon Sep 17 00:00:00 2001 From: Atharv Nagavarapu <30nagava@elmbrookstudents.org> Date: Fri, 9 Jan 2026 13:27:28 +0000 Subject: [PATCH 26/41] Update old_combined/4main.py --- {final => old_combined}/4main.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {final => old_combined}/4main.py (100%) diff --git a/final/4main.py b/old_combined/4main.py similarity index 100% rename from final/4main.py rename to old_combined/4main.py From 65373a16d3a78a7a82125a957cebbcb58e6d0130 Mon Sep 17 00:00:00 2001 From: Atharv Nagavarapu <30nagava@elmbrookstudents.org> Date: Fri, 9 Jan 2026 13:27:35 +0000 Subject: [PATCH 27/41] Update old_combined/main5.py --- {final => old_combined}/main5.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {final => old_combined}/main5.py (100%) diff --git a/final/main5.py b/old_combined/main5.py similarity index 100% rename from final/main5.py rename to old_combined/main5.py From 3e4dab3c9c38905589d55e3404fe2ce304e0ad50 Mon Sep 17 00:00:00 2001 From: Atharv Nagavarapu <30nagava@elmbrookstudents.org> Date: Fri, 9 Jan 2026 13:28:45 +0000 Subject: [PATCH 28/41] Delete utils/color_sensor_navi.py --- utils/color_sensor_navi.py | 41 -------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 utils/color_sensor_navi.py diff --git a/utils/color_sensor_navi.py b/utils/color_sensor_navi.py deleted file mode 100644 index 54bb542..0000000 --- a/utils/color_sensor_navi.py +++ /dev/null @@ -1,41 +0,0 @@ -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 - -hub = PrimeHub() - -# Robot hardware configuration
ROBOT_CONFIG = {
 # Drive motors
 'left_motor': Motor(Port.A),
 'right_motor': Motor(Port.B),
 
 # Attachment motors
 'attachment_motor': Motor(Port.C),
 'lift_motor': Motor(Port.D),
 
 # Sensors
 'color_left': ColorSensor(Port.E),
 'color_right': ColorSensor(Port.F),
 'ultrasonic': UltrasonicSensor(Port.S1),
 
 # Hub reference
 'hub': hub
}

# Speed and distance constants
SPEEDS = {
 'FAST': 400,
 'NORMAL': 250,
 'SLOW': 100,
 'PRECISE': 50
}

DISTANCES = {
 'TILE_SIZE': 300, # mm per field tile
 'ROBOT_LENGTH': 180, # mm
 'ROBOT_WIDTH': 140 # mm
} - - -def mission_run_1(): - print('Running missions in Run 1') - -def mission_run_2(): - print('Running missions in Run 2') - -def mission_run_3(): - print('Running missions in Run 3') - -# In main.py - sensor-based navigation -def main(self): - """Use color sensor to select runs""" - print("Place colored object in front of sensor:") - print("RED=Run1, GREEN=Run2, BLUE=Run3, YELLOW=Test") - while True: - color = ROBOT_CONFIG['color_left'].color() - if color == Color.RED: - mission_run_1() - break - elif color == Color.GREEN: - mission_run_2() - break - elif color == Color.BLUE: - mission_run_3() - break - elif color == Color.YELLOW: - self.test_mode() - break - wait(1000) -main() From aed13bedff07ad165620ff3924fe3847e4841041 Mon Sep 17 00:00:00 2001 From: Atharv Nagavarapu <30nagava@elmbrookstudents.org> Date: Fri, 9 Jan 2026 13:29:06 +0000 Subject: [PATCH 29/41] Delete utils/constants.py --- utils/constants.py | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 utils/constants.py diff --git a/utils/constants.py b/utils/constants.py deleted file mode 100644 index f74d325..0000000 --- a/utils/constants.py +++ /dev/null @@ -1,13 +0,0 @@ -#Speed and distance constants -SPEEDS = { - 'FAST': 400, - 'NORMAL': 250, - 'SLOW': 100, - 'PRECISE': 50 -} - -DISTANCES = { - 'TILE_SIZE': 300, # mm per field tile - 'ROBOT_LENGTH': 180, # mm - 'ROBOT_WIDTH': 140 # mm -} \ No newline at end of file From e306b7dce164b9a85008a2bcb052dc7580506a9f Mon Sep 17 00:00:00 2001 From: Atharv Nagavarapu <30nagava@elmbrookstudents.org> Date: Fri, 9 Jan 2026 13:30:08 +0000 Subject: [PATCH 30/41] Delete utils/starter_drivebase_code.py --- utils/starter_drivebase_code.py | 36 --------------------------------- 1 file changed, 36 deletions(-) delete mode 100644 utils/starter_drivebase_code.py diff --git a/utils/starter_drivebase_code.py b/utils/starter_drivebase_code.py deleted file mode 100644 index d7cb0b7..0000000 --- a/utils/starter_drivebase_code.py +++ /dev/null @@ -1,36 +0,0 @@ -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 - -hub = PrimeHub() - -# Initialize both motors. In this example, the motor on the -# left must turn counterclockwise to make the robot go forward. -left_motor = Motor(Port.A, Direction.COUNTERCLOCKWISE) -right_motor = Motor(Port.B) - -arm_motor = Motor(Port.E, Direction.CLOCKWISE) -arm_motor.run_angle(299,90, Stop.HOLD) -# Initialize the drive base. In this example, the wheel diameter is 56mm. -# The distance between the two wheel-ground contact points is 112mm. -drive_base = DriveBase(left_motor, right_motor, wheel_diameter=54, axle_track=112) - -print('The default settings are: ' + str(drive_base.settings())) -drive_base.settings(100,1000,166,750) -# Optionally, uncomment the line below to use the gyro for improved accuracy. -drive_base.use_gyro(True) - -# Drive forward by 500mm (half a meter). -drive_base.straight(500) - -# Turn around clockwise by 180 degrees. -drive_base.turn(180) - -# Drive forward again to get back to the start. -drive_base.straight(500) - -# Turn around counterclockwise. -drive_base.turn(-180) -arm_motor.run_angle(299,-90, Stop.HOLD) \ No newline at end of file From 0e009d2da4371a57bbd72e1e26bb5db1364c8616 Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Fri, 9 Jan 2026 14:33:43 +0000 Subject: [PATCH 31/41] Update competition_codes/state/sunprarie_state_main.py --- competition_codes/state/sunprarie_state_main.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/competition_codes/state/sunprarie_state_main.py b/competition_codes/state/sunprarie_state_main.py index 4b0cebb..e9e6fb0 100644 --- a/competition_codes/state/sunprarie_state_main.py +++ b/competition_codes/state/sunprarie_state_main.py @@ -84,14 +84,14 @@ Run#1 async def Run1(): # Fast approach to near-stall position - await left_arm.run_angle(2000, 180) # Fast movement upward + await left_arm.run_angle(2000, -190) # Fast movement downward # Gentle stall detection (shorter distance = faster) - await left_arm.run_until_stalled(1500, duty_limit=15) + await left_arm.run_until_stalled(-1500, duty_limit=15) left_arm.reset_angle(0) print(f"Initial left arm angle : {left_arm.angle()}") - await solve_whats_on_sale_v2() + await solve_whats_on_sale_v3() await solve_silo() # return to base @@ -100,13 +100,13 @@ async def Run1(): await drive_base.arc(200,None,-300) drive_base.stop() -async def solve_whats_on_sale(): +async def solve_whats_on_sale_v3(): right_arm.run_angle(500,30) #Automated inconsistency #left_arm.run_angle(500,-119.5) - left_arm.run_target(500,-121.5, Stop.HOLD) + left_arm.run_target(500,70, Stop.HOLD) print(f"Position left arm angle : {left_arm.angle()}") await drive_base.straight(180) @@ -412,6 +412,7 @@ async def Run11(): # experimental surface brushing attachment #await drive_base.straight(400) #await left_arm.run_angle(50,120) #await drive_base.straight(-200) + await wait(67) await left_arm.run_angle(300,-300) await drive_base.straight(-600) drive_base.stop() From 70c4df4a12fec062207b50fc4a62c5acd4cd86b4 Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Sat, 10 Jan 2026 03:01:48 +0000 Subject: [PATCH 32/41] Update competition_codes/state/sunprarie_state_main.py --- competition_codes/state/sunprarie_state_main.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/competition_codes/state/sunprarie_state_main.py b/competition_codes/state/sunprarie_state_main.py index e9e6fb0..765521e 100644 --- a/competition_codes/state/sunprarie_state_main.py +++ b/competition_codes/state/sunprarie_state_main.py @@ -408,12 +408,9 @@ async def Run11(): # experimental surface brushing attachment set_default_speed() await drive_base.straight(-100) await drive_base.turn(30) - await drive_base.straight(-190) #await drive_base.straight(400) #await left_arm.run_angle(50,120) #await drive_base.straight(-200) - await wait(67) - await left_arm.run_angle(300,-300) await drive_base.straight(-600) drive_base.stop() From e46897548b30e12d1f03e2ccd6cd19660a40f54b Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Sat, 10 Jan 2026 03:02:02 +0000 Subject: [PATCH 33/41] Update competition_codes/state/sunprarie_state_main.py --- competition_codes/state/sunprarie_state_main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/competition_codes/state/sunprarie_state_main.py b/competition_codes/state/sunprarie_state_main.py index 765521e..981a6e9 100644 --- a/competition_codes/state/sunprarie_state_main.py +++ b/competition_codes/state/sunprarie_state_main.py @@ -84,7 +84,7 @@ Run#1 async def Run1(): # Fast approach to near-stall position - await left_arm.run_angle(2000, -190) # Fast movement downward + await left_arm.run_angle(2000, -210) # Fast movement downward # Gentle stall detection (shorter distance = faster) await left_arm.run_until_stalled(-1500, duty_limit=15) @@ -106,7 +106,8 @@ async def solve_whats_on_sale_v3(): #Automated inconsistency #left_arm.run_angle(500,-119.5) - left_arm.run_target(500,70, Stop.HOLD) + await left_arm.run_angle(500, 75,Stop.HOLD) + #await left_arm.run_target(500,90,Stop.HOLD) print(f"Position left arm angle : {left_arm.angle()}") await drive_base.straight(180) @@ -153,7 +154,7 @@ async def solve_whats_on_sale_v2(): async def solve_silo(): await drive_base.straight(-80) - await drive_base.turn(42) + await drive_base.turn(43) await drive_base.straight(95) SPEED = 10000 # speed in degree per second From 54dd1db320f93c5c859b5b4644c0c1b875575b08 Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Sun, 11 Jan 2026 00:47:37 +0000 Subject: [PATCH 34/41] Update competition_codes/state/sunprarie_state_main.py --- competition_codes/state/sunprarie_state_main.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/competition_codes/state/sunprarie_state_main.py b/competition_codes/state/sunprarie_state_main.py index 981a6e9..a085862 100644 --- a/competition_codes/state/sunprarie_state_main.py +++ b/competition_codes/state/sunprarie_state_main.py @@ -84,7 +84,7 @@ Run#1 async def Run1(): # Fast approach to near-stall position - await left_arm.run_angle(2000, -210) # Fast movement downward + await left_arm.run_angle(2000, -190) # Fast movement downward # Gentle stall detection (shorter distance = faster) await left_arm.run_until_stalled(-1500, duty_limit=15) @@ -106,8 +106,7 @@ async def solve_whats_on_sale_v3(): #Automated inconsistency #left_arm.run_angle(500,-119.5) - await left_arm.run_angle(500, 75,Stop.HOLD) - #await left_arm.run_target(500,90,Stop.HOLD) + left_arm.run_target(500,70, Stop.HOLD) print(f"Position left arm angle : {left_arm.angle()}") await drive_base.straight(180) @@ -154,7 +153,7 @@ async def solve_whats_on_sale_v2(): async def solve_silo(): await drive_base.straight(-80) - await drive_base.turn(43) + await drive_base.turn(42) await drive_base.straight(95) SPEED = 10000 # speed in degree per second @@ -407,12 +406,14 @@ async def Run11(): # experimental surface brushing attachment #left_arm.run_angle(300,218) set_default_speed() - await drive_base.straight(-100) + await drive_base.straight(-120) await drive_base.turn(30) #await drive_base.straight(400) #await left_arm.run_angle(50,120) #await drive_base.straight(-200) - await drive_base.straight(-600) + await drive_base.straight(-129) + await left_arm.run_angle(300, -75) + await drive_base.straight(-400) drive_base.stop() async def Run12(): From eb9b2ca30fc37654217fa2a0035a9a04b1aad645 Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Sun, 11 Jan 2026 00:57:25 +0000 Subject: [PATCH 35/41] Update competition_codes/state/sunprarie_state_main.py --- competition_codes/state/sunprarie_state_main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/competition_codes/state/sunprarie_state_main.py b/competition_codes/state/sunprarie_state_main.py index a085862..f91001f 100644 --- a/competition_codes/state/sunprarie_state_main.py +++ b/competition_codes/state/sunprarie_state_main.py @@ -406,12 +406,12 @@ async def Run11(): # experimental surface brushing attachment #left_arm.run_angle(300,218) set_default_speed() - await drive_base.straight(-120) + await drive_base.straight(-210) await drive_base.turn(30) #await drive_base.straight(400) #await left_arm.run_angle(50,120) #await drive_base.straight(-200) - await drive_base.straight(-129) + await drive_base.straight(-119) await left_arm.run_angle(300, -75) await drive_base.straight(-400) drive_base.stop() From 2d57f65a58977bd3dfac8fd45c37e49b2de5b991 Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Sun, 11 Jan 2026 01:19:39 +0000 Subject: [PATCH 36/41] Update competition_codes/state/sunprarie_state_main.py --- competition_codes/state/sunprarie_state_main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/competition_codes/state/sunprarie_state_main.py b/competition_codes/state/sunprarie_state_main.py index f91001f..5d2eb14 100644 --- a/competition_codes/state/sunprarie_state_main.py +++ b/competition_codes/state/sunprarie_state_main.py @@ -411,9 +411,9 @@ async def Run11(): # experimental surface brushing attachment #await drive_base.straight(400) #await left_arm.run_angle(50,120) #await drive_base.straight(-200) - await drive_base.straight(-119) + await drive_base.straight(-80) await left_arm.run_angle(300, -75) - await drive_base.straight(-400) + await drive_base.straight(-600) drive_base.stop() async def Run12(): From 67c6554c61c00ba290878d50d6188961da314c0b Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Sun, 11 Jan 2026 20:16:08 +0000 Subject: [PATCH 37/41] Update competition_codes/state/sunprarie_state_main.py --- competition_codes/state/sunprarie_state_main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/competition_codes/state/sunprarie_state_main.py b/competition_codes/state/sunprarie_state_main.py index 5d2eb14..4f6560d 100644 --- a/competition_codes/state/sunprarie_state_main.py +++ b/competition_codes/state/sunprarie_state_main.py @@ -412,7 +412,7 @@ async def Run11(): # experimental surface brushing attachment #await left_arm.run_angle(50,120) #await drive_base.straight(-200) await drive_base.straight(-80) - await left_arm.run_angle(300, -75) + #await left_arm.run_angle(300, -75) await drive_base.straight(-600) drive_base.stop() From ea9723a67d01ed9ad27096ef8bc7cffa6c90de4e Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Mon, 12 Jan 2026 03:30:25 +0000 Subject: [PATCH 38/41] Update competition_codes/state/sunprarie_state_main.py --- competition_codes/state/sunprarie_state_main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/competition_codes/state/sunprarie_state_main.py b/competition_codes/state/sunprarie_state_main.py index 4f6560d..974a4d1 100644 --- a/competition_codes/state/sunprarie_state_main.py +++ b/competition_codes/state/sunprarie_state_main.py @@ -412,8 +412,8 @@ async def Run11(): # experimental surface brushing attachment #await left_arm.run_angle(50,120) #await drive_base.straight(-200) await drive_base.straight(-80) - #await left_arm.run_angle(300, -75) - await drive_base.straight(-600) + await left_arm.run_angle(300, -75) + await drive_base.arc(550,None,800) drive_base.stop() async def Run12(): From edd49e0a9bbcea62d6b26627860f2ef88ab20421 Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Mon, 12 Jan 2026 03:36:10 +0000 Subject: [PATCH 39/41] Update competition_codes/state/sunprarie_state_main.py --- competition_codes/state/sunprarie_state_main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/competition_codes/state/sunprarie_state_main.py b/competition_codes/state/sunprarie_state_main.py index 974a4d1..d7beea2 100644 --- a/competition_codes/state/sunprarie_state_main.py +++ b/competition_codes/state/sunprarie_state_main.py @@ -411,9 +411,9 @@ async def Run11(): # experimental surface brushing attachment #await drive_base.straight(400) #await left_arm.run_angle(50,120) #await drive_base.straight(-200) - await drive_base.straight(-80) - await left_arm.run_angle(300, -75) - await drive_base.arc(550,None,800) + #await drive_base.straight(-80) + #await left_arm.run_angle(300, -75) + await drive_base.arc(-650,None,-800) drive_base.stop() async def Run12(): From 782b6ec78f51b11398aa69788a7863aae1dedd0a Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Mon, 12 Jan 2026 03:37:32 +0000 Subject: [PATCH 40/41] Update competition_codes/state/sunprarie_state_main.py --- competition_codes/state/sunprarie_state_main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/competition_codes/state/sunprarie_state_main.py b/competition_codes/state/sunprarie_state_main.py index d7beea2..2507054 100644 --- a/competition_codes/state/sunprarie_state_main.py +++ b/competition_codes/state/sunprarie_state_main.py @@ -406,7 +406,7 @@ async def Run11(): # experimental surface brushing attachment #left_arm.run_angle(300,218) set_default_speed() - await drive_base.straight(-210) + await drive_base.straight(-230) await drive_base.turn(30) #await drive_base.straight(400) #await left_arm.run_angle(50,120) From ba9ddf6373ed8e04254660a4ad18a8ff543bd247 Mon Sep 17 00:00:00 2001 From: Atharv Nagavarapu <30nagava@elmbrookstudents.org> Date: Wed, 14 Jan 2026 17:32:46 +0000 Subject: [PATCH 41/41] Update competition_codes/state/sunprarie_state_main_FINAL.py --- ...{sunprarie_state_main.py => sunprarie_state_main_FINAL.py} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename competition_codes/state/{sunprarie_state_main.py => sunprarie_state_main_FINAL.py} (99%) diff --git a/competition_codes/state/sunprarie_state_main.py b/competition_codes/state/sunprarie_state_main_FINAL.py similarity index 99% rename from competition_codes/state/sunprarie_state_main.py rename to competition_codes/state/sunprarie_state_main_FINAL.py index 2507054..04d244c 100644 --- a/competition_codes/state/sunprarie_state_main.py +++ b/competition_codes/state/sunprarie_state_main_FINAL.py @@ -24,9 +24,9 @@ drive_base.settings(600, 500, 300, 200) drive_base.use_gyro(True) """ -Debugging helps +Debugging helps :) """ -DEBUG = 1 # Enable when you want to show logs +DEBUG = 0 # 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