Update competition_codes/state/sunprarie_state_main.py

Various updates to a few of the codes.
This commit is contained in:
2026-01-04 18:09:47 +00:00
parent 6dbcfbe146
commit 4233cc5f74

View File

@@ -1,3 +1,5 @@
#Important Notice: All codes should be tested while the robot's battery is at 100%, and all updates must be made when the robot is at full charge.
from pybricks.pupdevices import Motor, ColorSensor, UltrasonicSensor, ForceSensor from pybricks.pupdevices import Motor, ColorSensor, UltrasonicSensor, ForceSensor
from pybricks.parameters import Button, Color, Direction, Port, Side, Stop from pybricks.parameters import Button, Color, Direction, Port, Side, Stop
from pybricks.tools import run_task, multitask from pybricks.tools import run_task, multitask
@@ -104,7 +106,7 @@ async def solve_whats_on_sale():
async def solve_silo(): async def solve_silo():
await drive_base.straight(-80) await drive_base.straight(-80)
await drive_base.turn(42) await drive_base.turn(42)
await drive_base.straight(90) await drive_base.straight(95)
SPEED = 10000 # speed in degree per second SPEED = 10000 # speed in degree per second
SWING_ANGLE = 80 # the angle! SWING_ANGLE = 80 # the angle!
@@ -199,7 +201,7 @@ async def Run3():
) )
async def solve_angler_artifacts(): async def solve_angler_artifacts():
await drive_base.straight(890) await drive_base.straight(870)
await drive_base.turn(-90,Stop.HOLD) await drive_base.turn(-90,Stop.HOLD)
await drive_base.straight(45) await drive_base.straight(45)
#Solve #Solve
@@ -386,14 +388,14 @@ async def Run12(): # experimental careful recovery attachment
await right_arm.run_target(2000,-120) await right_arm.run_target(2000,-120)
right_arm.reset_angle(0) right_arm.reset_angle(0)
await drive_base.straight(190) # Slowly move straight to mineshaft 190 mm await drive_base.straight(180) # Slowly move straight to mineshaft 180 mm
await right_arm.run_angle(100,95,Stop.HOLD) # Raise mineshaft await right_arm.run_angle(100,95,Stop.HOLD) # Raise mineshaft
await wait(50) await wait(50)
await left_arm.run_angle(100,60) # recover artifact by lifting arm 60 degrees await left_arm.run_angle(100,60) # recover artifact by lifting arm 60 degrees
# Moving back # Moving back
await drive_base.straight(-200) await drive_base.straight(-190)
# Return home # Return home
set_default_speed() # change movement robot movement to fast set_default_speed() # change movement robot movement to fast