Map Annotation
The LGSVL Simulator supports creating, editing, and exporting of HD maps of existing 3D environments (Unity scenes). The maps can be saved in the currently supported Apollo, Autoware or Lanelet2 formats.
Currently, annotating map is only recommended while running the simulator as a Unity project in a Windows environment.
Table of Contents
Creating a New Map top#
- Make sure your roads belong to the layer of
Default
since waypoints will be only created on this layer. - Make sure your roads has added
Mesh Collider
. - Open
HD Map Annotation
inUnity
:Simulator
->Annotate HD Map
- By default, map annotation is not shown. Click
View All
underView Modes
to show existing map annotation. - Before annotating, drag in the correct
Parent Object
, for exampleTrafficLanes
. Then every new object you create will be underTrafficLanes
object. - The expected object hierarchy is as follows:
Map
- This prefab which will be the object containing all the HD Annotations. TheMapHolder
script should be added to this prefabTrafficLanes
- This object will hold all of theMapLaneSection
andMapLane
which cannot be grouped underMapLaneSection
MapLaneSection
- This will hold all of the lanes in a section of roadMapLane
- A single annotated lane
Intersections
- This object will hold all of theMapIntersection
MapIntersection
- This object will hold all of the annotations for an intersectionMapLane
- A single annotated laneMapLine
- A single annotated line (e.g. a stop line)MapSignal
- A single annotated traffic signalMapSign
- A single annotated traffic sign (e.g. a stop sign)
BoundaryLines
- This object will hold all of boundary lines
- To make
Map
a prefab, drag it from the sceneHierarchy
into the Project folder
- After annotation is done, remember to save: select the
Map
prefab, in the Inspector clickOverrides
->Apply All
Annotate Lanes top#
Create Parent Object top#
- In the
Map
prefab (if you don't have one, you can create an empty GameObject and make it a prefab), create a new object and name it "TrafficLanes" - In the Inspector of the
Map
, drag the newTrafficLanes
object into theTraffic Lanes holder
- In
TrafficLanes
, create a new object - Add the
MapLaneSection
script to the object and position it close the section of road that will be annotatedMapLaneSection
script is needed for sections that contain more than 1 lane. For sections with only 1 lane, they can be left as a child object of the TrafficLanes object or grouped with the boundary lines under a different parent object without theMapLaneSection
script.
- Each
MapLaneSection
will contain parallel lanes section- 1
MapLane
per lane of road as well as 1MapLine
per boundary line (optional) - If the annotations will be broken up into multiple
MapLane
(e.g. a straight section and a curved section), multipleMapLaneSection
are required - A
MapLane
cannot begin or end in the middle of anotherMapLane
(e.g. a lane splits or merges). This situation would require a 2ndMapLaneSection
to be created where the split/merge begins. - The other lanes on the road will also need to be broken up into multiple
MapLane
to be included in the multipleMapLaneSection
- 1
MapLaneSection
is used to automate the computation of relation of neighboring lanes. Please make sure every lane underMapLaneSection
has at least 3 waypoints.
Example of single lane splitting into a right-turn only lane and a straight lane
Make Lanes top#
- Select the
Lane/Line
option underCreate Mode
- A large yellow
TARGET_WAYPOINT
will appear in the center of the scene. This is where theTEMP_WAYPOINT
objects will be placed - Drag in the appropriate
MapLaneSection
to be theParent Object
- Click
Waypoint
button to create a newTEMP_WAYPOINT
. This is where the lane will begin
- Move the scene so that the
TARGET_WAYPOINT
is in the desired location of the nextTEMP_WAYPOINT
- With 2 waypoints, the
Create Straight
function will connect the waypoints and use the number inWaypoint Count
to determine how many waypoints to add in between - More than 2 waypoints can be used with the
Create Straight
function and they will be connected in the order they were created, and theWaypoint Count
value will not be used - With 3 waypoints, the
Create Curve
function can be used to create a Bezier curve between the 1st and 3rd waypoints and theWaypoint Count
value will be used to deterin how many waypoints to add in between
- With 2 waypoints, the
- Verify
Lane
is the selectedMap Object Type
- Verify
NO_TURN
is the selectedLane Turn Type
- Select the appropriate lane boundry types
- Enter the speed limit of the lane (in m/s)
- Enter the desired number of waypoints in the lane (minimum 2 for a straight lane and 3 for a curved lane)
- Click the appropriate
Connect
button to create the lane
- To adjust the positions of the waypoints, with the
MapLane
selected, in the Inspector checkDisplay Handles
. Individual waypoints can now have their position adjusted
Make Boundary Lines top#
- Drag in the appropriate
MapLaneSection
to be theParent Object
- The same process as for lanes can be used to create boundary lines, but the
Map Object Type
will beBoundaryLine
- It is better to have the direction of a boundary line match the direction of the lane if possible
- If you are annotating map for Lanelet2 format, you also need to annotate boundary lines for every lane and drag them into the corresponding field in the lane object.
Annotate Intersections top#
Create Parent Object top#
- In the
Map
prefab, create a new object and name it "Intersections" - In the Inspector of the
Map
, drag the newIntersections
object into theIntersections holder
- In
Intersections
, create a new object - Add the
MapIntersection
script to the new object and position it in the center of the intersection that will be annotated.- Adjust the
Trigger Bounds
of theMapIntersection
so that the box covers the center of the intersection
- Adjust the
- The
MapIntersection
will contain all lanes, traffic signals, stop lines, and traffic signs in the intersection
Create Intersection Lanes top#
- Select the
Lane/Line
option underCreate Mode
- Drag in the
MapIntersection
as theParent Object
- The same process for creating normal
MapLane
is used here - If the Lane involves changing directions, verify the correct
Lane Turn Type
is selected - If you are annotating for Lanelet2, you also need to annotate boundary lines for each lane, remember to set
VIRTUAL
as theLine Type
for the line objects - If there is a stop line in the intersection, the start of the intersection lanes should be after the stop line
- For NPCs to properly navigate an intersection, the
Yield To Lanes
list must be manually filled in. WithView Selected
toggled in the Map Annotation Tool, the lanes in theYield To Lanes
list will be highlighted in yellow to make it easier to verify that the correct lanes are in the list. Before an NPC enters an intersection lane, it will check that there are no NPCs on the lanes in theYield To Lanes
before continuing.- Enter the number of lanes that the current lanes yields to as the size of
Yield To Lanes
- For each element in the list, drag in a lane that takes priority over the selected lane
- For example, generally when turning left the NPC will yield to the oncoming traffic going straight so the straight lanes should be in the left turn lane's
Yield To Lanes
list
- For example, generally when turning left the NPC will yield to the oncoming traffic going straight so the straight lanes should be in the left turn lane's
- Enter the number of lanes that the current lanes yields to as the size of
Create Traffic Signals top#
- Select the
Signal
option underCreate Mode
- Drag in the
MapIntersection
as theParent Object
- Select the correct
Signal Type
- Traffic Signals are created on top of existing meshes. The annotation directions must match the directions of the mesh.
- Select the mesh that is going to be annotated
- Select the
Forward Vector
andUp Vector
so that it matches the selected mesh
- Click
Create Signal
to annotate the traffic signal
Create Traffic Signs top#
- Select the
Sign
option underCreate Mode
- Drag in the
MapIntersection
as theParent Object
- Select the Sign mesh that is going to be annotated
- Select the
Forward Vector
andUp Vector
so that it matches the selected mesh - Change the
Sign Type
to the desired type - Click
Create Sign
to create the annotation - Find the stop line
MapLine
that is associated with the createdMapSign
- Select the
MapSign
and drag theMapLine
into theStop Line
box - Verify the annotation is created in the correct orientation. The Z-axis (blue) should be facing the same way the sign faces.
- Move the Bounding Box so that is matches the sign
Bound Offsets
adjusts the location of the boxBound Scale
adjusts the size of the box
Create Stop Lines top#
- Select the
Lane/Line
option underCreate Mode
- Drag in the
MapIntersection
as theParent Object
- A similar process to boundary lines and traffic lanes is used for stop lines
- Change the
Map Object Type
toStopLine
Forward Right
vsForward Left
depend on the direction of the lane related to this stopline and the order that the waypoints were created in. The "Forward" direction should match the direction of the lane- Example: In a right-hand drive map (cars are on the right side of the road), if the waypoints are created from the outside of the road inwards, then
Forward Right
should be selected. To verify if the correct direction was selected,Toggle Tool Handle Rotation
so that the tool handles are in the active object's rotation. The Z-axis of the selected Stop Line should be in the same direction as the lanes.
- Example: In a right-hand drive map (cars are on the right side of the road), if the waypoints are created from the outside of the road inwards, then
- A
StopLine
needs to with the lanes that approch it. The last waypoint of approaching lanes should be past the line.
Create Pole top#
Poles are required for Autoware Vector maps. In an intersection with traffic lights, there is 1 MapPole
on each corner, next to a stop line. The MapPole
holds references to all traffic lights that signal the closest stop line.
- Select the
Pole
option underCreate Mode
- Drag in the
MapIntersection
as theParent Object
- A
TARGET_WAYPOINT
will appear in the center of the scene. This is where the pole annotation will be created. - Position the
TARGET_WAYPOINT
on the corner of the intersection near the stop line - Click
Create Pole
to create the annotation - Find the traffic light
MapSignal
that are associated with the closest stop line - Select the
MapPole
- In the Inspector, change the
Signal Lights
size to be the number ofMapSignal
that signal the stop line - Drag 1
MapSignal
into each element ofSignal Lights
Annotate Self-Reversing Lanes top#
These types of lanes are only supported on Apollo 5.0
Annotation Information top#
There are TrafficLanes and Intersections objects. TrafficLanes object is for straight lane without any branch. Intersections object is for branching lanes, which has same predecessor lane.
Annotate Self-Reversing Lanes under Traffic Lanes top#
- Add MapLaneSection game object under TrafficLanes. MapLaneSection has one pair of lanes, which are forward and reverse lanes.
- Annotate lane given name to MapLane_forward and move it under MapLaneSection.
- Use straight line connect menu with way point count and move each point to shape lane.
- Use Display Lane option to show width of lane. In order for parking to work, there should have some space between parking space and lane.
- Duplicate the MapLane_forward and rename it to MapLane_reverse.
- Choose MapLane_reverse and click Reverse Lane.
- Reverse Lane will have way points in reverse order and make tweak to each way point.
- Routing module doesn't work right when forward and reverse lane have same way point coordinates.
- Choose both lanes (MapLane_forward, MapLane_reverse) and change properties like the following:
- Is Self Reverse Lane: True
- Lane Turn Type: NO_TURN
- Left Bound Type: SOLID_WHITE
- Right Bound Type: SOLID_WHITE
- Speed Limit: 4.444444 (This value is indicated in sunnyvale_with_two_offices map)
- Set Self Reverse Lane for each lane
- As for forward lane, you can drag reverse lane game object to Self Reverse Lane of forward lane.
- As for reverse lane, you can do the same way.
Annotate Self-Reversing Lanes under Intersections top#
- Add MapIntersection game object under Intersections. MapIntersection has several pair of lanes.
- Annotate lane given name to MapLane1_forward move it under MapIntersection.
- Use curve connect menu with way point count, 5.
- Duplicate the MapLane1_forward and rename it to MapLane1_reverse.
- Choose MapLane_reverse and click Reverse Lane.
- Reverse Lane will have way points in reverse order and make tweak to each way point.
- Routing module doesn't work right when forward and reverse lane have same way point coordinates.
- Choose both lanes (MapLane1_forward, MapLane1_reverse) and change properties like the following:
- Is Self Reverse Lane: True
- Left Bound Type: DOTTED_WHITE
- Right Bound Type: DOTTED_WHITE
- Speed Limit: 4.444444 (This value is indicated in sunnyvale_with_two_offices map).
- Choose each lane and decide its turn type considering its direction.
- Lane Turn Type: NO_TURN or LEFT_TURN or RIGHT_TURN
- Set Self Reverse Lane for each lane
- As for forward lane, you can drag reverse lane game object to Self Reverse Lane of forward lane.
- As for reverse lane, you can do the same way.
Annotate Other Features top#
Other annotation features may be included in the TrafficLane
or Intersection
objects or they may be sorted into other parent objects.
Create Pedestrian Path top#
This annotation controls where pedestrians will pass with the highest priority. Pedestrians can walk anywhere but will stay on annotated areas if possible.
- Select the
Pedestrian
option underCreate Mode
- Drag in the desired
Parent Object
- A
TARGET_WAYPOINT
will appear in the center fo the scene. This is where theTEMP_WAYPOINT
will be created. - Position the
TARGET_WAYPOINT
on the desired path - Click
Waypoint
to create aTEMP_WAYPOINT
- Repeat to create a trail of
TEMP_WAYPOINT
along the desired path - Click
Connect
to create theMapPedestrian
object
Create Junction top#
Junction annotations can be used by the AD stack if needed.
- Select the
Junction
option underCreate Mode
- Drag in the desired
Parent Object
- A
TARGET_WAYPOINT
will appear in the center fo the scene. This is where theTEMP_WAYPOINT
will be created. - Position the
TARGET_WAYPOINT
to one vertex of the junction - Click
Waypoint
to create aTEMP_WAYPOINT
- Create the desired number of
TEMP_WAYPOINTS
- Click
Connect
to create theMapJunction
Create Crosswalk top#
- Select the
CrossWalk
option underCreate Mode
- Drag in the desired
Parent Object
- A
TARGET_WAYPOINT
will appear in the center fo the scene. This is where theTEMP_WAYPOINT
will be created. - Position the
TARGET_WAYPOINT
to one corner of the crosswalk - Click
Waypoint
to create aTEMP_WAYPOINT
- Create 4
TEMP_WAYPOINT
in the order shown below - Click
Connect
to create theMapCrossWalk
Create Clear Area top#
- Select the
ClearArea
option underCreate Mode
- Drag in the desired
Parent Object
- A
TARGET_WAYPOINT
will appear in the center fo the scene. This is where theTEMP_WAYPOINT
will be created. - Position the
TARGET_WAYPOINT
to one corner of the clear area - Click
Waypoint
to create aTEMP_WAYPOINT
- Create 4
TEMP_WAYPOINT
in the order shown below - Click
Connect
to create theMapClearArea
Create Parking Space top#
- Select the
ParkingSpace
option underCreate Mode
- Drag in the desired
Parent Object
- A
TARGET_WAYPOINT
will appear in the center fo the scene. This is where theTEMP_WAYPOINT
will be created. - Position the
TARGET_WAYPOINT
to the corner of the parking space closest to an approaching vehicle - Click
Waypoint
to create aTEMP_WAYPOINT
- Create 4
TEMP_WAYPOINT
in the order shown below - Click
Connect
to create theMapParkingSpace
NOTE: Apollo 5.0 requires some space between the edge of a lane and the parking space. To verify that there is space, select the MapLane
that goes past the MapParkingSpace
and click Display Lane
. This will show the width of the lane facilitate adjustment of the lane to have a gap between the lane and parking space.
Create Speed Bump top#
- Select the
SpeedBump
option underCreate Mode
- Drag in the desired
Parent Object
- A
TARGET_WAYPOINT
will appear in the center fo the scene. This is where theTEMP_WAYPOINT
will be created. - Position the
TARGET_WAYPOINT
to one end of the speed bump - Click
Waypoint
to create aTEMP_WAYPOINT
- Create 2
TEMP_WAYPOINT
in the order shown below - The
TEMP_WAYPOINT
should be wide enough to be outside the lane - Click
Connect
to create theMapSpeedBump
- To verify that the
MapSpeedBump
is wide enough, select theMapLane
that theMapSpeedBump
crosses. EnableDisplay Lane
to visualize the width of the lane. If necesary, select theMapSpeedBump
and enableDisplay Handles
to adjust the positions of the individual waypoints.
Export Map Annotations top#
HD Map Annotations may be exported in a variety of formats. Current supported formats are:
- Apollo 5.0 HD Map
- Apollo 3.0 HD Map
- Autoware Vector Map
- Lanelet2 Map
- OpenDrive Map
To export a map:
- Open the
HD Map Export
tool inUnity
:Simulator
->Export HD Map
- Select the desired format from the dropdown
Export Format
- Enter the desired save location of the exported map
- Click
Export
to create the exported map
Import Map Annotations top#
The simulator can import a variety of formats of annotated map. Current supported formats are:
- Lanelet2 Map
- Apollo 5.0 HD Map
- OpenDRIVE Map
To import a map:
- Open the
HD Map Export
tool inUnity
:Simulator
->Import HD Map
- Select the format of the input map from the dropdown
Import Format
- Select the file or folder that will be imported
- Click
Import
to import the map annotations into the simulator
Lanelet2 map importer Notes:
- Lanes will be automatically imported and grouped as
MapLaneSection
if possible - Intersections with four-way traffic lights / stop signs or two-way stop signs can be imported and grouped under
MapIntersection
- Left-turn lanes are automatically found and their corresponding lanes to yield are also obtained automatically to get NPCs working correctly
- For each
MapIntersection
, you need to manually adjustX
andZ
for theTrigger Bounds
as explained in annotate intersection part. - Remember to check objects under
Intersections
are grouped correctly.
Map Formats top#
For more information on the map formats, please see the links below: