From 9ca07a36a85212810bc05427473762f5b1d420e2 Mon Sep 17 00:00:00 2001 From: Rishikesh Lolapu <31lolapr@elmbrookstudents.org> Date: Thu, 6 Nov 2025 01:06:09 +0000 Subject: [PATCH] Update missions/Boat.py --- missions/Boat.py | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/missions/Boat.py b/missions/Boat.py index bb42eb7..47064db 100644 --- a/missions/Boat.py +++ b/missions/Boat.py @@ -2,26 +2,36 @@ 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 -from pybricks.tools import run_task,multitask +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) -left_arm = Motor(Port.C, Direction.COUNTERCLOCKWISE) -right_arm = Motor(Port.D) +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) -drive_base.settings(550,700,100,100) - +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) -first_run = False - async def main(): - await drive_base.straight(750) - await drive_base.straight(-650) - + await drive_base.straight(700) + await drive_base.turn(-17) + await drive_base.straight(100) + await drive_base.straight(-205) + await drive_base.turn(62) + await drive_base.straight(125) + await arm_motor.run_angle(1000, -1200) + await drive_base.straight(87) + await arm_motor.run_angle(300, 1200) + await drive_base.straight(-875) + run_task(main()) \ No newline at end of file -- 2.49.1