@@ -17,7 +17,7 @@ def test_agent_name(self): # Check if EGO Apollo is created
1717 with SimConnection () as sim :
1818 agent = self .create_EGO (sim )
1919
20- self .assertEqual (agent .name , "XE_Rigged-apollo " )
20+ self .assertEqual (agent .name , "Jaguar2015XE (Apollo 3.5) " )
2121
2222 def test_different_spawns (self ): # Check if EGO is spawned in the spawn positions
2323 with SimConnection () as sim :
@@ -28,7 +28,7 @@ def test_different_spawns(self): # Check if EGO is spawned in the spawn position
2828
2929 state = spawnState (sim )
3030 state .transform = spawns [1 ]
31- agent2 = sim .add_agent ("XE_Rigged-apollo " , lgsvl .AgentType .EGO , state )
31+ agent2 = sim .add_agent ("Jaguar2015XE (Apollo 3.5) " , lgsvl .AgentType .EGO , state )
3232
3333 cmEqual (self , agent2 .state .position , spawns [1 ].position , "Spawn Position 1" )
3434 cmEqual (self , agent2 .state .rotation , spawns [1 ].rotation , "Spawn Rotation 1" )
@@ -41,41 +41,42 @@ def test_agent_velocity(self): # Check EGO velocity
4141
4242 sim .reset ()
4343 state .velocity = lgsvl .Vector (- 50 , 0 , 0 )
44- agent = sim .add_agent ("XE_Rigged-apollo " , lgsvl .AgentType .EGO , state )
44+ agent = sim .add_agent ("Jaguar2015XE (Apollo 3.5) " , lgsvl .AgentType .EGO , state )
4545
4646 cmEqual (self , agent .state .velocity , state .velocity , "50 Velocity" )
4747
4848 def test_ego_different_directions (self ): # Check that the xyz velocities equate to xyz changes in position
49- with SimConnection () as sim :
49+ with SimConnection (40 ) as sim :
5050 state = spawnState (sim )
5151 state .velocity = lgsvl .Vector (- 10 ,0 ,0 )
52- ego = sim .add_agent ("XE_Rigged-apollo " , lgsvl .AgentType .EGO , state )
52+ ego = sim .add_agent ("Jaguar2015XE (Apollo 3.5) " , lgsvl .AgentType .EGO , state )
5353 sim .run (.5 )
5454 self .assertNotAlmostEqual (state .position .x , ego .state .position .x , places = 1 )
5555 self .assertAlmostEqual (state .position .y , ego .state .position .y , places = 1 )
5656 self .assertAlmostEqual (state .position .z , ego .state .position .z , places = 1 )
5757 sim .remove_agent (ego )
5858 state .velocity = lgsvl .Vector (0 ,10 ,0 )
59- ego = sim .add_agent ("XE_Rigged-apollo " , lgsvl .AgentType .EGO , state )
59+ ego = sim .add_agent ("Jaguar2015XE (Apollo 3.5) " , lgsvl .AgentType .EGO , state )
6060 sim .run (.5 )
6161 self .assertNotAlmostEqual (state .position .y , ego .state .position .y , places = 1 )
6262 self .assertAlmostEqual (state .position .x , ego .state .position .x , places = 1 )
6363 self .assertAlmostEqual (state .position .z , ego .state .position .z , places = 1 )
6464 sim .remove_agent (ego )
65- state .velocity = lgsvl .Vector (0 ,0 ,- 10 )
66- ego = sim .add_agent ("XE_Rigged-apollo " , lgsvl .AgentType .EGO , state )
65+ state .velocity = lgsvl .Vector (0 ,0 ,10 )
66+ ego = sim .add_agent ("Jaguar2015XE (Apollo 3.5) " , lgsvl .AgentType .EGO , state )
6767 sim .run (.5 )
6868 self .assertNotAlmostEqual (state .position .z , ego .state .position .z , places = 1 )
69- self .assertAlmostEqual (state .position .y , ego .state .position .y , places = 1 )
69+ self .assertAlmostEqual (state .position .y , ego .state .position .y , delta = 0.15 )
7070 self .assertAlmostEqual (state .position .x , ego .state .position .x , places = 1 )
7171
7272 def test_speed (self ): # check that speed returns a reasonable number
7373 with SimConnection () as sim :
7474 state = spawnState (sim )
7575 state .velocity = lgsvl .Vector (- 10 ,10 ,10 )
76- ego = sim .add_agent ("XE_Rigged-apollo " , lgsvl .AgentType .EGO , state )
76+ ego = sim .add_agent ("Jaguar2015XE (Apollo 3.5) " , lgsvl .AgentType .EGO , state )
7777 self .assertAlmostEqual (ego .state .speed , math .sqrt (300 ))
7878
79+ @unittest .skip ("No highway in currents maps" )
7980 def test_rotation_on_highway_ramp (self ): # Check that vehicle is rotated when spawned on the highway ramp
8081 with SimConnection () as sim :
8182 state = spawnState (sim )
@@ -87,7 +88,7 @@ def test_rotation_on_highway_ramp(self): # Check that vehicle is rotated when sp
8788
8889 def test_ego_steering (self ): # Check that a steering command can be given to an EGO vehicle, and the car turns
8990 with SimConnection () as sim :
90- ego = sim .add_agent ("XE_Rigged-apollo " , lgsvl .AgentType .EGO , spawnState (sim ))
91+ ego = sim .add_agent ("Jaguar2015XE (Apollo 3.5) " , lgsvl .AgentType .EGO , spawnState (sim ))
9192 control = lgsvl .VehicleControl ()
9293 control .throttle = 0.3
9394 control .steering = - 1.0
@@ -99,7 +100,7 @@ def test_ego_steering(self): # Check that a steering command can be given to an
99100
100101 def test_ego_throttle (self ): # Check that a throttle command can be given to an EGO vehicle, and the car accelerates
101102 with SimConnection () as sim :
102- ego = sim .add_agent ("XE_Rigged-apollo " , lgsvl .AgentType .EGO , spawnState (sim ))
103+ ego = sim .add_agent ("Jaguar2015XE (Apollo 3.5) " , lgsvl .AgentType .EGO , spawnState (sim ))
103104 control = lgsvl .VehicleControl ()
104105 control .throttle = 0.5
105106 ego .apply_control (control , True )
@@ -109,20 +110,20 @@ def test_ego_throttle(self): # Check that a throttle command can be given to an
109110 self .assertGreater (finalSpeed , initialSpeed )
110111
111112 def test_ego_braking (self ): # Check that a brake command can be given to an EGO vehicle, and the car stops sooner than without brakes
112- with SimConnection () as sim :
113+ with SimConnection (60 ) as sim :
113114 state = spawnState (sim )
114- ego = sim .add_agent ("XE_Rigged-apollo " , lgsvl .AgentType .EGO , state )
115+ ego = sim .add_agent ("Jaguar2015XE (Apollo 3.5) " , lgsvl .AgentType .EGO , state )
115116 control = lgsvl .VehicleControl ()
116117 control .throttle = 1
117118 ego .apply_control (control , True )
118119 sim .run (1 )
119120 control = lgsvl .VehicleControl ()
120121 ego .apply_control (control ,True )
121122 sim .run (3 )
122- noBrakePosition = ego .state .position .x
123+ noBrakePosition = ego .state .position .z
123124
124125 sim .reset ()
125- ego = sim .add_agent ("XE_Rigged-apollo " , lgsvl .AgentType .EGO , state )
126+ ego = sim .add_agent ("Jaguar2015XE (Apollo 3.5) " , lgsvl .AgentType .EGO , state )
126127 control = lgsvl .VehicleControl ()
127128 control .throttle = 1
128129 ego .apply_control (control , True )
@@ -131,23 +132,23 @@ def test_ego_braking(self): # Check that a brake command can be given to an EGO
131132 control .braking = 1
132133 ego .apply_control (control , True )
133134 sim .run (3 )
134- self .assertGreater (ego .state .position .x , noBrakePosition )
135+ self .assertLess (ego .state .position .z , noBrakePosition )
135136
136137 def test_ego_handbrake (self ): # Check that the handbrake can be enable on an EGO vehicle, and the car stops sooner than without brakes
137- with SimConnection () as sim :
138+ with SimConnection (60 ) as sim :
138139 state = spawnState (sim )
139- ego = sim .add_agent ("XE_Rigged-apollo " , lgsvl .AgentType .EGO , state )
140+ ego = sim .add_agent ("Jaguar2015XE (Apollo 3.5) " , lgsvl .AgentType .EGO , state )
140141 control = lgsvl .VehicleControl ()
141142 control .throttle = 1
142143 ego .apply_control (control , True )
143144 sim .run (1 )
144145 control = lgsvl .VehicleControl ()
145146 ego .apply_control (control ,True )
146147 sim .run (3 )
147- noBrakePosition = ego .state .position .x
148+ noBrakePosition = ego .state .position .z
148149
149150 sim .reset ()
150- ego = sim .add_agent ("XE_Rigged-apollo " , lgsvl .AgentType .EGO , state )
151+ ego = sim .add_agent ("Jaguar2015XE (Apollo 3.5) " , lgsvl .AgentType .EGO , state )
151152 control = lgsvl .VehicleControl ()
152153 control .throttle = 1
153154 ego .apply_control (control , True )
@@ -156,44 +157,46 @@ def test_ego_handbrake(self): # Check that the handbrake can be enable on an EGO
156157 control .handbrake = True
157158 ego .apply_control (control , True )
158159 sim .run (3 )
159- self .assertGreater (ego .state .position .x , noBrakePosition )
160+ self .assertLess (ego .state .position .z , noBrakePosition )
160161
161162 def test_ego_reverse (self ): # Check that the gear can be changed in an EGO vehicle, and the car moves in reverse
162163 with SimConnection () as sim :
163- ego = sim .add_agent ("XE_Rigged-apollo " , lgsvl .AgentType .EGO , spawnState (sim ))
164+ ego = sim .add_agent ("Jaguar2015XE (Apollo 3.5) " , lgsvl .AgentType .EGO , spawnState (sim ))
164165 control = lgsvl .VehicleControl ()
165166 control .throttle = 0.5
166167 control .reverse = True
167168 ego .apply_control (control , True )
168169 sim .run (2 )
169- self .assertGreater (ego .state .position .x , sim .get_spawn ()[0 ].position .x )
170+ self .assertLess (ego .state .position .z , sim .get_spawn ()[0 ].position .z )
170171
171172 def test_not_sticky_control (self ): # Check that the a non sticky control is removed
172- with SimConnection () as sim :
173- ego = sim .add_agent ("XE_Rigged-apollo" , lgsvl .AgentType .EGO , spawnState (sim ))
173+ with SimConnection (60 ) as sim :
174+ state = spawnState (sim )
175+ state .position .z += 20
176+ ego = sim .add_agent ("Jaguar2015XE (Apollo 3.5)" , lgsvl .AgentType .EGO , state )
174177 control = lgsvl .VehicleControl ()
175- control .throttle = 0.5
178+ control .throttle = 1
176179 ego .apply_control (control , True )
177- sim .run (1 )
178- initialSpeed = ego .state .speed
180+ sim .run (3 )
181+ stickySpeed = ego .state .speed
179182 control = lgsvl .VehicleControl ()
180- control .throttle = 0.5
183+ control .throttle = 1
181184 ego .apply_control (control , False )
182- sim .run (1 )
185+ sim .run (3 )
183186 finalSpeed = ego .state .speed
184- self .assertGreater (initialSpeed , finalSpeed )
187+ self .assertGreater (stickySpeed , finalSpeed )
185188
186189 def test_vary_throttle (self ): # Check that different throttle values accelerate differently
187190 with SimConnection () as sim :
188- ego = sim .add_agent ("XE_Rigged-apollo " , lgsvl .AgentType .EGO , spawnState (sim ))
191+ ego = sim .add_agent ("Jaguar2015XE (Apollo 3.5) " , lgsvl .AgentType .EGO , spawnState (sim ))
189192 control = lgsvl .VehicleControl ()
190193 control .throttle = 0.5
191194 ego .apply_control (control , True )
192195 sim .run (1 )
193196 initialSpeed = ego .state .speed
194197
195198 sim .reset ()
196- ego = sim .add_agent ("XE_Rigged-apollo " , lgsvl .AgentType .EGO , spawnState (sim ))
199+ ego = sim .add_agent ("Jaguar2015XE (Apollo 3.5) " , lgsvl .AgentType .EGO , spawnState (sim ))
197200 control = lgsvl .VehicleControl ()
198201 control .throttle = 0.1
199202 ego .apply_control (control , True )
@@ -202,7 +205,7 @@ def test_vary_throttle(self): # Check that different throttle values accelerate
202205
203206 def test_vary_steering (self ): # Check that different steering values turn the car differently
204207 with SimConnection () as sim :
205- ego = sim .add_agent ("XE_Rigged-apollo " , lgsvl .AgentType .EGO , spawnState (sim ))
208+ ego = sim .add_agent ("Jaguar2015XE (Apollo 3.5) " , lgsvl .AgentType .EGO , spawnState (sim ))
206209 control = lgsvl .VehicleControl ()
207210 control .throttle = 0.5
208211 control .steering = - 0.8
@@ -211,7 +214,7 @@ def test_vary_steering(self): # Check that different steering values turn the ca
211214 initialAngle = ego .state .rotation .y
212215
213216 sim .reset ()
214- ego = sim .add_agent ("XE_Rigged-apollo " , lgsvl .AgentType .EGO , spawnState (sim ))
217+ ego = sim .add_agent ("Jaguar2015XE (Apollo 3.5) " , lgsvl .AgentType .EGO , spawnState (sim ))
215218 control = lgsvl .VehicleControl ()
216219 control .throttle = 0.5
217220 control .steering = - 0.3
@@ -221,7 +224,7 @@ def test_vary_steering(self): # Check that different steering values turn the ca
221224
222225 def test_bounding_box_size (self ): # Check that the bounding box is calculated properly and is reasonable
223226 with SimConnection () as sim :
224- ego = sim .add_agent ("XE_Rigged-apollo " , lgsvl .AgentType .EGO , spawnState (sim ))
227+ ego = sim .add_agent ("Jaguar2015XE (Apollo 3.5) " , lgsvl .AgentType .EGO , spawnState (sim ))
225228 bBox = ego .bounding_box
226229 self .assertAlmostEqual (bBox .size .x , abs (bBox .max .x - bBox .min .x ))
227230 self .assertAlmostEqual (bBox .size .y , abs (bBox .max .y - bBox .min .y ))
@@ -232,29 +235,30 @@ def test_bounding_box_size(self): # Check that the bounding box is calculated pr
232235
233236 def test_bounding_box_center (self ): # Check that the bounding box center is calcualted properly
234237 with SimConnection () as sim :
235- ego = sim .add_agent ("XE_Rigged-apollo " , lgsvl .AgentType .EGO , spawnState (sim ))
238+ ego = sim .add_agent ("Jaguar2015XE (Apollo 3.5) " , lgsvl .AgentType .EGO , spawnState (sim ))
236239 bBox = ego .bounding_box
237240 self .assertAlmostEqual (bBox .center .x , (bBox .max .x + bBox .min .x )/ 2 )
238241 self .assertAlmostEqual (bBox .center .y , (bBox .max .y + bBox .min .y )/ 2 )
239242 self .assertAlmostEqual (bBox .center .z , (bBox .max .z + bBox .min .z )/ 2 )
240243
241244 def test_equality (self ): # Check that agent == operation works
242245 with SimConnection () as sim :
243- ego1 = sim .add_agent ("XE_Rigged-apollo " , lgsvl .AgentType .EGO , spawnState (sim ))
244- ego2 = sim .add_agent ("XE_Rigged-autoware " , lgsvl .AgentType .EGO , spawnState (sim ))
246+ ego1 = sim .add_agent ("Jaguar2015XE (Apollo 3.5) " , lgsvl .AgentType .EGO , spawnState (sim ))
247+ ego2 = sim .add_agent ("Jaguar2015XE (Autoware) " , lgsvl .AgentType .EGO , spawnState (sim ))
245248 self .assertTrue (ego1 == ego1 )
246249 self .assertFalse (ego1 == ego2 )
247250
251+ @unittest .skip ("Cruise Control not implemented yet" )
248252 def test_set_fixed_speed (self ):
249253 with SimConnection (60 ) as sim :
250- ego = sim .add_agent ("XE_Rigged-apollo " , lgsvl .AgentType .EGO , spawnState (sim ))
254+ ego = sim .add_agent ("Jaguar2015XE (Apollo 3.5) " , lgsvl .AgentType .EGO , spawnState (sim ))
251255 ego .set_fixed_speed (True , 15.0 )
252256 self .assertAlmostEqual (ego .state .speed , 0 , delta = 0.001 )
253257 sim .run (5 )
254258 self .assertAlmostEqual (ego .state .speed , 15 , delta = 1 )
255259
256260 def create_EGO (self , sim ): # Only create an EGO is none are already spawned
257- return sim .add_agent ("XE_Rigged-apollo " , lgsvl .AgentType .EGO , spawnState (sim ))
261+ return sim .add_agent ("Jaguar2015XE (Apollo 3.5) " , lgsvl .AgentType .EGO , spawnState (sim ))
258262
259263 # def test_large_throttle(self):
260264 # with SimConnection(60) as sim:
0 commit comments