Update competition_codes/state/sunprarie_state_main.py

This commit is contained in:
2026-01-08 23:21:51 +00:00
parent 8b152a371d
commit fa28fbb086

View File

@@ -406,9 +406,9 @@ async def Run11(): # experimental surface brushing attachment
#left_arm.run_angle(300,218) #left_arm.run_angle(300,218)
set_default_speed() set_default_speed()
await drive_base.straight(-80) await drive_base.straight(-100)
await drive_base.turn(30) await drive_base.turn(30)
await drive_base.straight(-180) await drive_base.straight(-190)
#await drive_base.straight(400) #await drive_base.straight(400)
#await left_arm.run_angle(50,120) #await left_arm.run_angle(50,120)
#await drive_base.straight(-200) #await drive_base.straight(-200)
@@ -416,44 +416,21 @@ async def Run11(): # experimental surface brushing attachment
await drive_base.straight(-600) await drive_base.straight(-600)
drive_base.stop() drive_base.stop()
async def Run12(): # experimental careful recovery attachment async def Run12():
right_arm.reset_angle(0)
# This raises the left arm to avoid entanglement when turning
await left_arm.run_angle(2000, 180) # Fast movement upward
# Gentle stall detection (shorter distance = faster)
await left_arm.run_until_stalled(1500, duty_limit=15)
left_arm.reset_angle(0)
# Drive the robot to the wall
await drive_base.straight(900) await drive_base.straight(900)
await drive_base.turn(83) # Align robot to Mineshaft entrance await drive_base.turn(83)
await left_arm.run_angle(3000, -300)
# This change robot movement to slow await right_arm.run_angle(1100, -180)
drive_base.settings(100, 100, 50, 500) drive_base.settings(150, 50, 50, 50)
await drive_base.straight(120)
# Bring down left arm to position
await left_arm.run_angle(2000, -180)
await left_arm.run_until_stalled(-1500,duty_limit=15)
left_arm.reset_angle(0) left_arm.reset_angle(0)
await left_arm.run_angle(50, 50)
await right_arm.run_angle(50, 90)
await drive_base.straight(-100)
drive_base.settings(950, 750, 750, 750)
await drive_base.turn(110)
await drive_base.straight(1000)
# Bring down right arm to position
await right_arm.run_target(2000,-120)
right_arm.reset_angle(0)
await drive_base.straight(180) # Slowly move straight to mineshaft 180 mm
await right_arm.run_angle(100,95,Stop.HOLD) # Raise mineshaft
await left_arm.run_angle(100,60) # recover artifact by lifting arm 60 degrees
# Moving back
await drive_base.straight(-190)
# Return home
set_default_speed() # change movement robot movement to fast
await drive_base.turn(100)
await drive_base.straight(700)
drive_base.stop()
# Function to classify color based on HSV # Function to classify color based on HSV
def detect_color(h, s, v, reflected): def detect_color(h, s, v, reflected):