Main Content

driving.Path

計画された車両パス

説明

driving.Path オブジェクトは、一連のパス セグメントで構成される車両パスを表します。これらのセグメントは、driving.DubinsPathSegment オブジェクトか driving.ReedsSheppPathSegment オブジェクトのいずれかとなり、driving.PathPathSegments プロパティに保存されます。

vehicleCostmap オブジェクトに対するパスの有効性を確認するには、関数 checkPathValidity を使用します。パスの長さに沿って姿勢を内挿するには、関数 interpolate を使用します。

作成

driving.Path オブジェクトを作成するには、関数 plan を使用し、pathPlannerRRT オブジェクトを入力として指定します。

プロパティ

すべて展開する

この プロパティ は読み取り専用です。

車両の初期姿勢。[x, y, Θ] ベクトルとして指定します。x と y はメートルなどのワールド単位です。Θ の単位は度です。

この プロパティ は読み取り専用です。

車両のゴール姿勢。[x, y, Θ] ベクトルとして指定します。x と y はメートルなどのワールド単位です。Θ の単位は度です。

この プロパティ は読み取り専用です。

パスに沿ったセグメント。driving.DubinsPathSegment オブジェクトまたは driving.ReedsSheppPathSegment オブジェクトの配列として指定します。

この プロパティ は読み取り専用です。

パスの長さ (ワールド単位)。正の実数スカラーとして指定します。

オブジェクト関数

interpolate計画された車両パスに沿った姿勢の内挿
plotPlot planned vehicle path

すべて折りたたむ

最適な RRT* (Rapidly Exploring Random Tree) アルゴリズムを使用して駐車場の車両パスを計画します。パスが有効であることを確認してから、パスに沿って遷移する姿勢をプロットします。

駐車場のコストマップを読み込みます。コストマップをプロットし、駐車場、および車両が回避するインフレート エリアを確認します。

data = load('parkingLotCostmap.mat');
costmap = data.parkingLotCostmap;
plot(costmap)

Figure contains an axes object. The axes object with xlabel X, ylabel Y contains 2 objects of type image, patch. This object represents Inflated Areas.

車両の開始姿勢とゴール姿勢を [x, y, Θ] ベクトルとして定義します。位置 (x,y) のワールド単位はメートルです。方向角度 Θ のワールド単位は度です。

startPose = [4, 4, 90]; % [meters, meters, degrees]
goalPose = [30, 13, 0];

pathPlannerRRT オブジェクトを使用して、開始姿勢からゴール姿勢までのパスを計画します。

planner = pathPlannerRRT(costmap);
refPath = plan(planner,startPose,goalPose);

パスが有効か確認します。

isPathValid = checkPathValidity(refPath,costmap)
isPathValid = logical
   1

パスに沿って遷移する姿勢を内挿します。

transitionPoses = interpolate(refPath);

コストマップ上に計画されたパスと遷移する姿勢をプロットします。

hold on
plot(refPath,'DisplayName','Planned Path')
scatter(transitionPoses(:,1),transitionPoses(:,2),[],'filled', ...
    'DisplayName','Transition Poses')
hold off

Figure contains an axes object. The axes object with xlabel X, ylabel Y contains 13 objects of type image, patch, scatter, line, polygon. These objects represent Inflated Areas, Planned Path, Transition Poses.

Rapidly Exploring Random Tree (RRT*) アルゴリズムを使用して、駐車場の車両パスを計画します。パスに沿った複数の点に車両の姿勢を内挿します。

駐車場のコストマップを読み込みます。コストマップをプロットし、駐車場、および車両が回避するインフレート エリアを確認します。

data = load('parkingLotCostmap.mat');
costmap = data.parkingLotCostmap;
plot(costmap)

Figure contains an axes object. The axes object with xlabel X, ylabel Y contains 2 objects of type image, patch. This object represents Inflated Areas.

車両の開始姿勢とゴール姿勢を [x, y, Θ] ベクトルとして定義します。位置 (x,y) のワールド単位はメートルです。方向角度 Θ のワールド単位は度です。

startPose = [4, 4, 90]; % [meters, meters, degrees]
goalPose = [30, 13, 0]; 

pathPlannerRRTオブジェクトを使用して、開始姿勢からゴール姿勢までのパスを計画します。

planner = pathPlannerRRT(costmap);
refPath = plan(planner,startPose,goalPose);

パス全体に沿って 1 m ごとに車両姿勢を内挿します。

lengths = 0 : 1 : refPath.Length;
poses = interpolate(refPath,lengths);

内挿した姿勢をコストマップ上にプロットします。

plot(costmap)
hold on
scatter(poses(:,1),poses(:,2),'DisplayName','Interpolated Poses')
hold off

Figure contains an axes object. The axes object with xlabel X, ylabel Y contains 3 objects of type image, patch, scatter. These objects represent Inflated Areas, Interpolated Poses.

拡張機能

C/C++ コード生成
MATLAB® Coder™ を使用して C および C++ コードを生成します。

バージョン履歴

R2018a で導入

すべて展開する