DriveWorks SDK Reference
3.0.4260 Release
For Test and Development only

maps/docs/mainsection.md
Go to the documentation of this file.
1 # Copyright (c) 2019-2020 NVIDIA CORPORATION. All rights reserved.
2 
3 @page maps_mainsection Maps
4 
5 @note SW Release Applicability: This module is available in **NVIDIA DRIVE Software** releases.
6 
7 ## About This Module
8 
9 The maps module provides an API to access NVIDIA<sup>&reg;</sup> DriveWorks HD maps data.
10 
11 DriveWorks currently provides a conversion tool of HERE HD maps format into a DriveWorks map cache
12 file (XML). For more details about the tool, please refer to @ref dwx_maptool_here_to_dw_maps.
13 
14 ## Map Content Scope
15 
16 In DriveWorks the Map represents both geometric landmarks and semantic "payload" information that
17 is used to enable safe operation and planning for an autonomous vehicle (AV).
18 
19 In-memory representation of a "complete map" of drivable roads is a non-goal of DriveWorks Maps.
20 It is assumed that the Map contains a relevant local scope for the vehicle, representing a fraction
21 of the full world data available from a regional, continental or global scale backend database.
22 
23 In general, multiple Map requests may be required over the duration of a long-distance drive.
24 
25 ## Core Layer Data
26 
27 The Core Layer of the Map contains the basic data required for camera-only localization and short
28 to medium-range planning. This data is fully loaded in RAM as an object graph covering the full
29 extent of the requested Map.
30 
31 - Road Segments: `dwMapsRoadSegment`
32 - Lane Groups: `dwMapsLaneGroup`
33 - Lanes: `dwMapsLane`
34 - Lane Divider Groups: `dwMapsLaneDividerGroup`
35 - Lane Dividers: `dwMapsLaneDivider`
36 - Features: `dwMapsFeature`
37 
38 The basic elements are the Road Segments, all data can be accessed through them. A Road Segment
39 represents a piece of road containing several Lanes, Lane Groups, Lane Dividers, and Features.
40 Every Road Segment has an associated local ENU coordinate system defined by its WGS84 Origin.
41 Element geometries for the Road Segment are polylines of 3D points in local ENU coordinates.
42 
43 Each Lane Group represents a "bundle" of adjacent Lanes with associated Lane Group Traversability.
44 This bitmask is used by the Lane Planner module to determine connectivity between adjacent lanes.
45 Lane Group Traversability may be determined automatically by Lane Divider Type or directly modified
46 by a server-side manual annotation or editing process.
47 
48 For Lanes, a local polyline represents the centerline geometry of the Lane. Each Lane has pointers
49 to adjacent Lane Divider Groups, representing physical boundaries both left and right of the Lane.
50 Lane Divider Groups are contained by a parent Road Segment along with all referencing Lanes making
51 the ownership model for a Road Segment fully "self-contained".
52 
53 Lane Dividers belonging to a Lane Divider Group are modeled by local polylines with an associated
54 Lane Divider Type. Although usually there is often a single Lane Divider at a lane boundary, there
55 are cases where Lanes are separated with multiple Lane Dividers, for example a painted solid line
56 and a physical Jersey barrier.
57 
58 Features are a generic representation of objects encountered along the road, e.g. traffic signs,
59 traffic lights, etc. Each Feature is described by its type field and local geometry, expressed
60 like other elements in local ENU coordinates of its parent Road Segment.
61 
62 ## Connections
63 
64 Road Segments and Lanes have connections to predecessors and successors along the road, represented
65 by `dwMapsRoadSegmentConnection` and `dwMapsLaneConnection` structs. Lane Connections for a Lane
66 may be `next` or `previous`. This is a reflection not of driving direction, but geometry ordering.
67 
68 A connection is represented by the ID of the connected element, and if available, a pointer to it.
69 If the connected element is currently not in memory, the pointer is a NULL. It is possible that
70 connected elements have opposite geometry directions, meaning for a `next` connection, the end of
71 a polyline connects to the end of the connected polyline (and similarly on the start side for
72 `previous` connections). The `sameDirection` boolean flag in the Lane Connection struct indicates
73 the geometry directions of connected Lanes are either matching or opposing each other.
74 
75 Lane Groups, Lanes, Lane Dividers, Lane Divider Groups, and Features each have pointers to parents:
76 
77 - `dwMapsLaneGroup` -> `dwMapsRoadSegment`
78 - `dwMapsLane` -> `dwMapsLaneGroup`
79 - `dwMapsLaneDivider` -> `dwMapsLaneDividerGroup`
80 - `dwMapsLaneDividerGroup` -> `dwMapsRoadSegment`
81 - `dwMapsFeature` -> `dwMapsRoadSegment`
82 
83 ## Intersections
84 
85 As of this release there is no publicly available encoding for data specific to road junctions in
86 DriveWorks Maps. That is a feature that we are currently developing and plan to expose publicly
87 in a future DriveWorks release.
88 
89 ## Attributes
90 
91 Road Segments, Lanes, Lane Dividers and Features have attributes specifying type and properties.
92 
93 | Main Data Structure | Type and Properties |
94 |-------------|------------|
95 | Road Segment | Type (bridge, tunnel, etc.) |
96 | Lane | Type (shoulder, car pool, etc.) <br>Driving direction, relative to the geometry polyline |
97 | Lane Divider | Type (dashed, solid, etc.) <br>Material<br>Color |
98 | Feature | Type (traffic sign, traffic light, etc.) |
99 
100 Lane Groups are defined such that Lane attributes are constant over the full length of all Lanes.
101 Wherever Lane or Lane Divider attributes change, that may affect the Lane Group Traversability
102 therefore a new Lane Group is required.
103 
104 ## Map Provider
105 
106 The Map Provider interface defines methods for requesting a Map according to application needs.
107 Map requests are the way clients communicate their needs for Map content to the Map Provider.
108 
109 Each implementation of Map Provider is specialized to a particular backend Map data source.
110 Initially we provide only a basic implementation of Map Provider assuming content exists in the
111 local filesystem as a cache file (XML) or "map directory" also containing Core and Content Layers.
112 
113 ## General Usage
114 
115 Here is an example of using the Map Provider to request a Map and query the Core Layer content:
116 
117 ```{.cpp}
118  // init map provider with XML cache file
119  dwMapProviderHandle_t providerHandle = DW_NULL_HANDLE;
120  dwMapProvider_initializeWithCacheFile(...);
121 
122  // select bounds of interest
123  dwMapsBounds mapBounds{...};
124 
125  // request a map with core layer only (no content layers)
126  // request processing occurs asynchronously on a worker thread
127  dwMapsRequestToken token{};
128  dwMapProvider_requestMapForBounds(&requestToken, &mapBounds, NULL, providerHandle);
129 
130  // handle to the requested map
131  dwConstMapHandle mapHandle = DW_NULL_HANDLE;
132 
133  // poll for request completion
134  dwStatus requestStatus = DW_NOT_READY;
135  while (requestStatus != DW_SUCCESS)
136  {
137  // application code needs to handle error cases
138  requestStatus = dwMapProvider_tryGetRequestedMap(&mapHandle, requestToken, providerHandle);
139  }
140 
141  // memory for road segment query result
142  dwMapsRoadSegmentBuffer roadSegments{...};
143 
144  while (...)
145  {
146  // select bounds of interest
147  dwMapsBounds queryBounds{...};
148 
149  // query data
150  roadSegments.size = 0;
151  dwMaps_getRoadSegments(&roadSegments, &queryBounds, ...);
152 
153  // access data
154  for (uint32_t i = 0; i < roadSegments.size; ++i)
155  {
156  const dwMapsRoadSegment& roadSegment = roadSegments.buffer[i];
157  ...
158  }
159  }
160 
161  // release map back to map provider
162  dwMapProvider_releaseMap(mapHandle, providerHandle);
163 
164  // release map provider
165  dwMapProvider_release(...);
166 ```
167 
168 ## Relevant Tutorials
169 
170 - @ref maps_usecase1
171 - @ref maps_usecase2
172 - @ref maps_usecase3
173 - @ref maps_usecase4
174 - @ref maps_usecase5
175 - @ref maps_usecase6
176 - @ref maps_usecase7
177 - @ref maps_usecase8
178 
179 ## APIs
180 
181 - @ref maps_group