plotTrajectory
軌跡プロッターで一連の軌跡をプロットする
説明
plotTrajectory( は、軌跡プロッターを介して、trajPlotter,trajCoordList)trajCoordList で指定された軌跡をシアター プロット上にプロットします。
例
3 つの軌跡の座標を定義します。
coordinates1 = [(1:10)' (2:11)' (11:-1:2)']; coordinates2 = coordinates1 + 1; coordinates3 = coordinates1 + 2;
theaterPlot オブジェクトを作成し、視点角度を設定して、trajectoryPlotter オブジェクトを作成します。
tp = theaterPlot;
view(14,50)
trajPlotter = trajectoryPlotter(tp,DisplayName="Trajectories");3 つの軌跡をプロットします。
plotTrajectory(trajPlotter,{coordinates1,coordinates2,coordinates3})
この例では、軌跡上のプラットフォーム移動のアニメーションを作成する方法を説明します。
まず、trackingScenario を作成して軌跡のウェイポイントを追加します。
ts = trackingScenario;
height = 100;
d = 1;
wayPoints = [ ...
-30 -25 height;
-30 25-d height;
-30+d 25 height;
-10-d 25 height;
-10 25-d height;
-10 -25+d height;
-10+d -25 height;
10-d -25 height;
10 -25+d height;
10 25-d height;
10+d 25 height;
30-d 25 height;
30 25-d height;
30 -25+d height;
30 -25 height];各ウェイポイントの時間を指定します。
elapsedTime = linspace(0,10,size(wayPoints,1));
次に、トラッキング シナリオでプラットフォームを作成し、trajectory メソッドを使用して軌跡情報を追加します。
target = platform(ts); traj = waypointTrajectory('Waypoints',wayPoints,'TimeOfArrival',elapsedTime); target.Trajectory = traj;
トラッキング シナリオを記録してプラットフォームの軌跡を取得します。
r = record(ts); pposes = [r(:).Poses]; pposition = vertcat(pposes.Position);
シアター プロットを作成して記録した軌跡を表示します。
tp = theaterPlot('XLim',[-40 40],'YLim',[-40 40]); trajPlotter = trajectoryPlotter(tp,'DisplayName','Trajectory'); plotTrajectory(trajPlotter,{pposition})

platformPlotter を使用してアニメーション化します。
restart(ts); trajPlotter = platformPlotter(tp,'DisplayName','Platform'); while advance(ts) p = pose(target,'true'); plotPlatform(trajPlotter, p.Position); pause(0.1) end

このアニメーションは、生成されたすべてのプロットをループ処理します。

入力引数
軌跡プロッター。trajectoryPlotter オブジェクトとして指定します。
表示する軌跡の座標。N 要素の cell 配列として指定します。ここで、N は軌跡の数です。軌跡を表す各 cell 要素には M 行 3 列の行列が含まれます。ここで、M は軌跡内の点の数です。異なる cell 内の行列には異なる行数を含めることができます。各行列の 1 列目、2 列目、3 列目は、対応する軌跡の x 座標、y 座標、および z 座標に対応します。
例: coordList = {[1 2 3; 4 5 6; 7,8,9];[4 2 1; 4 3 1];[4 4 4; 3 1 2; 9 9 9; 1 0 2]} は 3 つの異なる軌跡を指定します。
バージョン履歴
R2018b で導入
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- 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)