An Automatic Scenario Generator for Validation of Automated Valet Parking Systems

A primary goal of self-driving car manufacturers is to create an autonomous car system that is clearly and demonstrably safer than an average human-controlled car. The real-world tests are expensive, time-consuming and potentially dangerous. The virtual simulation is therefore required. The autonomous driving valet parking is expected to be the first commercially available automated driving function without a human driver at the wheel (SAE Level 4). Although many simulation solutions for the automotive market already exist, none of them features the parking environments. In this paper, we propose a new software virtual scenario generator for the parking sites. The tool populates the synthetics parking maps with objects and actions related to these environments: the cars driving from the drop-off point towards the vacant slots and the randomly placed parked cars, each with a given probability of exiting its slot. The generated scenarios are in the OpenSCENARIO format and are fully simulated in the Virtual Test Drive simulator.


INTRODUCTION
The mandatory requirement for the approval of the highly automated and autonomous driving is to demonstrate that the self-driving cars do not pose more of a risk to pedestrians and other cars than the cars piloted by humans. The validation of such systems needs to be as extensive and as complete as possible to cover every corner-case testing scenario. This is usually done by millions of miles of road tests resulting in very high costs in terms of both money and time required by the field data collection. The realworld tests are potentially dangerous, especially if full-or semi-autonomous functionalities must be validated. The simulation cannot fully replace the realworld tests and driveable millage but can significantly help to reduce potential safety risks, time-to-market and the number of prototypes required in the development and verification process.

Driving Simulation
The obvious advantage of the simulation methods for the self-driving compared to the real-world testing is that the simulation does not technically require a real vehicle and has no running costs (e.g. fuel consumption, maintenance). Simulation approach also widens the spectrum of the test-cases allowing to recreate many situations which would be too dangerous and too expensive in the real-world involving pedestrians, cyclists or high-speed maneuvers under different weather, visibility and traffic conditions. Last but not least, the testing process is significantly accelerated by running the simulations at a faster pace than real-time.
Full-scale simulation comes with the test catalog covering the scene diversity and the variety of edge cases. A relevant scenario is based on the gathered data and the safety requirement specification. Creating each scenario statically can be long and allow to test only a narrow set of the most common behaviors. The machine learning algorithms driving autonomous cars can be overfitted and fail in unseen scenarios due to the little or no data variance. Random subscenario generation for simulators is quite promising in this respect.
The automatic augmentation of the gathered realworld data can help to overcome this limitation by generating the new mixed-reality scenarios avoiding time-consuming and expensive human interaction. In essence, the set of recorded data (weather conditions, visibility, traffic) is mixed up to create a wider set of test scenarios. The randomized elements in these scenarios are, principally, the actors (vehicles of various types and pedestrians), their behaviors and, to a lesser extent, the surrounding scenery with the road network. However, a non-controlled randomization of generated scenarios may lead to the unrealistic scenarios or to the scenarios that may be out of testing scope, potentially increasing the necessary time for training and testing of the model. The parametrizable scenario generators let the user define the boundaries of the generation accordingly to the safety specification and the use case under test.

Automated Valet Parking System
The automated valet parking system is about to become the first commercially available facility at SAE 4 level (Society of Automotive Engineers, 2018) (a human is not required to take over in any situation) (Automotive World, 2018). The system drives autonomously a vehicle from the drop-off point to the assigned parking slot and returns it to the dedicated pick-up point when required. The parking site infrastructure retrofitted with sensors and connectivity communicates constantly with the vehicles and guides them to the vacant parking slots. The prior knowledge of the environment reduces the number of test scenarios (compared to urban driving) but the physical testing is still expensive and may still pose a serious risk for the humans and the environment. This operational domain requires also a set of its specific models of objects and behaviors.

Contribution
In this paper, we introduce the UNIMORE Map Populator, a virtual scenario generator for the parking sites. The tool fills the scenario maps with objects and actions related to the parking environments: parked cars, pedestrians, moving cars looking for an empty slot or the cars that are exiting their slots and reenter the traffic again. It permits a user-defined ratio of traffic participants randomizing their placement and their traffic behaviors within a parameterized set of values (e.g. the distances between the exiting cars and the cars under test). The tool is fully integrated with the OFFIS StreetArt synthetic parking maps generator. The scenarios are stored in the OpenSCENARIO format and can be played in the Virtual Test Drive (VTD) from Vires (VTD, 2019), a well-established toolchain for driving simulation. To our knowledge, the UNIMORE Map Populator and the OFFIS StreetArt are the first scenario generators specifically targeting driving in the parking areas. We provide the necessary abstraction to build the models of traffic in the parking areas and enable the safety analysis required by the international standards (ISO, 2011).

Paper Organization
This document is structured as follows. In the next section, we present the related work. In Section 3, we describe the scenario generator for the static and dynamic content of the parking sites. Section 4 outlines the simulation of the basic parking maneuvers. We conclude the paper in Section 5.

RELATED WORKS
In this section, we describe the works that focus on scenario-based simulation automated or autonomous driving software with respect to the proposed virtual scenario generator for the parking sites.

Driving Simulators
In the fields of automated and autonomous driving, simulators are widely adopted for both training and testing purposes. The simulators like Dynacar (Tecnalia, 2019) or Gazebo (Syed Ahamed et al., 2018) target dynamic aspects of the vehicle (e.g. electrified powertrain systems) while others, like VTD (VTD, 2019), PreScan (TASS International, 2019) or Carla (Dosovitskiy et al., 2017) allow traffic behavior testing. One of the most important features of a driving simulator is realism, both in terms of visual resemblance with the real world, physics and vehicle behavior. In recent years, researchers started also to exploit the capabilities of the video games graphical engines. The simulators like Carla (urban driving simulation) or Torcs (Wymann et al., 2015) (racing simulation) are built on game engines such as Unity and Unreal Engine. In this work, we decided to use VTD to play the generated scenarios but any simulator supporting OpenSCENARIO format can be used instead.

Parameterized Simulation
The ASM Traffic adds traffic to dSPACE's Automotive Simulation Models (ASM) (dSPACE, 2017). It simulates the behavior of the vehicle under test in a traffic situation involving other traffic participants. The simulation can be performed by varying the model parameters. During the simulation, the scenario segments and road features can also be altered by means of scripting language. In our approach, the scenario generation process is performed directly on the OpenSCENARIO structures and parking environment model is proposed.
The example in (Matlab, 2019) shows how Matlab Simulink Automated Driving Toolbox can be used to build and test an automated parking valet system. The toolbox provides algorithms for designing, simulating, and testing multiple aspects of autonomous driving systems like perception, sensor fusion, path planning and traffic simulation. It features also the Driving Scenario Designer to design synthetic driving scenarios. In our tool, the scenarios are generated automatically given the input parameters and can be further loaded in Matlab through the Open-DRIVE format.
In (Zhou and del Re, 2018) the authors identify the critical scenarios based on the data collected from the accidents. These data can be used in our approach to set the scenario generation parameters.

Parking Sites Simulation
Several works propose the simulation techniques for the parking maneuver (Heinen et al., 2015;de Oliveira Andrade et al., 2011;Schwesinger et al., 2016). For instance, in (Schwesinger et al., 2016) the required parking spot width for the parking maneuver is evaluated in simulation. None of these works consider other traffic participants. The focus of our paper is on the simulation of the entire traffic in the parking environments. In ) the authors study the parking maneuvers and derive analytically the minimum safety distance between traffic participants. Our framework can be used to derive empirically certain parameters important from the safety perspective but its main goal is in identifying malfunction and corner cases of the autonomous driving algorithms in complex traffic situations.
Stanford's robot Junior (Montemerlo et al., 2009) was equipped with separate planners for common road navigation and parking slot navigation. In (Löper et al., 2013;Tcheumadjeu et al., 2018;Min and Choi, 2013;Banzhaf et al., 2017;Chirca et al., 2015) the valet parking prototypes with a fully automated navigation and monitoring are described. The focus of these works is on system architecture and implementation. The aspects related to the safety and simulation are not covered.

SCENARIO GENERATOR
In this section, we present the scenario generation process, breaking it into two separate parts: static and dynamic content generation.
The static content is constituted by the road network (e.g. roads) with the road objects (e.g. traffic signs, road surface marking, cars) and their detailed topological and topographical order. Since most of the driving simulators require a similar static content, several standards were developed. The one that has gained traction in recent years is OpenDRIVE. The format stores the static content data in an XML file that describes various features and geometry of the road and its surrounding.
The dynamic content specifies the time-variant behavior of all the active entities that take part in the simulation (e.g. vehicles and pedestrians). Actions of traffic participants (e.g. lane change) and road infrastructure (e.g. change of a traffic control signal) are triggered by conditional events (e.g. vehicle's position is ten meters to the pedestrian). OpenSCENARIO is a commonly used description of the dynamic content for driving and traffic simulators. It describes the traffic actions in a hierarchical structure of XML file as a storyboard subdivided into stories, acts, and sequences.
In our framework, the scenario generation process is orchestrated by the Street Tools, a non-free academic tool suite from OFFIS 1 . It includes three plugins: static content generation, dynamic content generation, and 3D rendering. Figure 1 depicts the structure of the scenario generator. The first plugin, map-generator, randomly creates a road network, while the second plugin, map-populator, populates it with dynamic objects. The 3D rendering plugin is beyond the scope of this work. Because of its open and modular design, we decided to use VTD as environment simulation software. Hereafter, we detail the plugins for map-generation and map-population.

Static Content: Map Generation
We use the StreetArt from OFFIS to generate the synthetic maps of the parking sites. The maps are automatically assembled from the tileset composed of straight roads, 90 degrees bends, roadside parking slots, three-way and four-way junctions. Each tile of the set has its own definition in an OpenDRIVE file, with absolute position, fixed-length width, and parking slots. The generated layout file is simply a collection of these tiles which have been properly arranged and offsetted by the algorithm. The generation parameters (e.g. parking area size, number of parking slots) are specified by the user and the final layout is saved in the OpenDRIVE format.
An OpenDRIVE file begins with a header element that has time and version as the attributes. The road network is specified with street elements (road) and intersections (junction). Each element has a unique ID attribute and can be linked with the other elements (link). Street elements can have another street or intersection element as a predecessor and successor. Figure 2 shows an example of a synthetically generated map.

Dynamic Content: Map Population
The map populator is the plugin that we implemented to automatize the vehicle placement on the parking site maps and the behavior assignment for the various traffic participants. The safety engineer is no longer burdened with a tedious task of manually placing the vehicles and specifying their behaviors. The scenario is now automatically generated according to the userdefined parameters.
The map populator permits to specify the number of parked cars, the number of driving cars, and the probabilities of different actions that these cars can undertake.
The coordinates of the parking slot, its orientation with regards to the road and the car parked on it are calculated and added to the structure describing the road map of a given scenario. Figure 3 shows an XML snippet with a sample parking slot. The driving cars are randomly placed on the road network and one of them is selected as the ego car (i.e. the car under test). The user defines the ratio of the cars that are parking and those that are cruising in the autonomous mode.
Each parking car is assigned a path towards a distinct unoccupied parking slot (reachability from the initial point is verified). In the XML file, a path is defined as a sequence of roads and a routing strategy (e.g. shortest, fastest, least intersections or random). The path is generated by selecting randomly the start and the destination from the set of road elements (the destination is chosen from the road subset with lateral parking slots).
At the destination, the car performs a parking maneuver. The type of parking maneuver depends upon the car relative position to the parking slot (see detailed description in the next section). For parking maneuver and for exiting maneuver specific trajectories are designed. A trajectory is defined as a sequence of vertexes with a specific shape (e.g. polyline, spline or clothoid). We model the parking trajectory by three way-points and a counter that is incremented at each way-point and triggers a predefined action (e.g. reduce the speed, stop).
Once the parking maneuver is completed and the car is stopped, the driver can exit after a random amount of time and walk along a simple pathshape towards the parking exit. Figure 4 shows a driver that has exited a parked car. The ratio of exiting drivers is tunable and can be disabled for the fully autonomous parking systems.
The cars cruising in the autonomous mode can make sudden stops when the ego car is within a given range to simulate the behavior of an undecided driver or a car malfunction. A specified number of parked cars is randomly placed on the free parking slots. Some of them can suddenly exit their parking slots at the approach of the ego car and re-enter the traffic (see Figure 5). The distance to the ego car that activates the action, as well as the number of cars implementing this behavior, are specified by the user.
During our test/experiments, we were able to generate batches of 10 parking scenarios with 3+1 (ego) vehicles within approximately 70-80 seconds.

PARKING MANEUVERS
The extensive simulation allowed us to identify a set of different parking maneuvers to park the vehicle aligned and accurately within the spot. In this section, we detail three basic parking maneuvers implemented in the map populator.
The driveable path of the car towards its parking slot is given in the scenario by the identifier of the initial and the final road tile. The simulator finds and assigns to the car a path between these two tiles. When the car reaches its final destination, it must enter the parking slot. However, the parking maneuver is not defined in the OpenSCENARIO standard. We therefore specify it as a sequence of absolute coordinates and associated actions. The parking driveable path depends on the vehicle's position relative to the target parking slot, the road geometry, and the vehicle's turning radius.

Forward Bay Parking
The forward bay parking maneuver is used when the target parking slot is situated perpendicularly to the road. For the standard bay parking maneuver, we select three control points (P 0 , P 1 and P 2 ) on the parking trajectory (see Figure 6) at which the vehicle undertakes the following actions: The coordinates of the control points are given as: with: • EndRoad -the destination road element, • ParkingSlot -the selected parking slot, • x -x coordinate of road element, • y -y coordinate of road element, • hdg -the angle of the ParkingSlot relative to the EndRoad direction, • ∆ ∆ ∆ -parameter depending on the distance between the beginning of the EndRoad and the ParkingSlot, the default width of a single parking slot, the vehicle's turning radius.
The shape of the curvature (spline) depends on the definition of the steering angle of the car's model. As the figure shows, for a single parking maneuver we generate two symmetric trajectories. This is because the car driving in the simulator autopilot mode can arrive from one of two opposing directions and the actual path cannot be determined before running the simulation. The trigonometric functions, sine and cosine, are used to determine P 1 in more complex scenarios when the road is not perpendicular to the X or Y axes. By using sine and cosine, we can apply the same method to determine the parking trajectory for any orientation of the road.

Junction Parking Slot
When the car approaches the parking slot from the front (Figure 7), it performs the parking maneuver with the coordinates of the points P 0 and P 1 modified as follows: x + ∆ · cos(hdg) y 1 = ParkingSlot.y + ∆ · sin(hdg)

Margin Parking Slot
As shown in Figure 8, in this case, the space is too narrow to park the car with a single turn. Therefore, the entire maneuver is decomposed into three segments: two forward and one reverse. The first segment trajectory transposes the vehicle parallel to the parking spot. Then, the reverse segment trajectory moves the car away from the parking spot but, at the same time, turns the car's front towards it. The extra distance and the new car orientation resulting from moving away from the parking slot makes the next phase easier. In the end, the forward-path drives the car into the target slot.  The first arc starts from the end of the penultimate road element in the path leading to the parking slot (PrevEndRoad) and its coordinates are given as: x 0 = PrevEndRoad.x y 0 = PrevEndRoad.y P 1 = x 1 = EndRoad.x + ∆ · cos(hdg) y 1 = EndRoad.y + ∆ · sin(hdg) The second arc forms a "V" with the first arc and is done in reverse. Its end coordinate is given by 2 : P 2 = x 2 = PrevEndRoad.x + ∆ · cos(hdg) y 2 = ParkingSlot.y − ∆ · sin(hdg) Finally, the path to drive into the parking space: In this work, we introduced a toolchain for automatic generation of random scenarios for autonomous driving in parking sites. The scenarios are described in OpenSCENARIO format and can be played in various driving simulators. The toolchain was integrated into a broader test system comprising of autonomous vehicle control logic, vehicle dynamic, sensors, traffic observer, real data database Esen et al., 2020). In our ongoing work, we are extending the catalog of parking maneuvers (e.g. reverse and parallel bay) and exporting the generated scenarios to the simulators based on the commercial game engines.