Main Content

closestPoint

Find closest point on reference path to global point

Description

pathPoints = closestPoint(refPath,points) finds the closest point on the reference path to each of the specified (x,y)-positions points.

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.

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.

Extended Capabilities

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

Introduced in R2020b