Skip to content

Commit d12d8bb

Browse files
glopezdiestGuillermojackbart94TayYim13370724230
authored
Release 0.9.15 merge (#1032)
* New parsing (#858) * Improved junction scenarios to work on routes * Added basic agent to the SyncArrival behavior * Improved all routes * Updated to use new route planner * Improved synchornization for S7 adn S9 * WIP: Added new background activity * Minor fixes * Planner changes * Added compatibility with CARLA 0.9.12 * Pretty code * Changed S9 to an actor flow * Improved synchronization of crossing scenarios * WIP: Improve synchronization * First working behavior * Fixed other leading vehicle scenario speed bug * Created new S2 for routes and added it to routes * Better ControlLoss + fix missplaced route scenarios * Improved actor flows with new python agent * Minor fixes * Cleanup and some example changes * Added CHANGELOG * Removed unused atomic behaviors * Pretty code * Added missing BA code * Removed constant velocity agent * Added other parameters * Pretty code * Fixed CHANGELOG * Pretty code * Fixed sceario parsing bug * Minor fixes * CHANGELOG * Minor fixes * Fixed bug with agent's route * Improve actor flow scenarios (#859) * Improved actor flow behavior * CHANGELOG Co-authored-by: Guillermo <[email protected]> * Changes in Actor Flow, implementation of Accident and Construction, changes to BA (#863) * Initial testing * Changed ActorFlow to Town04 * WIP: ActorFLow at routes * WIP2: Actor Flow * Changes to Accident and Construction blocking scenarios Implementation of chages in BA to allow TM lane changes through set_path * Improve road behavior, actor flow and accident scenarios * Construction scenario implementation Co-authored-by: Guillermo <[email protected]> * Changed ActorFlow to use the TrafficManager * Routes can now have scenario specific criterias * Scenarios are now route specific * Added urban bicycle flow prototype * Added CHANGELOG (#870) Co-authored-by: Guillermo <[email protected]> * Added VehicleOpensDoor scenario * Minor changes * Fixed bug with new JucntionScenarioManager (#873) Co-authored-by: Guillermo <[email protected]> * Added dynamic weathers to routes * Improved traffic event handling (#877) Co-authored-by: Guillermo <[email protected]> * Added HighwayExit scenario * Added minimum speed criteria * Pretty code * New Parking Exit scenario * General improvements (#884) Co-authored-by: Guillermo <[email protected]> * Improve bycicle flow scenario * Changed BA 'RemoveLane' for 'SwitchLane' * New LB2.0 scenario improvements * Refined BA's target speed Co-authored-by: Guillermo <[email protected]> * Added HighwayCutIn scenario * Improved HighwayCutIn * CHANGELOG Co-authored-by: Guillermo <[email protected]> * Added Idle (#898) Co-authored-by: Guillermo <[email protected]> * Added ParkingCutIn scenario * New MergerIntoSlowTraffic scenario * Updated _remove_junction_entry * Update highway_cut_in.py * Added MergerIntoSlowTraffic scenario * Update background_manager.py * Added MergerIntoSlowTraffic route * Added MergerIntoSlowTraffic scenario * Improve night mode (#902) * Added lights beahvior to rotues * Improved lights and automatic TM lights Co-authored-by: Guillermo <[email protected]> * Add yield to emergency vehicle scenario * Add new scenario PedestrianCrossing * New Blocked intersection scenario * Added InvadingTurn scenario * Added Static cut in scenario * Added BicycleAtSideLane scenario * Improved route's timeout * Leaderboard 2.0 scenario improvements * Fixed several merge errors * New scenario improvements * Removed debug messages * Added scenario timeouts * Added frame to traffic events * Added realtime to OutsideRouteLanesTest * More Leaderboard 2.0 scenario improvements * Route obstacles + parked vehicle destruction * Scenarios no longer spawn old vehicles * Added variable flow to route obstacles * Added VehicleTurningRotue variations * Added noise to control loss * Route improvements * MinSpeed criteria checkpoints + Pedestrian patch * Fix bug PedestrianCrossing * Fixed bug pedestrians and parked vehicles (#933) * Added parking removal to crossing actors * Fixed bug pedestrians and parked vehicles * Improved pedestrian code Co-authored-by: Guillermo <[email protected]> * Removed old test routes * Fixed bug with YieldtoEV criteria * Minor parameter changes * Improved scenarios * Added hand brake to BlockedIntersection * Revereted some of the constructions changes * Some parameter changes * Removed unused code * Prettyfied some criteria * Fixed units bug * Parameter change * Changed opposite flow parameters * Minor robustness changes * Removed police car from several scenarios * Updated highway cut in parameters * Final parameter changes + some minor BA changes * Added vehicle opens door stop * Fixed VehicleOpensDoor * Added ActroFlow patch * Minor sensor destruction change * Changes numpy version to match CARLA's * Minor fix * Added tm ports to BA * Added the port to all set autopilots * Minor improvement to result writer and debug * Added missing sensor destruction * Added spawn transforms to CDP actors * Added ratio to min speed * fix duplicate env initialization during runtime * check location in DriveDistance * add is_runtime_init_mode process * fix weather * Added ScenariOTrigger blackboard * removed whitespaces * Added a lock at CDP * Added Leaderboard 2.0 changelog * Added Leaderboard 2.0 routes * Fixed bug with MinimumSpeedRouteTest * Added Release 0.9.15 --------- Co-authored-by: Guillermo <[email protected]> Co-authored-by: Jacopo Bartiromo <[email protected]> Co-authored-by: Tay Yim <[email protected]> Co-authored-by: yuting <[email protected]> Co-authored-by: dudu_fang <[email protected]> Co-authored-by: threewater-wang <[email protected]> Co-authored-by: joel-mb <[email protected]>
1 parent 3522896 commit d12d8bb

File tree

67 files changed

+43113
-21094
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+43113
-21094
lines changed

Docs/CHANGELOG.md

Lines changed: 88 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## Table of Contents
2-
* [Latest Changes](#latest-changes)
2+
* [CARLA ScenarioRunner 0.9.15](#carla-scenariorunner-0915)
33
* [CARLA ScenarioRunner 0.9.13](#carla-scenariorunner-0913)
44
* [CARLA ScenarioRunner 0.9.12](#carla-scenariorunner-0912)
55
* [CARLA ScenarioRunner 0.9.11](#carla-scenariorunner-0911)
@@ -12,18 +12,100 @@
1212
* [CARLA ScenarioRunner 0.9.5](#carla-scenariorunner-095)
1313
* [CARLA ScenarioRunner 0.9.2](#carla-scenariorunner-092)
1414

15-
## Latest changes
15+
## CARLA ScenarioRunner 0.9.15
1616
### :rocket: New Features
17-
* Minor improvements to some example scenarios. These include FollowLeadingVehicle, VehicleTurning, DynamicObjectCrossing and SignalizedJunctionRightTurn and RunningRedLight. Their behaviors are now more smooth, robust and some outdated mechanics have been removed
18-
* SignalizedJunctionLeftTurn has been remade. It now has an actor flow on which the ego has to merge into, instead of a single vehicle.
19-
* The BackgroundActivity has been readded to the routes, which the objective of creating the sensation of traffic around the ego
2017
* Add waypoint reached threshold so that the precision of the actor reaching to waypoints can be adjusted based on object types.
2118
* OpenSCENARIO support:
2219
- Added both init and story support for `EntityAction`
2320
- Added story support for `TrafficSignalControllerAction`
2421
- Added both init and story support for `LateralDistanceAction`
2522
- Added support for `TrafficSignalControllerCondition`
2623
* Supported OpenSCENARIO 2.0 standard.
24+
* New scenarios:
25+
- InvadingTurn: vehicles at the opposite direction lane partially invade the ego's one, forcing it to leave space for them,moving slightly off-center.
26+
- EnterActorFlow: the ego has to enter a highway lane filled with incoming traffic
27+
- MergerIntoslowtraffic. variation of `EnterActorFlow` but with slow traffic.
28+
- InterurbanActorFlow and InterurbanAdvancedActorFlow: actor flow scenarios for the new interurban intersections with dedicated lanes present at Town12 and Town13.
29+
- Accident: the ego is met with an accident, forcing it to lane change to avoid it.
30+
- AccidentTwoWays: same as `Accident` but having to invade an opposite direction lane.
31+
- ParkedObstacle: similar to `Accident` but with a parked obstacle instead.
32+
- ParkedObstacleTwoWays: same as `ParkedObstacle` but having to invade an opposite direction lane.
33+
- HazardAtSideLane: similar to `Accident` but with a moving group of bicycles in the rightmost park of the lane
34+
- HazardAtSideLaneTwoWays: same as `HazardAtSideLane` but having to invade an opposite direction lane.
35+
- ConstructionObstacleTwoWays: same as `ConstructionObstacle` but having to invade an opposite direction lane.
36+
- VehicleOpensDoorTwoWays: similar to `Accident` but this time the blockage is cause by a vehicle opening its door.
37+
- StaticCutIn: the ego is meant with an adversary that exits a stopped lane, cutting in front of the ego.
38+
- ParkingCutIn: similar to `StaticCutIn` but the adversary starts at a parking lane.
39+
- HighwayCutIn: the ego is met with a vehicle that tries to enter the highway by cutting in front of it.
40+
- ParkingExit: Only usable at the beginning of the routes, makes the ego start at a parking lane.
41+
- HardBreakRoute: uses the BackgroundActivity to make all vehicles in front of the ego hard break.
42+
- YieldToEmergencyVehicle: the ego finds an emergency vehicle behind, having to lane chane to give way.
43+
- VehicleTurningRoutePedestrian: variation of `VehicleTurningRoute` but with a pedestrian crossing instead of a bycicle.
44+
- BlockedIntersection: with low visibility, the ego performs a turn only to find out that the end is blocked by another vehicle.
45+
- CrossingBicycleFlow: the ego has to do a turn at an intersection but it has to cross a bycicle lane full of traffic.
46+
- PedestrianCrossing: a group of pedestrians crossing a crosswalk. Easier version of `DynamicObjectCrossing` with no occluder.
47+
- ParkingCrossingPedestrian: variation of `DynamicObjectCrossing`, but using a parked vehicle as the occluder.
48+
- OppositeVehicleTakingPriority: variation of `OppositeVehicleRunningRedLight` but without traffic lights.
49+
- NonSignalizedJunctionLeftTurn: variation of `SignalizedJunctionLeftTurn` but without traffic lights.
50+
- NonSignalizedJunctionRightTurn: variation of `SignalizedJunctionRightTurn` but without traffic lights.
51+
- PriorityAtJunction: utility scenario during routes to add a green traffic light at the next intersection.
52+
- NoSignalJunctionCrossingRoute: Does nothing but wait for the ego to exit an intersection.
53+
* Improvements to old scenarios:
54+
- ControlLoss: Added actual noise to the ego's control (currently only during routes).
55+
- All VehicleTurning variations: more robustness and better synchronization.
56+
- OppositeVehicleRunningRedLight: Improvement synchronization and the opposite vehicle's behavior.
57+
- SignalizedJunctionLeftTurn: it is now an actor flow that ego has to cross.
58+
- SignalizedJunctionRightTurn. it is now an actor flow that the ego has to merge into.
59+
- Renamed `ConstructionSetupCrossing` to `ConstructionObstacle`, and prepared it for routes.
60+
* Improvements to the CarlaDataProvider:
61+
- Added a lock when checking the dictionaries to avoid issues in multithreading
62+
- Added the `transform` argument to all register function to avoid returning None during the first frame
63+
- Added the `get_global_route_planner` and `get_all_actors` to avoid repeating these costly calls more than necessary
64+
- Added `set_runtime_init_mode` and `is_runtime_init_mode`, used by the Leaderboard to initialize scenarios during the simulation
65+
- At the `create_blueprint` function, replaced the `safe` argument with the `attribute_filter`, for a more generic parsing of any of the blueprint attributes.
66+
- Removed the `CarlaDataProvider.get_ego_vehicle_route()` and `CarlaDataProvider.set_ego_vehicle_route()` functions as this is now information available to all scenarios.
67+
* Improvements to the routes:
68+
- Scenarios are no longer position based, but instead part of a route's xml.
69+
- Routes now also include the criteria of its scenarios.
70+
- `waypoint` have been renamed to `position` and are part of the `waypoints` category.
71+
- More than one `weather` are allowed, creating a dynamic one based on the ego vehicle's completed percentage of the route.
72+
- Changed the timeout to also be dependent on the distance driven by the ego vehicle.
73+
- Added the `RouteLightsBehavior` to control of all scene and vehicle lights during runtime
74+
- Added a new criteria for routes, `CheckMinSpeed`, that checks the ego's speed and compares it with the rest of the traffic
75+
- Separated the route argument into two, `route` for the file path, and `route-id`, for the name of route. the functionality remains unchanged.
76+
- Simplified the overall parsing.
77+
* The BackgroundActivity part of the routes has been completely remade, with the objective of creating the sensation of traffic around the ego will increasing the performance
78+
* Added a Backgroundmanager to interact with the new BackgroundActivity, to allow it to adapt to incoming scenarios
79+
* Added new atomic behaviors:
80+
- SyncArrivalWithAgent
81+
- CutIn
82+
- AddNoiseToRouteEgo
83+
- ConstantVelocityAgentBehavior
84+
- AdaptiveConstantVelocityAgentBehavior
85+
- WaitForever
86+
- BatchActorTransformSetter
87+
- OppositeActorFlow
88+
- InvadingActorFlow
89+
- BicycleFlow
90+
- OpenVehicleDoor
91+
- SwitchWrongDirectionTest
92+
- SwitchMinSpeedCriteria
93+
- WalkerFlow
94+
- AIWalkerBehavior
95+
- ScenarioTimeout
96+
- MovePedestrianWithEgo
97+
* Improved the Criterion class for a more comprehensive base criteria and easier use in the `results_writer` class.
98+
* Added new atomic criteria:
99+
- MinimumSpeedRouteTest
100+
- YieldToEmergencyVehicleTest
101+
- ScenarioTimeoutTest
102+
* Added new atomic trigger conditions
103+
- WaitUntilInFrontPosition
104+
* Merged the `Scenario` class into the `BasicScenario` one.
105+
* Scenarios can now have parameters as part of the their xml definition, which is saved as a dictionary at `config.other_parameters`
106+
* Simplified and improved how routes are parsed.
107+
* Added the `wait-for-repetitions` argument at the manual control for a smoother transition between scenarios / repetitions
108+
* Updated numpy's version to avoid issues with newer version of Python 3
27109

28110
### :bug: Bug Fixes
29111
* Fixed bug at OtherLeadingVehicle scenario causing the vehicles to move faster than intended
@@ -459,3 +541,4 @@
459541
- WaitForTrafficLightState: wait for the traffic light to have a given state
460542
- SyncArrival: sync the arrival of two vehicles to a given target
461543
- AddNoiseToVehicle: Add noise to steer as well as throttle of the vehicle
544+
- CutInWithStaticVehicle:Based on the code of ParkingCutIn,realized the cutin function of a static vehicle on the highway

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ branch contains the latest fixes and features, and may be required to use the la
2121

2222
It is important to also consider the release version that has to match the CARLA version.
2323

24+
* [Version 0.9.15](https://github.com/carla-simulator/scenario_runner/releases/tag/v0.9.15) and the 0.9.15 Branch: Compatible with [CARLA 0.9.15](https://github.com/carla-simulator/carla/releases/tag/0.9.15)
2425
* [Version 0.9.13](https://github.com/carla-simulator/scenario_runner/releases/tag/v0.9.13) and the 0.9.13 Branch: Compatible with [CARLA 0.9.13](https://github.com/carla-simulator/carla/releases/tag/0.9.13)
2526
* [Version 0.9.12](https://github.com/carla-simulator/scenario_runner/releases/tag/v0.9.12) and the 0.9.12 Branch: Compatible with [CARLA 0.9.12](https://github.com/carla-simulator/carla/releases/tag/0.9.12)
2627
* [Version 0.9.11](https://github.com/carla-simulator/scenario_runner/releases/tag/v0.9.11) and the 0.9.11 Branch: Compatible with [CARLA 0.9.11](https://github.com/carla-simulator/carla/releases/tag/0.9.11)

manual_control.py

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
from pygame.locals import K_F1
6868
from pygame.locals import KMOD_CTRL
6969
from pygame.locals import KMOD_SHIFT
70-
from pygame.locals import K_BACKSPACE
7170
from pygame.locals import K_TAB
7271
from pygame.locals import K_SPACE
7372
from pygame.locals import K_UP
@@ -114,8 +113,6 @@ def get_actor_display_name(actor, truncate=250):
114113

115114
class World(object):
116115

117-
restarted = False
118-
119116
def __init__(self, carla_world, hud, args):
120117
self.world = carla_world
121118
try:
@@ -140,10 +137,6 @@ def __init__(self, carla_world, hud, args):
140137

141138
def restart(self, args):
142139

143-
if self.restarted:
144-
return
145-
self.restarted = True
146-
147140
self.player_max_speed = 1.589
148141
self.player_max_speed_fast = 3.713
149142

@@ -161,7 +154,7 @@ def restart(self, args):
161154
print("Ego vehicle found")
162155
self.player = vehicle
163156
break
164-
157+
165158
self.player_name = self.player.type_id
166159

167160
# Set up the sensors.
@@ -177,9 +170,14 @@ def restart(self, args):
177170

178171
self.world.wait_for_tick()
179172

180-
def tick(self, clock):
173+
def tick(self, clock, wait_for_repetitions):
181174
if len(self.world.get_actors().filter(self.player_name)) < 1:
182-
return False
175+
if not wait_for_repetitions:
176+
return False
177+
else:
178+
self.player = None
179+
self.destroy()
180+
self.restart()
183181

184182
self.hud.tick(self, clock)
185183
return True
@@ -232,13 +230,6 @@ def parse_events(self, client, world, clock):
232230
elif event.type == pygame.KEYUP:
233231
if self._is_quit_shortcut(event.key):
234232
return True
235-
elif event.key == K_BACKSPACE:
236-
if self._autopilot_enabled:
237-
world.player.set_autopilot(False)
238-
world.restart()
239-
world.player.set_autopilot(True)
240-
else:
241-
world.restart()
242233
elif event.key == K_F1:
243234
world.hud.toggle_info()
244235
elif event.key == K_TAB:
@@ -917,7 +908,7 @@ def game_loop(args):
917908
clock.tick_busy_loop(60)
918909
if controller.parse_events(client, world, clock):
919910
return
920-
if not world.tick(clock):
911+
if not world.tick(clock, args.wait_for_repetitions):
921912
return
922913
world.render(display)
923914
pygame.display.flip()
@@ -978,6 +969,10 @@ def main():
978969
'--keep_ego_vehicle',
979970
action='store_true',
980971
help='do not destroy ego vehicle on exit')
972+
argparser.add_argument(
973+
'--wait-for-repetitions',
974+
action='store_true',
975+
help='Avoids stopping the manual control when the scenario ends.')
981976
args = argparser.parse_args()
982977

983978
args.width, args.height = [int(x) for x in args.res.split('x')]

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
py-trees==0.8.3
2+
numpy==1.18.4; python_version >= '3.0'
23
networkx==2.2
34
Shapely==1.7.1
45
psutil
56
xmlschema==1.0.18
67
ephem
78
tabulate
89
opencv-python==4.2.0.32
9-
numpy
1010
matplotlib
1111
six
1212
simple-watchdog-timer

scenario_runner.py

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ def __init__(self, args):
9393
self.client = carla.Client(args.host, int(args.port))
9494
self.client.set_timeout(self.client_timeout)
9595
dist = pkg_resources.get_distribution("carla")
96-
if LooseVersion(dist.version) < LooseVersion('0.9.12'):
97-
raise ImportError("CARLA version 0.9.12 or newer required. CARLA version found: {}".format(dist))
96+
if LooseVersion(dist.version) < LooseVersion('0.9.15'):
97+
raise ImportError("CARLA version 0.9.15 or newer required. CARLA version found: {}".format(dist))
9898

9999
# Load agent if requested via command line args
100100
# If something goes wrong an exception will be thrown by importlib (ok here)
@@ -236,7 +236,10 @@ def _prepare_ego_vehicles(self, ego_vehicles):
236236

237237
for i, _ in enumerate(self.ego_vehicles):
238238
self.ego_vehicles[i].set_transform(ego_vehicles[i].transform)
239-
CarlaDataProvider.register_actor(self.ego_vehicles[i])
239+
self.ego_vehicles[i].set_target_velocity(carla.Vector3D())
240+
self.ego_vehicles[i].set_target_angular_velocity(carla.Vector3D())
241+
self.ego_vehicles[i].apply_control(carla.VehicleControl())
242+
CarlaDataProvider.register_actor(self.ego_vehicles[i], ego_vehicles[i].transform)
240243

241244
# sync state
242245
if CarlaDataProvider.is_sync_mode():
@@ -401,11 +404,11 @@ def _load_and_run_scenario(self, config):
401404
timeout=100000)
402405
else:
403406
scenario_class = self._get_scenario_class_or_fail(config.type)
404-
scenario = scenario_class(self.world,
405-
self.ego_vehicles,
406-
config,
407-
self._args.randomize,
408-
self._args.debug)
407+
scenario = scenario_class(world=self.world,
408+
ego_vehicles=self.ego_vehicles,
409+
config=config,
410+
randomize=self._args.randomize,
411+
debug_mode=self._args.debug)
409412
except Exception as exception: # pylint: disable=broad-except
410413
print("The scenario cannot be loaded")
411414
traceback.print_exc()
@@ -471,15 +474,8 @@ def _run_route(self):
471474
"""
472475
result = False
473476

474-
if self._args.route:
475-
routes = self._args.route[0]
476-
scenario_file = self._args.route[1]
477-
single_route = None
478-
if len(self._args.route) > 2:
479-
single_route = self._args.route[2]
480-
481477
# retrieve routes
482-
route_configurations = RouteParser.parse_routes_file(routes, scenario_file, single_route)
478+
route_configurations = RouteParser.parse_routes_file(self._args.route, self._args.route_id)
483479

484480
for config in route_configurations:
485481
for _ in range(self._args.repetitions):
@@ -576,11 +572,10 @@ def main():
576572
parser.add_argument('--openscenario', help='Provide an OpenSCENARIO definition')
577573
parser.add_argument('--openscenarioparams', help='Overwrited for OpenSCENARIO ParameterDeclaration')
578574
parser.add_argument('--openscenario2', help='Provide an openscenario2 definition')
575+
parser.add_argument('--route', help='Run a route as a scenario', type=str)
576+
parser.add_argument('--route-id', help='Run a specific route inside that \'route\' file', default='', type=str)
579577
parser.add_argument(
580-
'--route', help='Run a route as a scenario (input: (route_file,scenario_file,[route id]))', nargs='+', type=str)
581-
582-
parser.add_argument(
583-
'--agent', help="Agent used to execute the scenario. Currently only compatible with route-based scenarios.")
578+
'--agent', help="Agent used to execute the route. Not compatible with non-route-based scenarios.")
584579
parser.add_argument('--agentConfig', type=str, help="Path to Agent's configuration file", default="")
585580

586581
parser.add_argument('--output', action="store_true", help='Provide results on stdout')

0 commit comments

Comments
 (0)