add corrections to coordinates in test.py

This commit is contained in:
Pavel 2021-10-16 12:41:52 +02:00
parent 9b8a5936ba
commit 3b258108a0
1 changed files with 4 additions and 2 deletions

View File

@ -28,7 +28,9 @@ index = 2
def mon_itineraire():
global steps, position, index
x, y = steps[index * 2:(index + 1) * 2]
x, a, y, b = steps[(index - 1) * 4:index * 4]
x += a * 1e-14
y += b * 1e-14
a = atan2(y - position[1], x - position[0]) * 180.0 / pi - position[2]
l = hypot(x - position[0], y - position[1])
a_droite(a)
@ -37,6 +39,6 @@ def mon_itineraire():
position[0] += l * cos(position[2] * pi / 180.0)
position[1] += l * sin(position[2] * pi / 180.0)
index += 1
return len(steps) >= (index + 1) * 2
return len(steps) >= index * 4
print(aller_selon(mon_itineraire))