Update shout-fll-scrimmage/bioglow_shoutfll_scrimmage_main.py
This commit is contained in:
@@ -14,24 +14,29 @@ import bioglow_missions_11_6_7 as Run_4
|
|||||||
import bioglow_mission_13 as Run_5
|
import bioglow_mission_13 as Run_5
|
||||||
import bioglow_mission_12 as Run_6
|
import bioglow_mission_12 as Run_6
|
||||||
import bioglow_missions_14_15 as Run_7
|
import bioglow_missions_14_15 as Run_7
|
||||||
|
import bioglow_mission_8 as Run_8
|
||||||
|
|
||||||
# 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):
|
||||||
if reflected > 4:
|
if reflected > 4:
|
||||||
if h < 4 or h > 350: # red
|
if 1 < h < 11 and s <50: # brown
|
||||||
return "Red"
|
return "Brown"
|
||||||
elif 3 < h < 24 and s > 80: # orange
|
elif 11 < h < 24 and s > 80: # orange
|
||||||
return "Orange"
|
return "Orange"
|
||||||
elif 30 < h < 60 and v > 50: # yellow
|
elif 30 < h < 60 and v > 50: # yellow
|
||||||
return "Yellow"
|
return "Yellow"
|
||||||
elif 70 < h < 160: # green - do it vertically not horizontally for accuracy
|
elif 70 < h < 90 and s > 60: # neon green
|
||||||
|
return "Lime"
|
||||||
|
elif 100 < h < 160: # green - do it vertically not horizontally for accuracy
|
||||||
return "Green"
|
return "Green"
|
||||||
elif 195 < h < 198: # light blue
|
elif 195 < h < 198: # light blue
|
||||||
return "Cyan"
|
return "Cyan"
|
||||||
elif 210 < h < 225: # blue - do it vertically not horizontally for accuracy
|
elif 210 < h < 225: # blue - do it vertically not horizontally for accuracy
|
||||||
return "Blue"
|
return "Blue"
|
||||||
elif 260 < h < 350: # purple
|
elif 260 < h < 350 and s > 80: # purple
|
||||||
return "Purple"
|
return "Purple"
|
||||||
|
elif 350 < h and s > 50: #red
|
||||||
|
return "Red"
|
||||||
elif s < 15 and v > 70: # white
|
elif s < 15 and v > 70: # white
|
||||||
return "White"
|
return "White"
|
||||||
else:
|
else:
|
||||||
@@ -73,8 +78,15 @@ async def main():
|
|||||||
elif color == "Cyan":
|
elif color == "Cyan":
|
||||||
print('Running Mission 7, Detect Cyan')
|
print('Running Mission 7, Detect Cyan')
|
||||||
await Run_7.solve_missions()
|
await Run_7.solve_missions()
|
||||||
|
elif color == "Lime":
|
||||||
|
print('Running Mission 8, Detect Lime')
|
||||||
|
await Run_8.solve_missions()
|
||||||
|
elif color == "Brown":
|
||||||
|
print('Running Mission Experimental, Detect Brown')
|
||||||
|
await robot.wait(500)
|
||||||
elif color == "White":
|
elif color == "White":
|
||||||
print('Detect White')
|
print('Detect White')
|
||||||
|
await robot.wait(500)
|
||||||
else:
|
else:
|
||||||
print(f"Unknown color detected (Hue: {h}, Sat: {s}, Val: {v})")
|
print(f"Unknown color detected (Hue: {h}, Sat: {s}, Val: {v})")
|
||||||
#pass
|
#pass
|
||||||
|
|||||||
Reference in New Issue
Block a user