Adding Ego Vehicle Destinations to a Map
It is possible to define fixed destination points in a map. These fixed destination points can be fetched by the Python API and passed on to the AD stack. This enables developers to run a quick test case on any given map. This guide provides instructions on how to properly define destination points. The guide is for users who will be using the SVL Simulator in Developer Mode, creating custom maps, or editing existing maps in the Unity Editor.
All locations on a given map are not valid destination points for an AD stack. Given a starting point and a destination, AD stacks will search through the HD map to find a route that will connect these two points. Although intuitively it may seem that any point on a road would be a valid destination, this is not necessarily the case since all roads in the maps are not necessarily connected, and even if they are connected they may require violation of traffic rules. To solve this problem, destination points are linked to spawn points in the simulator. Each spawn point maintains a list of destinations that are valid for that particular spawn point (details will be covered later).
To confirm that a location is accessible from a particular starting point on the map:
- Open the map annotations tools by selecting Annotate HD Map under the Simulator menu in the Unity editor or use the keyboard shortcut Shift + Alt + M.
- In the new window, click the View All button to visualize all annotations.
- Trace a path between each spawn and destination point along the map annotations to confirm a path exists.
Below is an example of map annotations in the simulator. The cyan colored markings are the lane center annotations with the arrows indicating the direction of travel. These markings can be traced to validate that a destination point is valid for a given spawn point. Bear in mind that arriving at a given destination may only be possible with one or more lane changes.
Once a location is selected, to create a destination point, and empty GameObject must be created at the desired location. Give the GameObject a name that identifies it as a destination object such as
DestInfo. Some AD stacks take the orientation of destination points into account in addition to their position; therefore, it is important to make sure that the Z-axis of the GameObject is aligned to the direction the vehicle should be pointing when it arrives at the destination. You should also make sure that the Y-axis position (altitude) of the GameObject places it on the road surface.
Below is a top-down view of a destination point (the blue and red axes) correctly aligned to the underlying map annotations.
In the 'Inspector' tab, click 'Add Component' and select the
Destinationinfo script as seen below.
Repeat this step for any other destination point you wish to create on the map.
Spawn points are defined by the
SpawnInfo GameObjects in the scene. Each
SpawnInfo can hold a list of references to destination points that an ego vehicle should be able to drive to from the spawn point. A single destination point can be referenced by multiple spawn points. To add a destination to the list of destinations for a particular spawn point, select the spawn point and increment the size of its destinations list by one in the Inspector tab:
An element will be added to the list (Element 0 in the image above). Drag the desired destination object from the hierarchy tree to the new element:
Repeat this step to assign any destination point to any spawn point.
The Python API exposes the list of destinations for each
Spawn object in Python. Each destination is represented as a
transform object that has
spawns = sim.get_spawn() # returns a list of spawn points destinations = spawns.destinations # list of destinations for the first spawn point