Make test LongEpisode always with autopilot
This commit is contained in:
parent
f743608723
commit
99158bfb6e
|
@ -11,7 +11,7 @@ from carla.util import make_connection
|
|||
|
||||
|
||||
class _BasicTestBase(test.CarlaServerTest):
|
||||
def run_carla_client(self, carla_settings, number_of_episodes, number_of_frames):
|
||||
def run_carla_client(self, carla_settings, number_of_episodes, number_of_frames, control=None):
|
||||
with make_connection(CarlaClient, self.args.host, self.args.port, timeout=15) as client:
|
||||
logging.info('CarlaClient connected, running %d episodes', number_of_episodes)
|
||||
for _ in range(0, number_of_episodes):
|
||||
|
@ -42,11 +42,14 @@ class _BasicTestBase(test.CarlaServerTest):
|
|||
if len(images) != len(carla_settings._cameras):
|
||||
raise RuntimeError('received %d images, expected %d' % (len(images), len(carla_settings._cameras)))
|
||||
logging.debug('sending control...')
|
||||
client.send_control(
|
||||
steer=random.uniform(-1.0, 1.0),
|
||||
throttle=0.3,
|
||||
reverse=reverse,
|
||||
autopilot=autopilot)
|
||||
if control is not None:
|
||||
client.send_control(**control)
|
||||
else:
|
||||
client.send_control(
|
||||
steer=random.uniform(-1.0, 1.0),
|
||||
throttle=0.3,
|
||||
reverse=reverse,
|
||||
autopilot=autopilot)
|
||||
|
||||
|
||||
class UseCase(_BasicTestBase):
|
||||
|
@ -96,4 +99,4 @@ class LongEpisode(_BasicTestBase):
|
|||
def run(self):
|
||||
settings = CarlaSettings()
|
||||
settings.add_camera(Camera('DefaultCamera'))
|
||||
self.run_carla_client(settings, 1, 2000)
|
||||
self.run_carla_client(settings, 1, 2000, {'autopilot': True})
|
||||
|
|
Loading…
Reference in New Issue