DriveWorks SDK Reference
3.0.4260 Release
For Test and Development only

LanePlanner.h
Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed
3 // under the Mutual Non-Disclosure Agreement.
4 //
5 // Notice
6 // ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES
7 // NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
8 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT,
9 // MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
10 //
11 // NVIDIA Corporation assumes no responsibility for the consequences of use of such
12 // information or for any infringement of patents or other rights of third parties that may
13 // result from its use. No license is granted by implication or otherwise under any patent
14 // or patent rights of NVIDIA Corporation. No third party distribution is allowed unless
15 // expressly authorized by NVIDIA. Details are subject to change without notice.
16 // This code supersedes and replaces all information previously supplied.
17 // NVIDIA Corporation products are not authorized for use as critical
18 // components in life support devices or systems without express written approval of
19 // NVIDIA Corporation.
20 //
21 // Copyright (c) 2017-2020 NVIDIA Corporation. All rights reserved.
22 //
23 // NVIDIA Corporation and its licensors retain all intellectual property and proprietary
24 // rights in and to this software and related documentation and any modifications thereto.
25 // Any use, reproduction, disclosure or distribution of this software and related
26 // documentation without an express license agreement from NVIDIA Corporation is
27 // strictly prohibited.
28 //
30 
31 #ifndef DW_PLANNING_LANEPLANNER_H_
32 #define DW_PLANNING_LANEPLANNER_H_
33 
61 #include <dw/maps/Maps.h>
62 
63 #ifdef __cplusplus
64 extern "C" {
65 #endif
66 
67 //#######################################################################################
68 // Handles
69 //#######################################################################################
70 typedef struct dwLanePlannerObject* dwLanePlannerHandle_t;
71 typedef struct dwLanePlannerObject const* dwConstLanePlannerHandle_t;
72 
73 typedef struct dwLanePlanObject* dwLanePlanHandle_t;
74 typedef struct dwLanePlanObject const* dwConstLanePlanHandle_t;
75 
76 //#######################################################################################
77 // Lane Planner
78 //#######################################################################################
79 
84 typedef struct dwLanePlanLane
85 {
86  const dwMapsLane** lanes;
87  const bool* laneForward;
89  const dwTime_t* times;
91  uint32_t laneCount;
96 
107 typedef struct dwLanePlanSegment
108 {
110  uint32_t laneCount;
116  dwMapsSide laneChangeSide;
119 
124 typedef struct dwLanePlan
125 {
127  uint32_t segmentCount;
128 } dwLanePlan;
129 
144 dwStatus dwLanePlanner_initialize(dwLanePlannerHandle_t* lanePlanner,
145  float32_t maxPlanLengthMeters,
146  dwConstMapHandle_t map);
147 
157 dwStatus dwLanePlanner_release(dwLanePlannerHandle_t lanePlanner);
158 
174 dwStatus dwLanePlan_initialize(dwLanePlanHandle_t* lanePlan, dwConstLanePlannerHandle_t lanePlanner);
175 
185 dwStatus dwLanePlan_release(dwLanePlanHandle_t lanePlan);
186 
217  bool forward,
218  float32_t length,
219  uint32_t laneChangeCount,
220  dwMapsSide laneChangeSide,
221  const dwMapsGeoPoint* gpsPathPoint,
222  uint32_t gpsPathPointCount,
223  bool ignoreHeight,
224  const dwMapsLane* neighborLane,
225  void* context);
226 
259 dwStatus dwLanePlanner_run(const dwMapsLane* startLane,
260  const dwMapsLane* const* targetLanes,
261  uint32_t targetLaneCount,
262  const dwMapsGeoPoint* gpsPathPoints,
263  uint32_t gpsPathPointCount,
264  bool ignoreHeight,
266  void* costFnContext,
267  dwLanePlanHandle_t lanePlan,
268  dwLanePlannerHandle_t lanePlanner);
269 
282  dwConstLanePlanHandle_t lanePlanHandle);
283 
284 //#######################################################################################
285 // Lane Plan Utilities
286 //#######################################################################################
287 
303 typedef struct dwLanePlanIndex
304 {
305  uint32_t segmentIndex;
306  uint32_t lanePlanLaneIndex;
307  uint32_t mapsLaneIndex;
308  uint32_t pointIndex;
310 
327  dwVector3f* pointLocal,
328  const dwMapsLane** lane,
329  dwTime_t* time,
330  const dwLanePlanIndex* index,
331  dwConstLanePlanHandle_t lanePlan);
332 
355  dwLanePlanIndex* lanePlanIndex,
356  const dwMapsGeoPoint* gps,
357  bool ignoreHeight,
358  dwLanePlanHandle_t lanePlan);
359 
377  uint32_t increaseCount,
378  dwConstLanePlanHandle_t lanePlan);
379 
396  uint32_t decreaseCount,
397  dwConstLanePlanHandle_t lanePlan);
398 
402 typedef struct dwLanePlanLaneChange
403 {
405  uint32_t laneChangeCount;
412 
416 typedef struct dwLanePlanActions
417 {
425  float32_t laneSplitDist;
432 
443 
464  dwLanePlanLaneChange* laneChange,
465  const dwLanePlanIndex* queryPointIndex,
466  dwConstLanePlanHandle_t lanePlan);
467 
488  dwLanePlanLaneChange* laneChange,
489  float32_t* distance,
490  dwLanePlanHandle_t lanePlan);
491 
513  dwMapsLaneSplitDetails* laneSplit,
514  const dwLanePlanIndex* queryPointIndex,
515  dwLanePlanHandle_t lanePlan);
516 
537  dwMapsLaneSplitDetails* laneSplit,
538  float32_t* distance,
539  dwLanePlanHandle_t lanePlan);
540 
562  dwMapsLaneMergeDetails* laneMerge,
563  const dwLanePlanIndex* queryPointIndex,
564  dwLanePlanHandle_t lanePlan);
565 
586  dwMapsLaneMergeDetails* laneMerge,
587  float32_t* distance,
588  dwLanePlanHandle_t lanePlan);
589 
612  dwLanePlanIndex* laneSplitPointIndex,
613  dwLanePlanActions* lanePlanActionInfo,
614  dwLanePlanHandle_t lanePlan)
615  DW_DEPRECATED("WARNING: the function will be removed in the next major release, use dwLanePlan_getLanePlanActionsNew.");
616 
641  dwLanePlanIndex* laneSplitPointIndex,
642  dwLanePlanIndex* laneMergePointIndex,
643  dwLanePlanActions* lanePlanActionInfo,
644  dwLanePlanHandle_t lanePlan);
645 
666  dwMapsLaneMergeDetails* laneMerge,
667  dwLanePlanHandle_t lanePlan);
668 
671  const dwLanePlanIndex* index1, const dwLanePlanIndex* index2,
672  dwConstLanePlanHandle_t lanePlan);
673 
692 dwStatus dwLanePlan_getComplexity(uint32_t* totalLaneChangeCount,
693  uint32_t* totalLaneSplitCount,
694  uint32_t* totalLaneMergeCount,
695  dwLanePlanHandle_t lanePlan);
696 
697 //#######################################################################################
698 // Lane Plan Tracker
699 //#######################################################################################
700 
726  const dwMatrix3d* localToENURotation33,
727  dwTime_t timestamp,
728  bool ignoreHeight,
729  dwLanePlanHandle_t lanePlan);
730 
756  const dwVector3f* position,
757  const dwMatrix3d* localToENURotation33,
758  dwTime_t timestamp,
759  dwLanePlanHandle_t lanePlan);
760 
789  const dwVector3f* position,
790  const dwMatrix3d* localToENURotation33,
791  dwTime_t timestamp,
792  dwLanePlanHandle_t lanePlan);
793 
809  dwConstLanePlanHandle_t lanePlan);
810 
826  dwConstLanePlanHandle_t lanePlan);
827 
844 dwStatus dwLanePlan_getCurrentPoint(const dwMapsRoadSegment** referenceRoadSegment,
845  dwVector3f* pointOnLanePlan,
846  dwConstLanePlanHandle_t lanePlan);
847 
859 dwStatus dwLanePlan_containsLane(bool* isOnLanePlan, const dwMapsLane* lane, dwConstLanePlanHandle_t lanePlan);
860 
876  float32_t* timeToDestination,
877  dwConstLanePlanHandle_t lanePlanHandle);
878 
896  uint32_t* laneChangeIndex,
897  float32_t distance,
898  dwLanePlanHandle_t lanePlan);
899 
900 #ifdef __cplusplus
901 }
902 #endif
903 
906 #endif // DW_PLANNING_LANEPLANNER_LANEPLANNER_H_
float32_t laneChangeLength
available distance to do the lane change.
Definition: LanePlanner.h:406
uint32_t lanePlanLaneIndex
index of a dwLanePlanLane in the dwLanePlanSegment
Definition: LanePlanner.h:306
dwMapsLaneMerge laneMerge
Definition: LanePlanner.h:423
bool hasLaneMerge
true only if a valid lane merge ahead is detected
Definition: LanePlanner.h:420
DW_API_PUBLIC dwStatus dwLanePlan_getTargetLanes(dwMapsLanePtrBuffer *lanes, uint32_t *laneChangeIndex, float32_t distance, dwLanePlanHandle_t lanePlan)
Get target lane ptrs e.g.
DW_API_PUBLIC dwStatus dwLanePlan_findClosestPoint(dwMapsGeoPoint *closestPoint, dwLanePlanIndex *lanePlanIndex, const dwMapsGeoPoint *gps, bool ignoreHeight, dwLanePlanHandle_t lanePlan)
Helper function to find the closest line segment on the lane plan to a given gps location, together with the corresponding closest lane plan point (the closer of the two lane plan points on the line segment that contains the closest geometric point).
const dwMapsLane ** lanes
Pointers to the sequential dwMapsLane&#39;s.
Definition: LanePlanner.h:86
DW_API_PUBLIC dwStatus dwLanePlan_getCurrentGeoPoint(dwMapsGeoPoint *pointOnLanePlan, dwConstLanePlanHandle_t lanePlan)
Get current point on the lane plan in gps coordinates.
float float32_t
Specifies POD types.
Definition: Types.h:70
float32_t(* dwLanePlannerCostFunction_t)(const dwMapsLane *lane, bool forward, float32_t length, uint32_t laneChangeCount, dwMapsSide laneChangeSide, const dwMapsGeoPoint *gpsPathPoint, uint32_t gpsPathPointCount, bool ignoreHeight, const dwMapsLane *neighborLane, void *context)
Cost function that allows to implement a custom cost calculation in the dijkstra algorithm that calcu...
Definition: LanePlanner.h:216
DW_API_PUBLIC dwStatus dwLanePlan_getNextLaneSplit(dwLanePlanIndex *laneSplitPointIndex, dwMapsLaneSplitDetails *laneSplit, float32_t *distance, dwLanePlanHandle_t lanePlan)
Get next lane split.
Lane defined by a polyline, with lane attributes.
Definition: Maps.h:513
DW_API_PUBLIC dwStatus dwLanePlan_updateCurrentPointWithGlobalPose(const dwMapsGeoPoint *gps, const dwMatrix3d *localToENURotation33, dwTime_t timestamp, bool ignoreHeight, dwLanePlanHandle_t lanePlan)
Update the current point on the lane plan based on a pose defined in absolute coordinates.
DW_API_PUBLIC dwStatus dwLanePlan_getLanePlanActions(dwLanePlanIndex *laneChangePointIndex, dwLanePlanIndex *laneSplitPointIndex, dwLanePlanActions *lanePlanActionInfo, dwLanePlanHandle_t lanePlan)
Get information about the next lane change and lane split.
DW_API_PUBLIC dwStatus dwLanePlanner_release(dwLanePlannerHandle_t lanePlanner)
Release a lane planner object.
A lane plan segment is a segment along the lane plan with a consistent lane change situation...
Definition: LanePlanner.h:107
Defines a three-element floating-point vector.
Definition: Types.h:319
DW_API_PUBLIC dwStatus dwLanePlan_getCurrentIndex(dwLanePlanIndex *lanePlanIndex, dwConstLanePlanHandle_t lanePlan)
Get the index to the current point on the lane plan.
DW_API_PUBLIC dwStatus dwLanePlan_getLanePlanSplitMergeDetails(dwMapsLaneSplitDetails *laneSplit, dwMapsLaneMergeDetails *laneMerge, dwLanePlanHandle_t lanePlan)
Get information about the next lane change, lane split, and lane merge.
A lane plan consist of a list of segments that describe how to get from a source lane to a target lan...
Definition: LanePlanner.h:124
DW_API_PUBLIC dwStatus dwLanePlan_getNextLaneMergeAt(dwLanePlanIndex *laneMergePointIndex, dwMapsLaneMergeDetails *laneMerge, const dwLanePlanIndex *queryPointIndex, dwLanePlanHandle_t lanePlan)
Get the next lane merge happening on the lane plan at or after given lane plan index.
DW_API_PUBLIC dwStatus dwLanePlan_computeDistance(float32_t *distance, const dwLanePlanIndex *index1, const dwLanePlanIndex *index2, dwConstLanePlanHandle_t lanePlan)
DW_API_PUBLIC dwStatus dwLanePlan_initialize(dwLanePlanHandle_t *lanePlan, dwConstLanePlannerHandle_t lanePlanner)
Creates a lane plan object and returns a handle to it.
dwLanePlanLaneChange laneChange
Definition: LanePlanner.h:421
DW_API_PUBLIC dwStatus dwLanePlanner_initialize(dwLanePlannerHandle_t *lanePlanner, float32_t maxPlanLengthMeters, dwConstMapHandle_t map)
Creates a lane planner object and returns a handle to it.
struct dwLanePlanObject * dwLanePlanHandle_t
Definition: LanePlanner.h:73
DW_API_PUBLIC dwStatus dwLanePlan_containsLane(bool *isOnLanePlan, const dwMapsLane *lane, dwConstLanePlanHandle_t lanePlan)
Check whether a given dwMapsLane is part of the lane plan.
DW_API_PUBLIC dwStatus dwLanePlan_updateCurrentPointWithLocalPose(const dwMapsRoadSegment *referenceRoadSegment, const dwVector3f *position, const dwMatrix3d *localToENURotation33, dwTime_t timestamp, dwLanePlanHandle_t lanePlan)
Update the current point on the lane plan based on a pose defined in relative coordinates.
Lane merge on a lane plan.
Definition: Maps.h:1618
NVIDIA DriveWorks API: Maps
DW_API_PUBLIC dwStatus dwLanePlan_release(dwLanePlanHandle_t lanePlan)
Release a lane plan object.
const dwLanePlanLane * lanes
List of parallel lanes.
Definition: LanePlanner.h:109
Location point defined by WGS84 coordinates.
DW_API_PUBLIC dwStatus dwLanePlanner_run(const dwMapsLane *startLane, const dwMapsLane *const *targetLanes, uint32_t targetLaneCount, const dwMapsGeoPoint *gpsPathPoints, uint32_t gpsPathPointCount, bool ignoreHeight, dwLanePlannerCostFunction_t costFn, void *costFnContext, dwLanePlanHandle_t lanePlan, dwLanePlannerHandle_t lanePlanner)
Create a lane plan along the provided gps path points, based on the map that is given at initializati...
DW_API_PUBLIC dwStatus dwLanePlan_getNextLaneChange(dwLanePlanIndex *laneChangePointIndex, dwLanePlanLaneChange *laneChange, float32_t *distance, dwLanePlanHandle_t lanePlan)
Get next lane change.
struct dwLanePlannerObject const * dwConstLanePlannerHandle_t
Definition: LanePlanner.h:71
DW_API_PUBLIC dwStatus dwLanePlan_getPoint(dwMapsGeoPoint *pointWGS84, dwVector3f *pointLocal, const dwMapsLane **lane, dwTime_t *time, const dwLanePlanIndex *index, dwConstLanePlanHandle_t lanePlan)
Get point data from lane plan at given index.
dwStatus
Status definition.
Definition: Status.h:166
const dwTime_t * times
Estimated time of arrival in [us] per dwMapsLane.
Definition: LanePlanner.h:90
DW_API_PUBLIC dwStatus dwLanePlan_getLanePlanActionsNew(dwLanePlanIndex *laneChangePointIndex, dwLanePlanIndex *laneSplitPointIndex, dwLanePlanIndex *laneMergePointIndex, dwLanePlanActions *lanePlanActionInfo, dwLanePlanHandle_t lanePlan)
Get information about the next lane change, lane split, and lane merge.
uint32_t mapsLaneIndex
index of a dwMapsLane in the dwLanePlanLane
Definition: LanePlanner.h:307
dwMapsSide
Enum for sides.
Definition: Maps.h:258
Lane merge on a lane plan.
Definition: Maps.h:1599
dwMapsLaneSplit laneSplit
Definition: LanePlanner.h:422
DW_API_PUBLIC dwStatus dwLanePlan_updateCurrentPointWithCurrentRoadSegment(const dwMapsRoadSegment *currentRoadSegment, const dwVector3f *position, const dwMatrix3d *localToENURotation33, dwTime_t timestamp, dwLanePlanHandle_t lanePlan)
Update the current point on the lane plan based on a pose defined in relative coordinates.
int64_t dwTime_t
Specifies a timestamp unit, in microseconds.
Definition: Types.h:82
uint32_t laneCount
Number of dwMapsLanes.
Definition: LanePlanner.h:94
const bool * laneForward
Whether to move forward on lane geometry, per dwMapsLane.
Definition: LanePlanner.h:87
DW_API_PUBLIC dwStatus dwLanePlan_getNextLaneChangeAt(dwLanePlanIndex *laneChangePointIndex, dwLanePlanLaneChange *laneChange, const dwLanePlanIndex *queryPointIndex, dwConstLanePlanHandle_t lanePlan)
Get the next lane change happening on the lane plan at or after given lane plan index.
struct dwLanePlanObject const * dwConstLanePlanHandle_t
Definition: LanePlanner.h:74
#define DW_DEPRECATED(msg)
Definition: Exports.h:68
Structure that packages lane change, lane split, and lane merge info together.
Definition: LanePlanner.h:416
uint32_t pointIndex
index of a point in the dwMapsLane geometry
Definition: LanePlanner.h:308
struct dwLanePlannerObject * dwLanePlannerHandle_t
Definition: LanePlanner.h:70
dwMapsSide laneChangeSide
side towards the lane change is going
Definition: LanePlanner.h:404
bool hasLaneChange
true only if a valid lane change ahead is detected
Definition: LanePlanner.h:418
Defines a 3x3 matrix of double floating point numbers.
Definition: Types.h:250
DW_API_PUBLIC dwStatus dwLanePlan_getCurrentPoint(const dwMapsRoadSegment **referenceRoadSegment, dwVector3f *pointOnLanePlan, dwConstLanePlanHandle_t lanePlan)
Get current point on the lane plan in coordinates relative to a reference road segment.
float32_t distToDestination
distance to reach destination on the lane plan
Definition: LanePlanner.h:430
uint32_t laneChangeCount
number of lanes that need to be changed
Definition: LanePlanner.h:405
const float32_t * distances
Distance in [m] to beginning of each dwMapsLane.
Definition: LanePlanner.h:88
uint32_t segmentCount
Number segments in lane plan.
Definition: LanePlanner.h:127
DW_API_PUBLIC dwStatus dwLanePlan_increaseIndex(dwLanePlanIndex *lanePlanIndex, uint32_t increaseCount, dwConstLanePlanHandle_t lanePlan)
Helper function to compute the next lane plan point along a lane plan.
struct dwMapObject const * dwConstMapHandle_t
Definition: Maps.h:70
uint32_t segmentIndex
index of a dwLanePlanSegment in the dwLanePlan
Definition: LanePlanner.h:305
DW_API_PUBLIC dwStatus dwLanePlan_getEstimatedArrivalInfo(float32_t *distToDestination, float32_t *timeToDestination, dwConstLanePlanHandle_t lanePlanHandle)
Get estimated time and distance to reach the end of the lane plan from current position.
DW_API_PUBLIC dwStatus dwLanePlan_decreaseIndex(dwLanePlanIndex *lanePlanIndex, uint32_t decreaseCount, dwConstLanePlanHandle_t lanePlan)
Helper function to compute the previous lane plan point on a lane plan.
DW_API_PUBLIC dwStatus dwLanePlan_initializeLanePlanActions(dwLanePlanActions *lpActions)
Default initialize a dwLanePlanActions object.
bool hasLaneSplit
true only if a valid lane split ahead is detected
Definition: LanePlanner.h:419
DW_API_PUBLIC dwStatus dwLanePlan_getNextLaneMerge(dwLanePlanIndex *laneMergePointIndex, dwMapsLaneMergeDetails *laneMerge, float32_t *distance, dwLanePlanHandle_t lanePlan)
Get next lane merge.
DW_API_PUBLIC dwStatus dwLanePlan_get(dwLanePlan *lanePlan, dwConstLanePlanHandle_t lanePlanHandle)
Retrieve the result of a previous &#39;dwLanePlanner_run&#39; call.
Lane change state on the lane plan.
Definition: LanePlanner.h:402
const dwLanePlanSegment * segments
List of segments along the lane plan.
Definition: LanePlanner.h:126
Index defining a point in the lane plan.
Definition: LanePlanner.h:303
Lane split on a lane plan.
Definition: Maps.h:1578
DW_API_PUBLIC dwStatus dwLanePlan_getComplexity(uint32_t *totalLaneChangeCount, uint32_t *totalLaneSplitCount, uint32_t *totalLaneMergeCount, dwLanePlanHandle_t lanePlan)
Returns some numbers that indicate how complex it is to autonomously drive a given lane plan...
float32_t timeToDestination
estimated time to reach destination on the lane plan
Definition: LanePlanner.h:429
Lane split on a lane plan.
Definition: Maps.h:1554
#define DW_API_PUBLIC
Definition: Exports.h:56
float32_t laneChangeDist
distance to where the next lane change action takes place (start of the next lane change...
Definition: LanePlanner.h:424
A lane plan lane is a sequence of dwMapsLane&#39;s, with additional information per dwMapsLane about movi...
Definition: LanePlanner.h:84
Road Segment represents an atomic element of the core layer of a Map.
Definition: Maps.h:600
User provided buffer of dwMapsLane pointers.
Definition: Maps.h:690
float32_t laneMergeDist
distance to the next lane merge point
Definition: LanePlanner.h:428
DW_API_PUBLIC dwStatus dwLanePlan_getNextLaneSplitAt(dwLanePlanIndex *laneSplitPointIndex, dwMapsLaneSplitDetails *laneSplit, const dwLanePlanIndex *queryPointIndex, dwLanePlanHandle_t lanePlan)
Get the next lane split happening on the lane plan at or after given lane plan index.