interpolate
説明
は、参照パス上の指定された弧の長さを内挿し、パス上の内挿点をグローバル座標で返します。pathPoints
= interpolate(refPath
,arclengths
)
例
参照パスからの軌跡の生成
一連のウェイポイントから参照パスを生成します。
waypoints = [0 0; 50 20; 100 0; 150 10]; refPath = referencePathFrenet(waypoints);
この参照パスから trajectoryGeneratorFrenet
オブジェクトを作成します。
connector = trajectoryGeneratorFrenet(refPath);
パスの原点と、パスに沿って 30 メートルのポイントとの間の 5 秒の軌跡を、フレネ状態として生成します。
initCartState = refPath.SegmentParameters(1,:); initFrenetState = global2frenet(refPath,initCartState); termFrenetState = initFrenetState + [30 zeros(1,5)]; frenetTraj = connect(connector,initFrenetState,termFrenetState,5);
この軌跡をグローバル状態に変換します。
globalTraj = frenet2global(refPath,frenetTraj.Trajectory);
この参照パスと軌跡を表示します。
show(refPath); axis equal hold on plot(globalTraj(:,1),globalTraj(:,2),'b')
グローバル点を指定し、参照パス上の最近傍点を求めます。
globalPoints = waypoints(2:end,:) + [20 -50]; nearestPathPoint = closestPoint(refPath,globalPoints);
グローバル点と、参照パス上の最近傍点を表示します。
plot(globalPoints(:,1),globalPoints(:,2),'r*','MarkerSize',10) plot(nearestPathPoint(:,1),nearestPathPoint(:,2),'b*','MarkerSize',10)
参照パスに沿った最初の 2 つの最近傍点の間の弧の長さを内挿します。
arclengths = linspace(nearestPathPoint(1,6),nearestPathPoint(2,6),10); pathStates = interpolate(refPath,arclengths);
内挿されたパス上の点を表示します。
plot(pathStates(:,1),pathStates(:,2),'g') legend(["Waypoints","Reference Path","Trajectory to 30m",... "Global Points","Closest Points","Interpolated Path Points"])
入力引数
refPath
— 参照パス
referencePathFrenet
オブジェクト
参照パス。referencePathFrenet
オブジェクトとして指定します。
arclengths
— 参照パスに沿った距離
N 要素ベクトル
参照パスに沿った距離。N 要素ベクトルとして指定します。N は点をサンプリングする弧の長さの数です。各距離はメートル単位です。
出力引数
pathPoints
— 参照パス上の点
N 行 6 列の数値行列
参照パス上の点。行の形式が [x y theta kappa dkappa s]
である N 行 6 列の数値行列として返されます。ここで次のようになっています。
x y および theta — グローバル座標で表された SE(2) の状態 (x と y はメートル単位、theta はラジアン単位)
kappa — 曲率 (半径の逆数、
m-1
単位)dkappa — 弧の長さに対する曲率の微分 (
m-2
単位)s — 弧の長さ (パスの原点からパスに沿った距離、メートル単位)
N は参照パスに沿ってサンプリングされた点の数です。
拡張機能
C/C++ コード生成
MATLAB® Coder™ を使用して C および C++ コードを生成します。
バージョン履歴
R2020b で導入
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)