このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。
restart
最初からドライビング シナリオ シミュレーションを再実行
説明
例
ドライビング シナリオ シミュレーションの再実行
25 メートルの直線道路を車両が秒速 20 メートルで走行するドライビング シナリオを作成します。シナリオをプロットします。
scenario = drivingScenario('SampleTime',0.1);
roadcenters= [0 0 0; 25 0 0];
road(scenario,roadcenters)
ans = Road with properties: Name: "" RoadID: 1 RoadCenters: [2x3 double] RoadWidth: 6 BankAngle: [2x1 double] Heading: [2x1 double]
v = vehicle(scenario,'ClassID',1); waypoints = [5 0 0; 20 0 0]; speed = 20; % m/s smoothTrajectory(v,waypoints,speed) plot(scenario)
シミュレーションを実行し、各タイム ステップにおける車両の位置を表示します。
while advance(scenario) fprintf('Vehicle location: %0.2f meters at t = %0.0f ms\n', ... v.Position(1), ... scenario.SimulationTime * 1000) end
Vehicle location: 7.00 meters at t = 100 ms Vehicle location: 9.00 meters at t = 200 ms Vehicle location: 11.00 meters at t = 300 ms Vehicle location: 13.00 meters at t = 400 ms Vehicle location: 15.00 meters at t = 500 ms Vehicle location: 17.00 meters at t = 600 ms Vehicle location: 19.00 meters at t = 700 ms
シミュレーションを再実行します。サンプル時間を長くし、シミュレーションを再実行します。
restart(scenario); scenario.SampleTime = 0.2; while advance(scenario) fprintf('Vehicle location: %0.2f meters at t = %0.0f ms\n', ... v.Position(1), ... scenario.SimulationTime * 1000) end
Vehicle location: 9.00 meters at t = 200 ms Vehicle location: 13.00 meters at t = 400 ms Vehicle location: 17.00 meters at t = 600 ms
入力引数
scenario
— ドライビング シナリオ
drivingScenario
オブジェクト
ドライビング シナリオ。drivingScenario
オブジェクトとして指定します。
バージョン履歴
R2017a で導入
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)