I'm working on a path following vehicle. I have a matrix with the coordinates of the path and I have the actual position of the car. And I want to know what is the next point of the path closest to the actual position. How do I do that?

2 ビュー (過去 30 日間)
Basically, I want to know what is the point of the path closer to the point of the actual position.
  3 件のコメント
Walter Roberson
Walter Roberson 2012 年 12 月 25 日
I was thinking more of Block Breaker ;-)

サインインしてコメントする。

回答 (1 件)

Image Analyst
Image Analyst 2012 年 12 月 25 日
Wouldn't you just use the Pythagorean theorem to get the closest distance?
distances = sqrt(pathX - actualX).^2 + (pathY - actualY).^2);
[closestDistance, indexOfClosestPoint] = min(distances);
closestPathX = pathX(indexOfClosestPoint);
closestPathY = pathY(indexOfClosestPoint);

カテゴリ

Help Center および File ExchangeGeometric Geodesy についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by