Skip to content

Commit 14857fa

Browse files
author
Markgraf
committed
fix: fix the masters commentary
1 parent 447b7f1 commit 14857fa

2 files changed

Lines changed: 8 additions & 11 deletions

File tree

src/Simulateur/controllers/controllerVehicleDriver/controllerVehicleDriver.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@ def too_close(lidar,dir):
88
# if dir==True: we're near the right wall
99
R=0.83
1010
l=len(lidar)
11-
forw=lidar[l//2]
11+
straight=lidar[l//2]
1212
if dir:
13-
m=min(lidar[l//2:])
13+
nearest=min(lidar[l//2:])
1414
else:
15-
m=min(lidar[:l//2])
16-
Th=np.arccos(m/forw)
17-
if m < R*(1-np.sin(Th)):
18-
return True
19-
return False
15+
nearest=min(lidar[:l//2])
16+
theta=np.arccos(nearest/straight)
17+
L=R*(1-np.sin(theta))
18+
return nearest < L
2019

2120
class State(Enum):
2221
AI=auto()
@@ -131,9 +130,7 @@ def ai(self):
131130
def back(self):
132131
#si mur de "dir": braquer à "dir"" et reculer jusqu'à pouvoir réavancer (distance au mur à vérif)
133132
lidar,cam=self.observe()[1:]
134-
S=0
135-
for i in range(len(cam)):
136-
S+=cam[i]
133+
S=sum(cam)
137134
dir = S>0
138135
if dir:
139136
self.setSteeringAngle(0.33)

src/Simulateur/worlds/.piste1.wbproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Webots Project File version R2025a
2-
perspectives: 000000ff00000000fd0000000200000001000000870000028afc0200000001fb0000001400540065007800740045006400690074006f007201000000000000028a0000004500ffffff00000003000006c000000150fc0100000002fb0000001a0043006f006e0073006f006c00650041006c006c0041006c006c0100000000000006c00000008700fffffffb0000001a0043006f006e0073006f006c00650041006c006c0041006c006c010000000000000a000000000000000000000006370000028a00000001000000020000000100000008fc00000000
2+
perspectives: 000000ff00000000fd0000000200000001000000870000028afc0200000001fb0000001400540065007800740045006400690074006f007201000000000000028a0000004500ffffff000000030000050700000150fc0100000002fb0000001a0043006f006e0073006f006c00650041006c006c0041006c006c0100000000000005070000008700fffffffb0000001a0043006f006e0073006f006c00650041006c006c0041006c006c010000000000000a0000000000000000000000047e0000028a00000001000000020000000100000008fc00000000
33
simulationViewPerspectives: 000000ff00000001000000020000012b000005a50100000002010000000100
44
sceneTreePerspectives: 000000ff00000001000000030000001e00000364000000fa0100000002010000000200
55
minimizedPerspectives: 000000ff00000000fd0000000200000001000000750000017bfc0200000001fb0000001400540065007800740045006400690074006f007201000000160000017b0000003f00ffffff000000030000039b00000039fc0100000002fb0000001a0043006f006e0073006f006c00650041006c006c0041006c006c01000000000000039b0000006900fffffffb0000001a0043006f006e0073006f006c00650041006c006c0041006c006c010000000000000a000000000000000000000003240000017b00000001000000020000000100000008fc00000000

0 commit comments

Comments
 (0)