DriveWorks SDK Reference
3.5.78 Release
For Test and Development only

HD Maps Lane Planner Sample
SW Release Applicability: This sample is available in NVIDIA DRIVE Software releases.


The HD Maps Lane Planner sample demonstrates how to use the NVIDIA® DriveWorks lane planner to compute a lane plan through an HD map from a start point to a target point.

The sample supports the following features:

  • Lane Planning

    The lane planner returns a drivable lane plan from start to target along the lanes of the HD map, with information where lane changes are necessary.

  • Determines where lanes merge and split

    At each point on the lane plan, the lane planner can indicate (when queried) where the next lane merge or lane split occurs when following the lane.

  • Provides information about vehicle pose

    The lane planner provides tracking of a vehicle pose along the lane plan. It uses the following information to find the current point on the lane plan:

    • Position
    • Orientation
    • Update time difference

    Even if the lanes on the plan cross one another, the "current point" consistently moves along the plan and avoids selecting points of the lane plan that are incorrect but close to the current car pose.

Running the Sample

The command line for the Lane Planner sample, sample_laneplanner, is:


To run the sample with a custom map, it can be started with additional arguments:

./sample_laneplanner --map=/path/to/mapfile

And optionally custom initial start and target locations can be specified:

./sample_laneplanner --map=/path/to/mapfile --startLat: default=37.4971 --startLon: default=-122.3132 --targetLat: default=37.5276 --targetLon: default=-122.3314

By default the target is interpreted as the closest lane group. To define the target as the closest lane use the flag:

./sample_laneplanner --useLaneTarget=true

While the application is running the following actions are possible:

  • 'F1' displays controls on screen.
  • 'Esc' closes the application.
  • 'Spacebar' pauses the application.
  • 'Mouse Wheel' allows to control camera zoom.
  • 'Up' and 'Down' arrow keys move the vehicle forward or backward.
  • 'E' toggles the error on car pose.
  • 'right' mouse button allow to move the camera when the sample is paused.
  • 'left' mouse button allow to move the start and target points. The lane plan is recalculated whenever the input points are changed.
  • 'F11' saves start and target points (waypoints) to a file named 'searchpoints.txt'. This file is located in the same folder the as the app. It contains a list of the GPS coordinates of every input point in order.
  • 'F12' loads start and target points from 'searchpoints.txt', which is located in the same folder as the app. The file contents are loaded in order, using the format 'lon,lat,height', where each line has one set of coordinates.
  • 'd' removes all input points excluding the start and end.

Both start and target points can be moved by dragging them with the left mouse button. Intermediate waypoints can be added with left click, removed with 'ctrl + left click' and can also be repositioned by dragging. More waypoints results in a more accurate lane plan and the lane plan is recalculated whenever any of the input points are changed. Waypoints can also be generated from external sources such as Google Maps.


The HD map is rendered with lines of different colors:

  • Blue lines: lane dividers that cannot be crossed.
  • Dark green lines: lane dividers that can be crossed.
  • Grey lines: invisible lane dividers.
  • Light orange lines: visual representation of how waypoints are ordered/connected.

The input points are:

  • Green box: start point.
  • Red box: target point.
  • White box: waypoint.

The resulting lane plan is visualized by:

  • White lines: lane plan points to follow.
  • Green lines: target lines for lane change to the right.
  • Red lines: target lines for lane change to the left.

Additional info:

  • Long yellow box: current pose of the car.
  • Little red box: current point on the lane plan. It contains the information about the next upcoming actions (lane change, lane split, lane merge).
Lane Planner Sample

Additional Information

For more information, see Maps.