Skip to content

Commit cd2253f

Browse files
Move EGO completely on road during unit tests
1 parent 4427dd0 commit cd2253f

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

tests/test_NPC.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def test_get_agents(self):
5858
def test_NPC_follow_lane(self): #Check if NPC can follow lane
5959
with SimConnection() as sim:
6060
state = spawnState(sim)
61-
state.position.z -= 5
61+
state.position.x -= 5
6262
sim.add_agent("Jaguar2015XE (Apollo 3.5)", lgsvl.AgentType.EGO, state)
6363
agent = self.create_NPC(sim, "Sedan")
6464
agent.follow_closest_lane(True, 5.6)
@@ -71,7 +71,7 @@ def test_NPC_follow_lane(self): #Check if NPC can follow lane
7171
def test_rotate_NPC(self): # Check if NPC can be rotated
7272
with SimConnection() as sim:
7373
state = spawnState(sim)
74-
state.position.z -= 5
74+
state.position.x -= 5
7575
sim.add_agent("Jaguar2015XE (Apollo 3.5)", lgsvl.AgentType.EGO, state)
7676
agent = self.create_NPC(sim, "SUV")
7777
self.assertAlmostEqual(agent.state.transform.rotation.y, 0, places=3)
@@ -151,7 +151,7 @@ def test_access_removed_NPC(self): # Check that and exception is raised when try
151151
def test_follow_waypoints(self): # Check that the NPC can follow waypoints
152152
with SimConnection(60) as sim:
153153
state = spawnState(sim)
154-
state.position.z -= 5
154+
state.position.x -= 5
155155
sim.add_agent("Jaguar2015XE (Apollo 3.5)", lgsvl.AgentType.EGO, state)
156156
spawns = sim.get_spawn()
157157
sx = spawns[0].position.x
@@ -192,16 +192,16 @@ def test_high_waypoint(self): # Check that a NPC will drive to under a high wayp
192192
try:
193193
with SimConnection(15) as sim:
194194
state = spawnState(sim)
195-
state.position.z -= 5
195+
state.position.x -= 5
196196
sim.add_agent("Jaguar2015XE (Apollo 3.5)", lgsvl.AgentType.EGO, state)
197197
spawns = sim.get_spawn()
198198
sx = spawns[0].position.x
199199
sy = spawns[0].position.y
200200
sz = spawns[0].position.z
201201
agent = self.create_NPC(sim, "Sedan")
202202

203-
px = 12
204-
pz = 4
203+
px = 4
204+
pz = 12
205205
py = 5
206206
speed = 6
207207
wp = [lgsvl.DriveWaypoint(lgsvl.Vector(sx-px, sy+py, sz+pz), speed)]
@@ -217,7 +217,7 @@ def on_waypoint(agent,index):
217217
def test_npc_different_directions(self): # Check that specified velocities match the NPC's movement
218218
with SimConnection() as sim:
219219
state = spawnState(sim)
220-
state.position.z -= 5
220+
state.position.x -= 5
221221
sim.add_agent("Jaguar2015XE (Apollo 3.5)", lgsvl.AgentType.EGO, state)
222222
state = spawnState(sim)
223223
state.velocity = lgsvl.Vector(-10,0,0)
@@ -253,7 +253,7 @@ def on_stop_line(agent):
253253
npc.follow_closest_lane(True, 10)
254254
npc.on_stop_line(on_stop_line)
255255

256-
state.position.z -= 5
256+
state.position.x -= 5
257257
sim.add_agent("Jaguar2015XE (Apollo 3.5)", lgsvl.AgentType.EGO, state)
258258
sim.run(60)
259259
self.assertIn("Waypoint reached", repr(e.exception))

tests/test_peds.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class TestPeds(unittest.TestCase):
1515
def test_ped_creation(self): # Check if the different types of Peds can be created
1616
with SimConnection() as sim:
1717
state = spawnState(sim)
18-
state.position.z -= 5
18+
state.position.z -= 4
1919
sim.add_agent("Jaguar2015XE (Apollo 3.5)", lgsvl.AgentType.EGO, state)
2020
for name in ["Bob", "EntrepreneurFemale", "Howard", "Johny", \
2121
"Pamela", "Presley", "Red", "Robin", "Stephen", "Zoe"]:
@@ -26,7 +26,7 @@ def test_ped_creation(self): # Check if the different types of Peds can be creat
2626
def test_ped_random_walk(self): # Check if pedestrians can walk randomly
2727
with SimConnection() as sim:
2828
state = spawnState(sim)
29-
state.position.z -= 5
29+
state.position.z -= 4
3030
sim.add_agent("Jaguar2015XE (Apollo 3.5)", lgsvl.AgentType.EGO, state)
3131
state = spawnState(sim)
3232
spawnPoint = state.transform.position
@@ -48,7 +48,7 @@ def test_ped_random_walk(self): # Check if pedestrians can walk randomly
4848
def test_ped_circle_waypoints(self): # Check if pedestrians can follow waypoints
4949
with SimConnection(60) as sim:
5050
state = spawnState(sim)
51-
state.position.z -= 5
51+
state.position.z -= 4
5252
sim.add_agent("Jaguar2015XE (Apollo 3.5)", lgsvl.AgentType.EGO, state)
5353
state = spawnState(sim)
5454
sx = state.position.x

0 commit comments

Comments
 (0)