Main Content

egoToWorldLaneBoundarySegments

Convert tracked lane boundaries to lane boundary segments in world coordinates

Since R2024a

Description

lbsegments = egoToWorldLaneBoundarySegments(trackedLaneBoundaries,egoTrajectory) converts the input tracked lane boundaries trackedLaneBoundaries in ego vehicle coordinates into an array of laneBoundarySegment objects lbsegments in world coordinates by using the ego trajectory information egoTrajectory.

example

lbsegments = egoToWorldLaneBoundarySegments(trackedLaneBoundaries,egoPose) converts the tracked lane boundaries to an array of laneBoundarySegment objects lbsegments in world coordinates by using the ego pose information egoPose.

lbsegments = egoToWorldLaneBoundarySegments(___,Name=Value) specifies options using one or more name-value arguments in addition to any combination of input arguments from previous syntaxes. For example, MergeSegments=False returns lane boundary segments for each valid input frame of the lane data without merging the lane boundaries with the same lane boundary IDs.

Note

This function requires the Scenario Builder for Automated Driving Toolbox™ support package and Sensor Fusion and Tracking Toolbox™. You can install the Scenario Builder for Automated Driving Toolbox support package from the Add-On Explorer. For more information about installing add-ons, see Get and Manage Add-Ons.

example

Examples

collapse all

Load tracked lane boundary data and ego trajectory data into the workspace.

data = load("recordedLaneTracks","trackedLaneBoundaries","egoTrajectory")
data = struct with fields:
    trackedLaneBoundaries: [1×1 laneData]
            egoTrajectory: [1×1 waypointTrajectory]

Create lane boundary segments by converting the lane boundaries from ego vehicle coordinates to world coordinates by using ego trajectory data. The egoToWorldLaneBoundarySegments function creates three lane boundary segments from the lane boundary data.

lbsegments = egoToWorldLaneBoundarySegments(data.trackedLaneBoundaries,data.egoTrajectory);

Display the number of created lane boundary segments.

numel(lbsegments)
ans = 
3

Create a lane boundary group object from the lane boundary segments.

lbGroup = laneBoundaryGroup(lbsegments)
lbGroup = 
  laneBoundaryGroup with properties:

      BoundarySegments: [3×1 laneBoundarySegment]
    SegmentConnections: {2×2 cell}
        BoundaryGroups: [1×5 struct]
          GeoReference: []

Plot the lane boundary group object. Observe the grouped lane boundary created from three lane boundary segments.

plot(lbGroup)

Load tracked lane boundary data and ego trajectory data into the workspace.

data = load("recordedLaneTracks","trackedLaneBoundaries","egoTrajectory")
data = struct with fields:
    trackedLaneBoundaries: [1×1 laneData]
            egoTrajectory: [1×1 waypointTrajectory]

Convert the lane boundaries from ego vehicle coordinates to world coordinates, without merging lane boundaries, by using the ego trajectory data. The egoToWorldBoundarySegements function creates 79 lane boundary segments from the lane boundary data.

lbsegments = egoToWorldLaneBoundarySegments(data.trackedLaneBoundaries,data.egoTrajectory,MergeSegments=false);

Display the number of created lane boundary segments.

numel(lbsegments)
ans = 
79

Create a lane boundary group object from the lane boundary segments.

lbGroup = laneBoundaryGroup(lbsegments)
lbGroup = 
  laneBoundaryGroup with properties:

      BoundarySegments: [79×1 laneBoundarySegment]
    SegmentConnections: {78×2 cell}
        BoundaryGroups: [1×5 struct]
          GeoReference: []

Plot the lane boundary group object. Observe the grouped lane buondary created from 79 lane boundary segments.

plot(lbGroup)

Input Arguments

collapse all

Tracked lane boundary data, specified as a laneData object.

Note

The laneData object must contain the track IDs of the lane boundaries, specified as the TrackIDs property, for each timestamp.

Ego trajectory information, specified as a waypointTrajectory (Sensor Fusion and Tracking Toolbox) object.

Ego pose information, specified as an N-element vector of rigidtform3d objects. N is the number of timestamps in trackedLaneBoundaries.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: egoToWorldLaneBoundarySegments(trackedLaneBoundaries,egoTrajectory,MergeSegments=False) returns lane boundary segments for each valid input frame of the lane data without merging the lane boundaries with the same lane boundary IDs.

Lane boundary merging, specified as a logical 1 (true) or 0 (false).

By default, the function merges the input lane boundaries with the same lane boundary IDs to create lane boundary segments. In this case, the function returns fewer lane boundary segments than the number of timestamps in the input trackedLaneBoundaries.

If you specify this argument as false, the function does not merge lane boundaries, and returns N lane boundary segments. N is the number timestamps in the input trackedLaneBoundaries.

To view the number of returned lane boundary segments, use this code:

numel(lbsegments)

Note

If you specify MergeSegments=true, the function does not group the lane boundary segments. To group lane boundaries in the lane boundary segment object, use the laneBoundaryGroup object.

Data Types: logical

Geographic coordinates of the lane boundary origin, specified as a three-element numeric row vector of the form [lat lon alt], where:

  • lat is the latitude of the coordinate, in degrees.

  • lon is the longitude of the coordinate, in degrees.

  • alt is the altitude of the coordinate, in meters.

These values are with respect to the WGS84 reference ellipsoid, which is a standard ellipsoid used by GPS data.

Data Types: single | double

Output Arguments

collapse all

Lane boundary segments, returned as a laneBoundarySegment object or an M-by-1 array of laneBoundarySegment objects. M is the number of segments created by the egoToWorldLaneBoundarySegments function.

Note

The frequency of the lane boundary track ID variations in the input laneData object, trackedLaneBoundaries, determines the number of output lane boundary segments M.

Tips

  • To group adjacent lane boundary segments using boundary connections, use the laneBoundaryGroup object.

Algorithms

  • If the ego vehicle is stationary for multiple, sequential timestamps, then this function skips the rows of the input laneData object that specify lane information redundant to the first stationary timestamp.

  • For the last row of the input laneData object, this function assumes the distance of the lane boundary from the center of the ego vehicle is 5 meters.

Version History

Introduced in R2024a