Script changes

- Increase max throttle to manual control to 1.0
 - In manual control and generate traffic, ignore the generation
   if the filter only returns one blueprint
This commit is contained in:
Daniel Santos-Olivan 2021-07-30 15:04:58 +02:00 committed by bernat
parent 7cc9c69768
commit fd661cdbf4
2 changed files with 13 additions and 3 deletions

View File

@ -32,7 +32,12 @@ from numpy import random
def get_actor_blueprints(world, filter, generation):
bps = world.get_blueprint_library().filter(filter)
if generation == "All":
if generation.lower() == "all":
return bps
# If the filter returns only one bp, we assume that this one needed
# and therefore, we ignore the generation
if len(bps) == 1:
return bps
try:

View File

@ -159,7 +159,12 @@ def get_actor_display_name(actor, truncate=250):
def get_actor_blueprints(world, filter, generation):
bps = world.get_blueprint_library().filter(filter)
if generation == "All":
if generation.lower() == "all":
return bps
# If the filter returns only one bp, we assume that this one needed
# and therefore, we ignore the generation
if len(bps) == 1:
return bps
try:
@ -546,7 +551,7 @@ class KeyboardControl(object):
def _parse_vehicle_keys(self, keys, milliseconds):
if keys[K_UP] or keys[K_w]:
self._control.throttle = min(self._control.throttle + 0.01, 0.85)
self._control.throttle = min(self._control.throttle + 0.01, 1.00)
else:
self._control.throttle = 0.0