コード例 #1
0
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.

from bark.runtime.scenario.scenario_generation.interaction_dataset_scenario_generation import \
    InteractionDatasetScenarioGeneration
from bark.runtime.commons.parameters import ParameterServer
from bark.runtime.viewer.matplotlib_viewer import MPViewer
from bark.runtime.viewer.video_renderer import VideoRenderer
from bark.examples.paths import Data
import os
import argparse

# set you json config that contains a map and matching tracks.
param_server = ParameterServer(
    filename=Data.params_data("interaction_example"))
scenario_generation = InteractionDatasetScenarioGeneration(num_scenarios=1,
                                                           random_seed=0,
                                                           params=param_server)

viewer = MPViewer(params=param_server, use_world_bounds=True)

sim_step_time = param_server["simulation"]["step_time",
                                           "Step-time used in simulation", 0.2]
sim_real_time_factor = param_server["simulation"][
    "real_time_factor", "execution in real-time or faster", 1]
scenario = scenario_generation.create_scenarios(param_server, 1)[0]

world_state = scenario.GetWorldState()

sim_time_steps = param_server["simulation"]["simulation_time_steps",
コード例 #2
0
from bark.runtime.scenario.scenario_generation.config_with_ease import \
    LaneCorridorConfig, ConfigWithEase
from bark.runtime.runtime import Runtime
from bark.examples.paths import Data
from bark.core.models.behavior import *

try:
    from bark.core.world.evaluation import EvaluatorRSS
except:
    raise ImportError(
        "This example requires building RSS, please run with \"bazel run //examples:highway_rss --define rss=true\""
    )

# parameters
param_server = ParameterServer(
    filename=Data.params_data("highway_merge_configurable"))
param_server["BehaviorLaneChangeRuleBased"]["MinVehicleRearDistance"] = 4.
param_server["BehaviorLaneChangeRuleBased"]["MinVehicleFrontDistance"] = 2.
param_server["BehaviorLaneChangeRuleBased"]["TimeKeepingGap"] = 0.
param_server["World"]["FracLateralOffset"] = 2.0

# param_server["Visualization"]["Evaluation"]["DrawRssDebugInfo"] = True
# param_server["Visualization"]["Evaluation"]["DrawRssSafetyResponses"] = True
param_server["Visualization"]["Evaluation"]["DrawEgoRSSSafetyResponses"] = True


# custom lane configuration that sets a different behavior model
# and sets the desired speed for the behavior
class HighwayLaneCorridorConfig(LaneCorridorConfig):
    def __init__(self, params=None, **kwargs):
        super().__init__(params=params, **kwargs)
コード例 #3
0
ファイル: interaction_dataset.py プロジェクト: weigaofei/bark
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.

from bark.runtime.scenario.scenario_generation.interaction_dataset_scenario_generation import \
    InteractionDatasetScenarioGeneration
from bark.runtime.commons.parameters import ParameterServer
from bark.runtime.viewer.matplotlib_viewer import MPViewer
from bark.runtime.viewer.video_renderer import VideoRenderer
from bark.examples.paths import Data
import os
import argparse


# set you json config that contains a map and matching tracks.
param_server = ParameterServer(filename=Data.params_data("interaction_example"))
scenario_generation = InteractionDatasetScenarioGeneration(num_scenarios=1,
                                                           random_seed=0,
                                                           params=param_server)

viewer = MPViewer(params=param_server, use_world_bounds=True)

sim_step_time = param_server["simulation"]["step_time",
                                           "Step-time used in simulation",
                                           0.2]
sim_real_time_factor = param_server["simulation"]["real_time_factor",
                                                  "execution in real-time or faster", 1]
scenario = scenario_generation.create_scenarios(param_server, 1)[0]

world_state = scenario.GetWorldState()