主要内容

getNeighborLanes

Get information about neighboring lanes from RoadRunner HD Map

Since R2026a

    Description

    neighborLanesInfo = getNeighborLanes(rrHDMapQuery,actorPose) gets the information about the neighboring lanes at the specified actor pose actorPose within a RoadRunner HD Map using the RoadRunner HD Map query object rrHDMapQuery.

    example

    neighborLanesInfo = getNeighborLanes(rrHDMapQuery,actorPose,Name=Value) specifies additional options using one or more name-value arguments. For example, ActorPoseType="drivingscenario" specifies for the function to expect a driving scenario-compatible actor pose structure.

    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.

    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 neighboring lanes at the specified actor pose from the RoadRunner HD Map.

    NeighborLaneInfo = getNeighborLanes(rrHDMapQuery,actorPose,ActorPoseType="drivingscenario")
    NeighborLaneInfo = struct with fields:
              NumLanes: 4
           ActorLaneID: 3
                 Lanes: [4×1 struct]
        LaneBoundaries: [5×1 struct]
    
    

    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 ActorPoseType 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 ActorPoseType 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.

    Name-Value Arguments

    collapse all

    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: getNeighborLanes(rrHDMapQuery,actorPose,ActorPoseType="drivingscenario") specifies for the function to expect a driving scenario-compatible actor pose structure.

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

    Include nondriving lanes, specified as a logical 1 (true) or 0 (false). By default, if the actor is on a nondriving lane, the function still queries the map for information about the nondriving lane and returns its information. Specify this argument as false to skip querying and returning information about nondriving lanes.

    Output Arguments

    collapse all

    Neighboring lane information at the specified actor pose, returned as a structure. Neighboring lanes are lanes directly adjacent to the lane where the actor is positioned on the map. A RoadRunner HD Map considers a lane neighboring if it shares a boundary with the current lane, or is connected to a lane that does, and has the same direction of travel. The structure contains these fields.

    Field NameDescription
    NumLanesNumber of neighboring lanes, returned as a scalar.
    ActorLaneIDID of the lane on which the actor is positioned, returned as scalar.
    Lanes

    Information about the neighboring lanes, returned as an M-by-1 structure array, where M is the number of neighboring lanes. Each structure in the array contains the information of a neighboring lane with these fields.

    • LaneID — Universal unique identifier (UUID) of the lane, returned as a string scalar.

    • Coordinates — Lane center coordinates, returned as a real-valued N-by-3 matrix, where N is the number of points on the lane center line.

    • LaneType — Type of the lane, returned as a roadrunner.hdmap.LaneType object. For more information on lane types in RoadRunner HD Maps, see the LaneType property of the Lane object.

    • TravelDirection — Travel direction of the lane, returned as a roadrunner.hdmap.TravelDirection object. For more information on the travel direction of lanes in RoadRunner HD Maps, see the TravelDirection property of the Lane object.

    • LaneWidth — Width of the lane, returned as a real-valued scalar. Units are in meters.

    • LaneSpeed — Speed limit of the lane, returned as a real-valued scalar. Units are in meters per second.

    • LeftLaneBoundaryIndex — Index of the left boundary of the lane, returned as a scalar.

    • RightLaneBoundaryIndex — Index of the right boundary of the lane, returned as a scalar.

    LaneBoundaries

    Information about the boundaries of the neighboring lanes, returned as a P-by-1 structure array, where P is the number of neighboring lane boundaries. Each structure in the array contains the information of a neighboring lane boundary with these fields.

    • Coordinates — Lane boundary coordinates, returned as a real-valued N-by-3 matrix, where N is the number of lane boundary coordinates. Lane boundary coordinates define the positions of points on the boundary at longitudinal distances away from the ego vehicle along the center of the road.

    • Curvature — Curvature at each lane boundary point, returned as a real-valued N-by-1 vector. N is the number of lane boundary coordinates. Units are in radians per meter.

    • CurvatureDerivative — Derivative of the curvature at lane boundary, returned as a real-valued N-by-1 vector. N is the number of lane boundary coordinates. Units are in radians per square meter.

    • CurveLength — Length of the lane boundary along the road, returned as a nonnegative real scalar.

    • HeadingAngle — Initial lane boundary heading angle, returned as a real scalar. The heading angle of the lane boundary is relative to the ego vehicle heading. Units are in degrees.

    • LateralOffset — Lateral offset of the ego vehicle position from the lane boundary, returned as a real scalar. A positive value represents a lane boundary offset to the left of the ego vehicle, while a negative value represents a lane boundary offset to the right of the ego vehicle. Units are in meters.

    Extended Capabilities

    expand all

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

    Version History

    Introduced in R2026a