From 6e82f4d476f5d99f29d1d8892fd5ff3f3efcd841 Mon Sep 17 00:00:00 2001 From: Vickram <31kapoov@elmbrookstudents.org> Date: Fri, 7 Nov 2025 23:12:55 +0000 Subject: [PATCH] Add missions/New_MapReveal/New_MapReveal_Mineshaft.py Rishi's updated code --- .../New_MapReveal/New_MapReveal_Mineshaft.py | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 missions/New_MapReveal/New_MapReveal_Mineshaft.py diff --git a/missions/New_MapReveal/New_MapReveal_Mineshaft.py b/missions/New_MapReveal/New_MapReveal_Mineshaft.py new file mode 100644 index 0000000..2113b9b --- /dev/null +++ b/missions/New_MapReveal/New_MapReveal_Mineshaft.py @@ -0,0 +1,38 @@ +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) +left_arm = Motor(Port.C) +right_arm = Motor(Port.D) +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 main(): + await drive_base.straight(700) + await drive_base.turn(-20) + await drive_base.straight(110) + await drive_base.straight(-220) + await drive_base.turn(63) + await drive_base.straight(130) + await right_arm.run_angle(1000, -1200) + await drive_base.straight(84) + await right_arm.run_angle(300, 1200) + await drive_base.straight(-875) + +run_task(main()) \ No newline at end of file