File tree Expand file tree Collapse file tree
controllers/controllerVehicleDriver Expand file tree Collapse file tree Original file line number Diff line number Diff 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
2120class 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 )
Original file line number Diff line number Diff line change 11Webots Project File version R2025a
2- perspectives: 000000ff00000000fd0000000200000001000000870000028afc0200000001fb0000001400540065007800740045006400690074006f007201000000000000028a0000004500ffffff00000003000006c000000150fc0100000002fb0000001a0043006f006e0073006f006c00650041006c006c0041006c006c0100000000000006c00000008700fffffffb0000001a0043006f006e0073006f006c00650041006c006c0041006c006c010000000000000a000000000000000000000006370000028a00000001000000020000000100000008fc00000000
2+ perspectives: 000000ff00000000fd0000000200000001000000870000028afc0200000001fb0000001400540065007800740045006400690074006f007201000000000000028a0000004500ffffff000000030000050700000150fc0100000002fb0000001a0043006f006e0073006f006c00650041006c006c0041006c006c0100000000000005070000008700fffffffb0000001a0043006f006e0073006f006c00650041006c006c0041006c006c010000000000000a0000000000000000000000047e0000028a00000001000000020000000100000008fc00000000
33simulationViewPerspectives: 000000ff00000001000000020000012b000005a50100000002010000000100
44sceneTreePerspectives: 000000ff00000001000000030000001e00000364000000fa0100000002010000000200
55minimizedPerspectives: 000000ff00000000fd0000000200000001000000750000017bfc0200000001fb0000001400540065007800740045006400690074006f007201000000160000017b0000003f00ffffff000000030000039b00000039fc0100000002fb0000001a0043006f006e0073006f006c00650041006c006c0041006c006c01000000000000039b0000006900fffffffb0000001a0043006f006e0073006f006c00650041006c006c0041006c006c010000000000000a000000000000000000000003240000017b00000001000000020000000100000008fc00000000
You can’t perform that action at this time.
0 commit comments