From 94a6b0d7f19e789bd3894a25876e7eef4c9b1bdc Mon Sep 17 00:00:00 2001 From: Johannes <31liwaj@elmbrookstudents.org> Date: Sun, 8 Nov 2026 17:16:13 +0000 Subject: [PATCH] Update regionals/bioglow_mission_2.py --- regionals/bioglow_mission_2.py | 62 +++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/regionals/bioglow_mission_2.py b/regionals/bioglow_mission_2.py index d7d2f0a..de3f7a7 100644 --- a/regionals/bioglow_mission_2.py +++ b/regionals/bioglow_mission_2.py @@ -18,12 +18,6 @@ import robot # drive base, arms, sensors and moves all come from robot.py async def solve_missions(): # Exploding Seeds - Johannes - # --- ARM HOMING (optional) ------------------------------------------- - # Uncomment the next line to push both arms gently against their hard stops - # and call that spot 0, so every arm move starts from the same place each run. - # Before using it: set home_backward for each arm in robot.py (run arm_calibrate.py). - # await robot.home_arms() - # --- LET THE GYRO SETTLE ---------------------------------------------- # Wait half a second (and until the hub is perfectly still) before moving, # so turns are measured from a steady heading. @@ -31,37 +25,57 @@ async def solve_missions(): # Exploding Seeds - Johannes robot.stop() robot.reset() + + # Solving Exploding seeds await robot.move(2, speed=100, acceleration=400, then=robot.Stop.NONE) # 2 cm forward, 100% speed, 400 mm/s² accel await robot.arc(15, cm=11.5, speed=100, turn_speed=48, acceleration=400, turn_acceleration=100, then=robot.Stop.NONE) # arc: circle on the robot's RIGHT (15 cm radius), FORWARD 11.5 cm along it (nose turns right) | 100% speed, 48% turn speed, 400 mm/s² accel, 100 °/s² turn accel - await robot.move(27, speed=100, acceleration=400, then=robot.Stop.HOLD) # 27 cm forward, 100% speed, 400 mm/s² accel + await robot.move(27, speed=100, acceleration=400, then=robot.Stop.HOLD) await robot.left_arm.move_by(70, speed=70) # left arm 70°, 70% arm speed await robot.move(-3, speed=100, acceleration=400) # 3 cm backward, 100% speed, 400 mm/s² accel - await robot.left_arm.move_by(20, speed=23) # left arm 20°, 23% arm speed - await robot.move(-30, speed=100, acceleration=400, then=robot.Stop.COAST), # 30 cm backward, 100% speed, 400 mm/s² accel + await robot.left_arm.move_by(15, speed=23) # left arm 20°, 23% arm speed + + await robot.move(-30, speed=100, acceleration=400, then=robot.Stop.COAST) # 30 cm backward, 100% speed, 400 mm/s² accel await robot.multitask( - robot.right_arm.move_by(-110, speed=100), # right arm -110°, 100% arm speed - robot.left_arm.move_by(-100, speed=100), # left arm -100°, 100% arm speed + #robot.right_arm.move_by(-110, speed=100), # Don't drop the right arm + robot.left_arm.move_by(-100, speed=100), robot.turn(-40, speed=48, acceleration=100, then=robot.Stop.HOLD) # 40° left, 48% turn speed, 100 °/s² turn accel ) - await robot.arc(61, degrees=70, speed=100, turn_speed=48, acceleration=400, turn_acceleration=100, then=robot.Stop.HOLD) # arc: circle on the robot's RIGHT (61 cm radius), FORWARD 70° (nose turns right) | 100% speed, 48% turn speed, 400 mm/s² accel, 100 °/s² turn accel - await robot.turn(-78, speed=48, acceleration=100, then=robot.Stop.HOLD) # 78° left, 48% turn speed, 100 °/s² turn accel - await robot.move(12, speed=18, acceleration=200, then=robot.Stop.COAST) # 12 cm forward, 18% speed, 200 mm/s² accel + + # Towards the vine + await robot.arc(61, degrees=70, speed=80, turn_speed=48, acceleration=400, turn_acceleration=100, then=robot.Stop.HOLD) # arc: circle on the robot's RIGHT (61 cm radius), FORWARD 70° (nose turns right) | 100% speed, 48% turn speed, 400 mm/s² accel, 100 °/s² turn accel + + # This where we drop the right arm + await robot.multitask( + robot.right_arm.move_by(-110, speed=100), + robot.turn(-75, speed=70, acceleration=100, then=robot.Stop.HOLD) + ) + + # Untangled the vine + await robot.move(10, speed=70, acceleration=200, then=robot.Stop.COAST) await robot.right_arm.move_by(70, speed=100) # right arm 70°, 100% arm speed - await robot.move(-13, speed=18, acceleration=200, then=robot.Stop.COAST) # 13 cm backward, 18% speed, 200 mm/s² accel + await robot.move(-18, speed=60, acceleration=200, then=robot.Stop.COAST) # 13 cm backward, 18% speed, 200 mm/s² accel + + # Solving Sunlight roof await robot.multitask( robot.turn(95, speed=48, acceleration=100, then=robot.Stop.HOLD), # 95° right, 48% turn speed, 100 °/s² turn accel - robot.right_arm.move_by(-40, speed=100) # right arm -40°, 100% arm speed + robot.right_arm.move_by(100, speed=100) # right arm -40°, 100% arm speed ) - await robot.multitask( - robot.move(16, speed=100, acceleration=400, then=robot.Stop.COAST), # 16 cm forward, 100% speed, 400 mm/s² accel - robot.right_arm.move_by(110, speed=100) # right arm 110°, 100% arm speed - ) - await robot.move(-40, speed=100, acceleration=400, then=robot.Stop.COAST) # 40 cm backward, 100% speed, 400 mm/s² accel - await robot.turn(100, speed=48, acceleration=100, then=robot.Stop.NONE) # 100° right, 48% turn speed, 100 °/s² turn accel - await robot.move(70, speed=100, acceleration=400, then=robot.Stop.COAST) # 70 cm forward, 100% speed, 400 mm/s² accel - robot.stop() # FIXED: was `await drive_base.stop` (crashed) + await robot.move(18, speed=100, acceleration=400, then=robot.Stop.COAST), # 16 cm forward, 100% speed, 400 mm/s² accel + await robot.move(-5, speed=60, acceleration=200, then=robot.Stop.COAST) # 13 cm backward, 18% speed, 200 mm/s² accel + + # Return to barracks + await robot.move(-15, speed=100, acceleration=400, then=robot.Stop.NONE) + await robot.arc(30, degrees=-90,then = robot.Stop.NONE) + await robot.move(-40, speed=100, acceleration=400, then=robot.Stop.BRAKE) + robot.stop() +# For testing a part of a solution +def run_test_something(): + await robot.arc(30, degrees=-90,then = robot.Stop.NONE) + await robot.move(-40, speed=100, acceleration=400, then=robot.Stop.BRAKE) + return if __name__ == "__main__": # This run this mission stand-alone when not called from bioglow_main.py robot.run_task(solve_missions()) + #robot.run_task(run_test_something()) -- Uncomment this for testing and comment the line above \ No newline at end of file