src/main.llsp3 aktualisiert
parent
a716980689
commit
aa3f795bf5
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue