Main Content

roadrunnerHDMap

Create RoadRunner HD Map using MATLAB

Since R2022b

    Description

    A roadrunnerHDMap object enables you to create a RoadRunner HD Map using MATLAB®. You can also populate the map with lanes, lane boundaries, lane markings, and junctions.

    RoadRunner HD Map is a road data model for representing high-definition (HD) map data in a RoadRunner scene. This model defines a simple data structure to represent road layouts using lanes, lane boundaries, lane markings, and junctions. You can use the RoadRunner HD Map to create a binary file for your custom HD map data, import the binary file into RoadRunner, and build scenes.

    Creation

    Description

    rrMap = roadrunnerHDMap() creates an empty RoadRunner HD Map. You can populate the map with lanes, lane boundaries, lane markings, and junctions using roadrunnerHDMap object properties. The data in the map is serialized using protocol buffers and saved in a binary format with the .rrhd extension using the write method. You can use the read method to read a file with .rrhd extension and populate an empty roadrunnerHDMap object.

    rrMap = roadrunnerHDMap(Name=Value) sets the properties using name-value pairs.

    example

    Properties

    expand all

    Name of the map author, specified as a string scalar.

    Example: rrMap= roadrunnerHDMap(Author="Map Author") creates a RoadRunner HD Map owned by "Map Author".

    Data Types: char | string

    Geographic coordinates of road network origin, specified as a row vector of the form [lat, lon] with two elements. lat represents the latitude of the coordinates in degrees and lon represents the longitude of the coordinates in degrees. These values are with respect to the WGS84 reference ellipsoid, which is a standard ellipsoid used by GPS data. For more details, see Coordinate Space and Georeferencing.

    Data Types: double

    Spatial bounds of the geometric data represented in the 3D coordinate space of the RoadRunner HD Map projection, specified as a 2-by-3 matrix of double precision. The elements in the matrix represent the minimum and the maximum position of a 3D axis-aligned box.

    Example: rrMap= roadrunnerHDMap(Author="Map Author", GeographicBoundary=[-0.782 -3.13 0;101.565 50 0]) creates a RoadRunner HD Map owned by "Map Author". The spatial bounds of the geometric data in the 3D coordinate space of the map projection is specified by the double precision values of the parameter GeographicBoundary.

    Data Types: double

    Lane properties of a road, specified as an array of roadrunner.hdmap.Lane objects.

    Example: rrMap.Lanes(1)= roadrunner.hdmap.Lane(ID="Lane1", Geometry=[-0.782 -1.56;50.78 23.43], LaneType="Driving", TravelDirection="Forward") adds this information about the lanes for the map: lane id, coordinates defining lane geometry, lane type, and driving direction.

    Speed limits of lanes in the map, specified as an array of roadrunner.hdmap.SpeedLimit (Automated Driving Toolbox) objects.

    Example: rrMap.SpeedLimits = roadrunner.hdmap.SpeedLimit(ID="SpeedLimit1") adds a speed limit with ID "SpeedLimit1" to the map.

    Boundaries of the lane, specified as an array of roadrunner.hdmap.LaneBoundary objects.

    Example: rrMap.LaneBoundaries(1)= roadrunner.hdmap.LaneBoundary(ID="LaneBoundary1", Geometry=[0 0;50 25]) adds the lane boundaries to the lane and defines the geometry for each lane boundary.

    Group of lanes with similar geometry, specified as an array of roadrunner.hdmap.LaneGroup objects.

    Example: rrMap.LaneGroups= roadrunner.hdmap.LaneGroup(ID="LaneGroup1") adds a lane group with an id "LaneGroup1" to the map.

    Lane marking definitions, specified as an array of roadrunner.hdmap.LaneMarking objects.

    Example: rrMap.LaneMarkings= roadrunner.hdmap.LaneMarking(ID="Dashed1", AssetPath="Assets/Markings/DashedSingleWhite.rrlms") adds the "Dashed1" lane marking asset from its relative location to the lane.

    Road junctions in the map, specified as an array of roadrunner.hdmap.Junction objects.

    Example: rrMap.Junctions= roadrunner.hdmap.Junction(ID="Junction1") adds a junction with id "Junction1" to the map.

    Barrier types for barrier extrusion and type information, specified as an array of roadrunner.hdmap.BarrierType objects.

    Example: rrMap.BarrierTypes= roadrunner.hdmap.BarrierType(ID="BarrierType1", ExtrusionPath=path) adds a barrier type with id "BarrierType1" for a barrier extrusion with the asset path, path, pointing to the extrusion information of this barrier type.

    Barriers in the map, specified as an array of roadrunner.hdmap.Barrier objects.

    Example: rrMap.Barrier= roadrunner.hdmap.Barrier(ID="Barrier1") adds a barrier with id "Barrier1" to the map.

    Sign types of sign features and type information, specified as an array of roadrunner.hdmap.SignType objects.

    Example: rrMap.SignTypes= roadrunner.hdmap.SignType(ID="SignType1", ExtrusionPath=AssetPath="Assets/Signs/UK/Sign_Parking.svg") adds a sign type with id "SignType1" for a parking sign located on the relative path "Assets/Signs/UK/Sign_Parking.svg".

    Signs in the map, specified as an array of roadrunner.hdmap.Sign objects.

    Example: rrMap.Sign= roadrunner.hdmap.Sign(ID="Sign1") adds a sign with id "Sign1" to the map.

    Attributes of physical objects (includes road furniture and props), specified as an array of roadrunner.hdmap.StaticObjectType objects.

    Example: rrMap.StaticObjectType= roadrunner.hdmap.StaticObjectType(ID="StaticObjectType1") adds a static object type with id "StaticObjectType1" to the map.

    Attributes of physical objects (includes road furniture and props), specified as an array of roadrunner.hdmap.StaticObject objects.

    Example: rrMap.StaticObject= roadrunner.hdmap.StaticObject(ID="StaticObject1") adds a static object with id "StaticObject1" to the map.

    Types and type information of stencil marking features, specified as an array of roadrunner.hdmap.StencilMarkingType (Automated Driving Toolbox) objects.

    Example: rrMap.StencilMarkingTypes = roadrunner.hdmap.StencilMarkingType(ID="StencilMarkingType1", AssetPath="path") adds a stencil marking type with ID "StencilMarkingType1" for a stencil marking located on the relative path "path".

    Stencil markings in the map, specified as an array of roadrunner.hdmap.StencilMarking (Automated Driving Toolbox) objects.

    Example: rrMap.StencilMarkings = roadrunner.hdmap.StencilMarking(ID="StencilMarking1") adds a stencil marking with ID "StencilMarking1" to the map.

    Types and type information of curve marking features, specified as an array of roadrunner.hdmap.CurveMarkingType (Automated Driving Toolbox) objects.

    Example: rrMap.CurveMarkingTypes = roadrunner.hdmap.CurveMarkingType(ID="CurveMarkingType1", AssetPath="path") adds a curve marking type with id "CurveMarkingType1" for a curve marking located on the relative path "path".

    Curve markings in the map, specified as an array of roadrunner.hdmap.CurveMarking (Automated Driving Toolbox) objects.

    Example: rrMap.CurveMarkings = roadrunner.hdmap.CurveMarking(ID="CurveMarking1") adds a curve marking with ID "CurveMarking1" to the map.

    Object Functions

    writeWrite HD Map to binary file using MATLAB
    readRead HD Map from binary file using MATLAB
    plotPlot RoadRunner HD Map using MATLAB
    readCRSRead coordinate reference system (CRS) data from RoadRunner HD map using MATLAB

    Examples

    collapse all

    Create a RoadRunner HD Map by calling the roadrunnerHDMap object. The object returns a map with an author and spatial bounds of geometric data attributes.

    rrMap = roadrunnerHDMap(Author="Map Author",GeographicBoundary=[-0.782 -3.13 0;101.565 50 0]);

    Create the road lanes using the roadrunner.hdmap.Lane object. Specify the lane information for the lane id, coordinates defining the lane geometry, driving direction, and lane type.

    rrMap.Lanes(2) = roadrunner.hdmap.Lane(ID="Lane2",Geometry=[50.78 23.43;100.78 48.43],LaneType="Driving", TravelDirection="Forward");
    rrMap.Lanes(1) = roadrunner.hdmap.Lane(ID="Lane1",Geometry=[0.782 -1.56;50.78 23.43],LaneType="Driving", TravelDirection="Forward");

    Add connectivity information for Lane1 and Lane2. Specify alignment between the lanes by defining information about their predecessor and successor relationship.

    addPredecessor(rrMap.Lanes(2),"Lane1",Alignment="Forward");
    addSuccessor(rrMap.Lanes(1),"Lane2",Alignment="Forward");

    Create the lane boundaries of the road using the roadrunner.hdmap.LaneBoundary object. Specify the lane boundary information for the lane id and the coordinates defining the lane geometry.

    rrMap.LaneBoundaries(4) = roadrunner.hdmap.LaneBoundary(ID="LaneBoundary4",Geometry=[50 25; 100 50]);
    rrMap.LaneBoundaries(3) = roadrunner.hdmap.LaneBoundary(ID="LaneBoundary3",Geometry=[51.565 21.864; 101.565 46.869]);
    rrMap.LaneBoundaries(2) = roadrunner.hdmap.LaneBoundary(ID="LaneBoundary2",Geometry=[1.565 -3.13; 51.565 21.864]);
    rrMap.LaneBoundaries(1) = roadrunner.hdmap.LaneBoundary(ID="LaneBoundary1",Geometry=[0 0; 50 25]);

    Link the lane boundaries to the lanes. Define the left and the right lane boundaries for each lane, and specify alignment between lanes and lane boundaries.

    leftBoundary(rrMap.Lanes(1),"LaneBoundary1",Alignment="Forward");
    rightBoundary(rrMap.Lanes(1),"LaneBoundary2",Alignment="Forward");
    leftBoundary(rrMap.Lanes(2),"LaneBoundary4",Alignment="Forward");
    rightBoundary(rrMap.Lanes(2),"LaneBoundary3",Alignment="Forward");

    Version History

    Introduced in R2022b

    expand all