fix: live et grage (random pick)

This commit is contained in:
gdamms 2022-04-19 09:07:01 +02:00
parent bf92ebfed7
commit 0150e3cf20
3 changed files with 22 additions and 9 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View file

@ -27,15 +27,15 @@ SECONDARY_COLOR_SLIDER = (380, 380 + TEAM_OFFSET)
ITEM_X = (200, 450, 700)
ITEM_Y = (300, 580, 860)
NB_STICKERS = (0, 0, 2, 4)
NB_STICKERS = (3, 3, 8, 0, 3, 3, 0, 3)
NB_WHEELS = 23
NB_HATS = 23
NB_TEAMS = 2
DELAY = 0.1
NB_PRIMARY_COLORS = 3
NB_SECONDARY_COLORS = 1
NB_PRIMARY_COLORS = 10
NB_SECONDARY_COLORS = 10
old_model = None
old_sticker = None
@ -235,8 +235,21 @@ def generate_loadouts():
if __name__ == "__main__":
startup()
loadouts, _ = generate_loadouts()
for (wheel, (model, sticker), hat, team, primary_color, secondary_color) in loadouts:
startup(need_focus=False)
running = True
while running:
loadouts, nb_loadouts = generate_loadouts()
# skip some cars
skip = np.random.randint(0, nb_loadouts)
for _ in range(skip):
next(loadouts)
input("Press Enter to continue...")
(wheel, (model, sticker), hat, team, primary_color, secondary_color) = next(loadouts)
print(f"next loadout: {(wheel, (model, sticker), hat, team, primary_color, secondary_color)}")
newCar(model, sticker, wheel, hat, team, primary_color, secondary_color)

View file

@ -1,3 +1,4 @@
import os
import subprocess
import time
@ -29,7 +30,7 @@ X = np.zeros((1, RESIZED_SIZE[1], RESIZED_SIZE[0], RESIZED_SIZE[2]))
while running:
utils.screenshot(filename="live", folder=MODELS_PATH)
time.sleep(1)
# time.sleep(1)
# Lecture de l'image
img = PIL.Image.open(MODELS_PATH + "/live.jpg")
@ -43,8 +44,7 @@ while running:
index = int(np.dot(Y, np.array([0, 1, 2, 3]).T))
print()
print()
os.system("clear")
print(f"Model detected : {LABELS[index]}")
for i in range(len(LABELS)):
print(f"\t- {LABELS[i]} {Y[0,i]:.03f}")