Main Content

getRoadTerrain

Get road information from RoadRunner HD Map

Since R2026a

    Description

    roadInfo = getRoadTerrain(rrHDMapQuery,actorPose) gets the information about the road at the specified actor pose actorPose within a RoadRunner HD Map using the RoadRunner HD Map query object rrHDMapQuery.

    example

    roadInfo = getRoadTerrain(rrHDMapQuery,actorPose,ActorPoseType=poseType) specifies the type of the actor pose.

    Examples

    collapse all

    Create an empty RoadRunner HD Map object.

    rrHDMap = roadrunnerHDMap;

    Specify the path to a RoadRunner HD Map binary file, and use the read function to populate the empty RoadRunner HD Map object with the map data.

    Note: Replace the file path specified in this code block with the absolute path to an .rrhd file on your system.

    filename = "C:\RR\MyProject\Exports\SimpleBankedRoad.rrhd";
    read(rrHDMap,filename);

    Convert the RoadRunner HD Map object into a MATLAB structure.

    rrHDMapStruct = convertToStruct(rrHDMap);

    Create a RoadRunner HD Map query object using the RoadRunner HD Map structure.

    rrHDMapQuery = roadrunnerHDMapQuery(rrHDMapStruct);

    Specify a driving scenario-compatible actor pose structure. This structure must include the position, orientation, and velocity of an actor in the scenario.

    poseType = "drivingscenario";
    actorPose = struct("ActorID",1,"Position",[-18.57 102.40 -2.76],"Velocity",[0 0 0],"Roll",0,"Pitch",0,"Yaw",92.09,"AngularVelocity",[0 0 0]);

    Get the information for the road attributes at the specified actor pose from the RoadRunner HD Map.

    roadInfo= getRoadTerrain(rrHDMapQuery,actorPose,ActorPoseType=poseType)
    roadInfo = struct with fields:
        Elevation: -2.7687
            Grade: 0.0424
          Banking: 0.1392
    
    

    Input Arguments

    collapse all

    RoadRunner HD Map query object, specified as a roadrunnerHDMapQuery object.

    Pose of an actor, specified as a structure. The pose of an actor represents the position, orientation, and velocity of the actor in a driving scenario or RoadRunner scenario.

    If your actor information comes from a cuboid simulation environment, you must specify an actor pose structure with these fields, and specify the poseType argument as "drivingScenario".

    Field NameDescription
    ActorIDScenario-defined actor identifier, specified as a positive integer.
    PositionPosition of the actor, specified as a real-valued vector of the form [x y z]. Units are in meters.
    VelocityVelocity (v) of the actor in the x- y-, and z-directions, specified as a real-valued vector of the form [vx vy vz]. Units are in meters per second.
    RollRoll angle of the actor, specified as a real-valued scalar. Units are in degrees.
    PitchPitch angle of the actor, specified as a real-valued scalar. Units are in degrees.
    YawYaw angle of the actor, specified as a real-valued scalar. Units are in degrees.
    AngularVelocityAngular velocity (ω) of the actor in the x-, y-, and z-directions, specified as a real-valued vector of the form [ωx ωy ωz]. Units are in degrees per second.

    If your actor information comes from a RoadRunner Scenario simulation environment, you must specify an actor pose structure with these fields, and specify the poseType argument as "roadrunner".

    Field NameDescription
    ActorIDScenario-defined actor identifier, specified as an integer of data type uint64.
    PosePosition and orientation of the actor, specified as a 4-by-4 matrix. For more information, see What Is a RoadRunner Pose Matrix?.
    VelocityActor velocity in the x-, y- and z- directions, specified as a 1-by-3 vector. Units are in meters per second.
    AngularVelocityAngular velocity of the actor in the x-, y- and z- directions, specified as a 1-by-3 vector. Units are in radians per second.

    Type of the actor pose, specified as "drivingscenario" or "roadrunner". This argument determines which fields the getRoadTerrain function expects in the structure specified to the actorPose argument. For more information, see actorPose.

    Output Arguments

    collapse all

    Road information at the actor pose, returned as a structure with these fields.

    Field NameDescription
    ElevationHeight of the road, returned as a real-valued scalar. Units are in meters.
    GradeGrade of the road, returned as a real-valued scalar. Units are in radians.
    BankingBanking angle of the road, returned as a real-valued scalar. Units are in radians.

    Extended Capabilities

    expand all

    C/C++ Code Generation
    Generate C and C++ code using MATLAB® Coder™.

    Version History

    Introduced in R2026a