diff --git a/discovery-phase/missions/Showcase_codes.py b/discovery-phase/missions/Showcase_codes.py index 7df64a6..a475ef2 100644 --- a/discovery-phase/missions/Showcase_codes.py +++ b/discovery-phase/missions/Showcase_codes.py @@ -15,8 +15,8 @@ Improvements over baseline: from pybricks.tools import StopWatch, wait import umath -WHEEL_DIAMETER = 68.8 # mm — adjust to your wheel (Done) -AXLE_TRACK = 180 # mm — used only if you add turning later (Done) +WHEEL_DIAMETER = 62.4 # mm — adjust to your wheel (Done) +AXLE_TRACK = 150 # mm — used only if you add turning later (Done) LOOP_MS = 20 # fixed control loop period RAMP_MM = 50 # begin decelerating this far from target MIN_SPEED = 80 # floor speed during ramp (avoid stall) @@ -202,8 +202,9 @@ async def multilift_down(rotation_angle): ) -async def Run1(): # Flip The Rock, Lucky Leaves, Reaching Roots - Johannes +async def Run1(): # Flip The Rock, Lucky Leaves, Reaching Roots - Rishabh +<<<<<<< HEAD await set_speed(600,200,300,200) await drive_base.straight(500) await multitask( @@ -321,6 +322,8 @@ async def Run3(): # Window to the Past, Leaf Cutter, Humongous Fungus, Experimen async def Run4(): #Flip the Rock, Lucky Leaves, Reaching Roots - Rishabh #Run +======= +>>>>>>> c15d8f0 (Update discovery-phase/missions/Showcase_codes.py) await drive_base.straight(550)#Works (600(Previous)) await drive_base.straight(-200) await drive_base.turn(45) @@ -336,7 +339,103 @@ async def Run4(): #Flip the Rock, Lucky Leaves, Reaching Roots - Rishabh await drive_base.turn(30) await drive_base.straight(-1000) +<<<<<<< HEAD async def Run11(): # Interchangable Mission - Parthiv +======= +async def Run2(): # Exploding Seeds - Johannes + + await multitask( + right_arm.run_angle(400,-100), + drive_base.arc(150,None,115), + ) + await drive_base.straight(270) + await left_arm.run_angle(300,-80) + await drive_base.straight(-100) + await left_arm.run_angle(300,-100) + await drive_base.arc(-1000,None,-800) + + +async def Run3(): # Drone Survey - Johannes + + await multitask( + left_arm.run_angle(400,-300), + right_arm.run_angle(400,100), + drive_base.straight(900) + ) + await drive_base.turn(-25) + await drive_base.straight(110) + await drive_base.turn(-35) + await drive_base.turn(35) + await drive_base.straight(-30) + await drive_base.turn(25) + await drive_base.straight(-200) + await drive_base.turn(-45) + await drive_base.straight(500) + await drive_base.turn(75) + await drive_base.straight(700) + + +async def Run4(): # Window to the Past, Leaf Cutter, Humongous Fungus, Experimental - Johannes + + await drive_base.straight(110) + await drive_base.turn(-45) + await drive_base.straight(280) + await right_arm.run_angle(300,120) + await left_arm.run_angle(400,200) + await drive_base.straight(-70) + await left_arm.run_angle(600,-110) + await drive_base.straight(370) + await drive_base.turn(50) + await multitask( + drive_base.straight(250), + left_arm.run_angle(600,-60) + ) + await drive_base.turn(40) + set_speed(100,200,300,200) + await drive_base.straight(170) + await drive_base.straight(-135) + await drive_base.turn(80) + await drive_base.straight(85) + await multitask( + drive_base.turn(-36), + right_arm.run_angle(200,-140) + ) + set_speed(100,200,300,200) + await drive_base.straight(235) + await multitask( + right_arm.run_angle(300,100), + left_arm.run_angle(200,140) + ) + await wait(200) + await drive_base.straight(30) + await drive_base.turn(-90) + await drive_base.straight(-170) + set_speed(600,500,300,200) + await drive_base.straight(100) + await drive_base.arc(800,None,-900) + + +async def Run5(): # Forest Elder - Parthiv + + await drive_base.straight(475) + await right_arm.run_angle(300,25) + await drive_base.turn(-20) + await left_arm.run_angle(200,245) + await drive_base.straight(60) + await drive_base.turn(25) + await left_arm.run_angle(100,-56.5) + await drive_base.straight(-50) + await drive_base.straight(50) + await drive_base.turn(-25) + await left_arm.run_angle(200,-200) + await drive_base.straight(-240) + await drive_base.turn(15) + await right_arm.run_angle(200,-200) + await drive_base.straight(-200) + await drive_base.stop + +async def Run6(): # Interchangable Mission - Parthiv +>>>>>>> c15d8f0 (Update discovery-phase/missions/Showcase_codes.py) await left_arm.run_angle(200,-80) await drive_base.arc(-350,angle=90) @@ -355,11 +454,15 @@ async def Run11(): # Interchangable Mission - Parthiv await drive_base.straight(-775) await drive_base.stop -async def Run12(): # Experimental Research Platform Lifter +async def Run7(): # Seed Dispersal - Parthiv + + set_speed(700,500,400,200) + await drive_base.straight(490) + await left_arm.run_angle(50,100) + await drive_base.straight(-490) + + - await multilift_up(1200) - await multilift_down(300) - await drive_base.straight(50) # Function to classify color based on HSV @@ -367,9 +470,9 @@ def detect_color(h, s, v, reflected): if reflected > 4: if h < 4 or h > 350: # red return "Red" - elif 3 < h < 40 and s > 70: # orange + elif 3 < h < 24 and s > 80: # orange return "Orange" - elif 47 < h < 56: # yellow + elif 30 < h < 60 and v > 50: # yellow return "Yellow" elif 70 < h < 160: # green - do it vertically not horizontally for accuracy return "Green" @@ -379,7 +482,8 @@ def detect_color(h, s, v, reflected): return "Blue" elif 260 < h < 350: # purple return "Purple" - + elif s < 15 and v > 70: # white + return "White" else: return "Unknown" return "Unknown" @@ -399,26 +503,28 @@ async def main(): if color == "Green": - print('Running Mission 1') + print('Running Mission 1, Detect Green') await Run1() elif color == "Red": - print('Running Mission 2') + print('Running Mission 2, Detect Red') await Run2() elif color == "Yellow": - print('Running Mission 3') + print('Running Mission 3, Detect Yellow') await Run3() elif color == "Blue": - print('Running Mission 4') + print('Running Mission 4, Detect Blue') await Run4() elif color == "Orange": - print('Running Mission 5') - await Run3() + print('Running Mission 5, Detect Orange') + await Run5() elif color == "Purple": - print('Running Mission 11') - await Run11() + print('Running Mission 6, Detect Purple') + await Run6() elif color == "Light_Blue": - print("Running Mission 12") - await Run12() + print('Running Mission 7, Detect Cyan') + await Run7() + elif color == "White": + print('Detect White') else: print(f"Unknown color detected (Hue: {h}, Sat: {s}, Val: {v})") #pass