Main Content


Projects sequence of points onto path


    pathPoints = closestPointsToSequence(refPath,points,initWindow) uses the closest point within a sequence of points, points, to be within the valid search window, initWindow. For each point in Points, the search window is centered at the previous point.

    [pathPoints,inWindow] = closestPointsToSequence(refPath,points,initWindow) optionally returns a logical vector inWindow, specifying whether each point for the corresponding xy coordinate in points is projected within the search window.

    Input Arguments

    collapse all

    Reference path, specified as a referencePathFrenet object.

    Global points, specified as a P-by-2 numeric matrix with rows of the form [x y]. P is the number of points. Positions are in meters.

    Initial search window, specified as a two-element row vector in the form [minimum_bound maximum_bound] .

    Output Arguments

    collapse all

    Closest points on the reference path , returned as an N-by-6 numeric matrix with rows of form [x y theta kappa dkappa s], where:

    • x y and theta— SE(2) state expressed in global coordinates, with x and y in meters and theta in radians

    • kappa — Curvature, or inverse of the radius, in meters

    • dkappa — Derivative of curvature with respect to arc length in meters per second

    • s — Arc length, or distance along path from path origin, in meters

    N is the number of points sampled along the reference path.

    Indication whether each point nearest to the corresponding xy coordinate in points, is projected within the search window, returned as an N-element logical row vector, where N is the number of points in points. Points being projected within the search window are true, or false if they lie at the end of a window.

    Extended Capabilities

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

    Version History

    Introduced in R2022a