このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。
setOccupancy
説明
例
3 次元占有マップの作成とエクスポート
occupancyMap3D
オブジェクトを作成します。
map3D = occupancyMap3D;
地面を作成して占有値を 0 に設定します。
[xGround,yGround,zGround] = meshgrid(0:100,0:100,0); xyzGround = [xGround(:) yGround(:) zGround(:)]; occval = 0; setOccupancy(map3D,xyzGround,occval)
マップの特定のワールド位置に障害物を作成します。
[xBuilding1,yBuilding1,zBuilding1] = meshgrid(20:30,50:60,0:30); [xBuilding2,yBuilding2,zBuilding2] = meshgrid(50:60,10:30,0:40); [xBuilding3,yBuilding3,zBuilding3] = meshgrid(40:60,50:60,0:50); [xBuilding4,yBuilding4,zBuilding4] = meshgrid(70:80,35:45,0:60); xyzBuildings = [xBuilding1(:) yBuilding1(:) zBuilding1(:);... xBuilding2(:) yBuilding2(:) zBuilding2(:);... xBuilding3(:) yBuilding3(:) zBuilding3(:);... xBuilding4(:) yBuilding4(:) zBuilding4(:)];
新しい確率値を使用して障害物を更新し、マップを表示します。
obs = 0.65; updateOccupancy(map3D,xyzBuildings,obs) show(map3D)
マップ ファイルを作成する前に、citymap.ot
という名前のマップ ファイルが現在のディレクトリに既に存在するか確認し、このファイルを削除します。
if exist("citymap.ot",'file') delete("citymap.ot") end
マップを八分木ファイルとしてエクスポートします。
filePath = fullfile(pwd,"citymap.ot");
exportOccupancyMap3D(map3D,filePath)
入力引数
map3D
— 3 次元占有マップ
occupancyMap3D
オブジェクト
3 次元占有マップ。occupancyMap3D
オブジェクトとして指定します。
xyz
— ワールド座標
n 行 3 列の行列
ワールド座標。点 [x y z]
の n 行 3 列の行列として指定します。ここで、n はワールド座標の数です。
occval
— 確率占有値
スカラー | 列ベクトル
確率占有値。xyz
と同じ長さの列ベクトルまたはスカラーとして指定します。スカラー入力は xyz
のすべての座標に適用されます。
0 に近い値は、セルが占有されておらず障害物がない確かさを表します。
拡張機能
C/C++ コード生成
MATLAB® Coder™ を使用して C および C++ コードを生成します。
setOccupancy
は、packType
引数を "flat"
に設定した場合、関数 packNGo
(MATLAB Coder) を使用したコード生成をサポートしません。
バージョン履歴
R2019b で導入
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)