Update regionals/bioglow_mission_3_4_5_experimental.py

This commit is contained in:
2026-11-08 17:15:36 +00:00
parent 962eab1e03
commit d345fab7f7

View File

@@ -18,33 +18,41 @@ import robot # drive base, arms, sensors and moves all come from robot.py
async def solve_missions(): # Flip The Rock, Lucky Leaves, Reaching Roots - Rishabh
# --- 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()
await robot.home_arms() # arms: where they are now = 0
robot.drive_base.reset() # reset drive base
# --- 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.
await robot.settle_gyro()
await robot.settle_gyro(ms=10)
await robot.move(45.5) # 45.5 cm forward
await robot.move(-20) # 20 cm backward
await robot.turn(45, then=robot.Stop.HOLD) # 45° right
await robot.move(48) # 48 cm forward
await robot.turn(-80, then=robot.Stop.HOLD) # 80° left
await robot.right_arm.move_by(5, speed=50) # Lower the right arm to align to the root
await robot.move(90,speed=70,then=robot.Stop.BRAKE) # Move straight towards the root 90 cm
await robot.right_arm.move_by(180, speed=100) # Solve the root by spinning the arm
await robot.move(-25) #move back
# Aligning to Lucky leaves
await robot.multitask(
robot.left_arm.move_by(100, speed=47), # left arm 100°, 47% arm speed
robot.right_arm.move_by(-120, speed=47) # right arm -120°, 47% arm speed
robot.turn(-12) , # 30° left
robot.left_arm.move_by(90, speed=80)
)
await robot.move(24, speed=30) # 24 cm forward
await robot.left_arm.move_by(-300, speed=47) # left arm -300°, 47% arm speed
await robot.move(-5) # 5 cm backward
await robot.turn(35) # 35° right
await robot.right_arm.move_by(120, speed=100) # right arm 120°, 100% arm speed | Was 5000
await robot.arc(-70, degrees=-150) # arc: circle on the robot's LEFT (70 cm radius), BACKWARD 150° (back end swings left, nose turns right)
# Collect leaves
await robot.move(12,speed=40)
await robot.left_arm.move_by(-90, speed=47) # left arm -90°, 47% arm speed
await robot.move(-15,then=robot.Stop.COAST) # 15cm backward
await robot.arc(-30, degrees=-90) # arc: circle on the robot's LEFT (30 cm radius), BACKWARD 90° (back end swings left, nose turns right)
# Turns to Flip the rock and solve it
await robot.turn(-75,then=robot.Stop.HOLD) # 75° left
await robot.move(20)
# Return to home area and stop the robot
await robot.move(-50)
robot.stop()
if __name__ == "__main__": # This run this mission stand-alone when not called from bioglow_main.py
robot.run_task(solve_missions())