src/main.llsp3 aktualisiert

feat/distanz
Ruben Seitz 2025-11-20 09:03:27 +01:00
parent a716980689
commit aa3f795bf5
1 changed files with 32 additions and 9 deletions

View File

@ -55,22 +55,45 @@ def flipflop(state, r, s):
async def move_on_color():
start_time = time.time()
print(ms.tilt_angles())
left = cs.reflection(port.C)
right = cs.reflection(port.E)
green = 25
black = 18
white = 90
while True:
roll_value = ms.tilt_angles()[2]
# Change to switch case
if cs.reflection(port.C) < 60:
if left < green and left > black and right < green and right > black:
mp.move_tank(mp.PAIR_1, -100, 100)
elif cs.reflection(port.E) < 60:
elif left < green and left > black:
mp.move_tank(mp.PAIR_1, -100, 100)
elif right < green and right > black:
mp.move_tank(mp.PAIR_1, 100, -100)
elif roll_value < -150: # uphill function
mp.move(mp.PAIR_1, 0, velocity=450)
else:
mp.move(mp.PAIR_1, 0, velocity=200)
elif left < black and right > white:
mp.move_tank(mp.PAIR_1, -100, 100)
# while True:
# roll_value = ms.tilt_angles()[2]
# # Change to switch case
# if cs.reflection(port.C) < 60:
# mp.move_tank(mp.PAIR_1, -100, 100)
# elif cs.reflection(port.E) < 60:
# mp.move_tank(mp.PAIR_1, 100, -100)
# elif roll_value < -150: # uphill function
# mp.move(mp.PAIR_1, 0, velocity=450)
# else:
# mp.move(mp.PAIR_1, 0, velocity=200)
# Geradeaus
# linkskurve
# rechtskurve
# rechtskurve
# Kreuzung (grüner Punkt)
# wenn grün, dann biege um 90 Grad in die richtung ab (wenn vor schwarzer linie)