interpolate
説明
interpolate(
は、制御パス pathObj
)pathObj
の StatePropagator
プロパティにある nav.StatePropagator
オブジェクトの ControlStepSize
プロパティに基づいてパスを評価し、すべての中間点を制御パスに追加します。
例
モバイル ロボット用の制御と 2 つの運動力学経路の組み合わせ
状態と状態伝播関数パラメーターの設定
三項マップ行列を読み込み、occupancyMap
オブジェクトを作成します。
load("exampleMaps","ternaryMap") map = occupancyMap(ternaryMap,10);
マップを使用して、二輪の運動学モデルの状態伝播関数を作成します。
propagator = mobileRobotPropagator(Environment=map);
マップのワールドの範囲に基づき、状態空間の状態の範囲を設定します。
propagator.StateSpace.StateBounds(1:2,:) = [map.XWorldLimits; map.YWorldLimits];
パスの計画
状態伝播関数からパス プランナーを作成します。
planner = plannerControlRRT(propagator);
開始状態とゴール状態を指定します。
start = [10 15 0]; goal = [40 30 0];
状態間のパスを計画します。結果を再現できるように、計画を行う前に乱数発生器をリセットします。
rng("default")
path = plan(planner,start,goal);
制御パスの総経過期間をチェックします。
pathDuration(path)
ans = 102.4000
伝播関数の制御ステップ サイズまでのパスを内挿します。
interpolate(path)
パスを可視化します。
figure show(map) hold on plot(start(1),start(2),"rx") plot(goal(1),goal(2),"go") plot(path.States(:,1),path.States(:,2),"b") hold off
リターン パスの計画
前のパス位置の終点から開始点に戻る 2 番目のパスを計画します。
path2 = plan(planner,path.States(end,:),start);
2 番目のパスの総経過期間をチェックします。
pathDuration(path2)
ans = 100.3000
パスを可視化します。
figure show(map) hold on plot(start(1),start(2),"rx") plot(goal(1),goal(2),"go") plot(path2.States(:,1),path2.States(:,2),"m") hold off
パスの組み合わせ
2 番目のパスから動作のシーケンスを抽出します。
states = path2.States(2:end,:); controls = path2.Controls; targets = path2.TargetStates; durations = path2.Durations;
このシーケンスを最初のパスの最後に追加します。
append(path,states,controls,targets,durations)
元のパスに新しいセグメントを内挿します。
interpolate(path)
最後のパスの総経過期間をチェックします。
pathDuration(path)
ans = 102.4000
パスを可視化します。
figure show(map) hold on plot(start(1),start(2),"rx") plot(goal(1),goal(2),"go") plot(path.States(:,1),path.States(:,2),"b") hold off
入力引数
pathObj
— 制御パス オブジェクト
navControlPath
オブジェクト
制御パス。navPathControl
オブジェクトとして指定します。
データ型: double
バージョン履歴
R2021b で導入
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)