Update regionals/bioglow_missions_3_4_5.py
Updates from experimental
This commit is contained in:
@@ -18,34 +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
|
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
|
#await robot.home_arms() # arms: where they are now = 0
|
||||||
# and call that spot 0, so every arm move starts from the same place each run.
|
robot.drive_base.reset() # reset drive base
|
||||||
# Before using it: set home_backward for each arm in robot.py (run arm_calibrate.py).
|
|
||||||
# await robot.home_arms()
|
|
||||||
|
|
||||||
# --- LET THE GYRO SETTLE ----------------------------------------------
|
# --- LET THE GYRO SETTLE ----------------------------------------------
|
||||||
# Wait half a second (and until the hub is perfectly still) before moving,
|
# Wait half a second (and until the hub is perfectly still) before moving,
|
||||||
# so turns are measured from a steady heading.
|
# 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(-18) # 18 cm backward
|
|
||||||
await robot.turn(45) # 45° right
|
|
||||||
await robot.move(50.8) # 50.8 cm forward
|
|
||||||
await robot.turn(-80) # 80° left
|
|
||||||
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
|
|
||||||
)
|
|
||||||
|
|
||||||
await robot.move(25) # 25 cm forward
|
await robot.right_arm.move_by(5, speed=50) # Lower the right arm to align to the root
|
||||||
await robot.left_arm.move_by(-300, speed=47) # left arm -300°, 47% arm speed
|
await robot.move(90,speed=70,then=robot.Stop.BRAKE) # Move straight towards the root 90 cm
|
||||||
await robot.move(-3.8) # 3.8 cm backward
|
await robot.right_arm.move_by(180, speed=100) # Solve the root by spinning the arm
|
||||||
await robot.turn(30) # 30° right
|
|
||||||
await robot.right_arm.move_by(120, speed=100) # right arm 120°, 100% arm speed | Was 5000
|
await robot.move(-25) #move back
|
||||||
await robot.move(4) # 4 cm forward
|
|
||||||
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)
|
# Aligning to Lucky leaves
|
||||||
|
await robot.multitask(
|
||||||
|
robot.turn(-12) , # 30° left
|
||||||
|
robot.left_arm.move_by(90, speed=80)
|
||||||
|
)
|
||||||
|
|
||||||
|
# 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
|
if __name__ == "__main__": # This run this mission stand-alone when not called from bioglow_main.py
|
||||||
robot.run_task(solve_missions())
|
robot.run_task(solve_missions())
|
||||||
Reference in New Issue
Block a user