Skip to content

Commit

Permalink
Merge pull request #550 from bark-simulator/road_from_csv
Browse files Browse the repository at this point in the history
Full integration for BARK-ML scenario
  • Loading branch information
patrickhart authored Nov 3, 2021
2 parents 150cebb + eb66b50 commit d8a9615
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions bark/runtime/scenario/scenario_generation/config_with_ease.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(self,
# set these params
self._road_ids = kwargs.pop("road_ids", None)
self._lane_corridor_id = kwargs.pop("lane_corridor_id", None)
self._s_min = kwargs.pop("s_min", 0.)
self._s_min = kwargs.pop("s_min", 0.)
self._s_max = kwargs.pop("s_max", 60.)
self._ds_min = kwargs.pop("ds_min", 10.)
self._ds_max = kwargs.pop("ds_max", 20.)
Expand Down Expand Up @@ -69,13 +69,13 @@ def InferRoadIdsAndLaneCorr(self, world):
self._road_ids = self._road_corridor.road_ids
self._lane_corridor = self._road_corridor.GetCurrentLaneCorridor(
start_point)

def state(self, world):
"""Returns a state of the agent
Arguments:
world {bark.core.world}
Returns:
np.array -- time, x, y, theta, velocity
"""
Expand All @@ -87,26 +87,26 @@ def state(self, world):

def ds(self):
"""Increment for placing the agents
Keyword Arguments:
s_min {double} -- Min. lon. distance (default: {5.})
s_max {double} -- Max. lon. distance (default: {10.})
Returns:
double -- delta s-value
"""
return np.random.uniform(self._ds_min, self._ds_max)

def position(self, world):
"""Using the defined LaneCorridor it finds positions for the agents
Arguments:
world {bark.core.world} -- BARK world
Keyword Arguments:
min_s {double} -- Min. lon. value (default: {0.})
max_s {double} -- Max. lon. value (default: {100.})
Returns:
tuple -- (x, y, theta)
"""
Expand Down Expand Up @@ -185,18 +185,18 @@ def controlled_ids(self, agent_list):

def controlled_goal(self, world):
"""Goal for the controlled agent
Arguments:
world {bark.core.world} -- BARK world
Returns:
GoalDefinition -- Goal for the controlled agent
"""
return self.goal(world)

def controlled_behavior_model(self, world):
"""Behavior model for controlled agent
Returns:
BehaviorModel -- BARK behavior model
"""
Expand All @@ -219,10 +219,11 @@ def __init__(self,
params=None,
random_seed=None,
lane_corridor_configs=None,
observer_model=None):
observer_model=None,
map_interface=None):
self._map_file_name = map_file_name
self._lane_corridor_configs = lane_corridor_configs or []
self._map_interface = None
self._map_interface = map_interface or None
self._observer_model = observer_model
super(ConfigWithEase, self).__init__(params, num_scenarios)
self.initialize_params(params)
Expand All @@ -238,7 +239,7 @@ def create_scenarios(self, params, num_scenarios):

def create_single_scenario(self):
"""Creates one scenario using the defined LaneCorridorConfig
Returns:
Scenario -- Returns a BARK scenario
"""
Expand Down Expand Up @@ -272,10 +273,10 @@ def create_single_scenario(self):
agent_params = self._params.AddChild("agent")
agent_goal = lc_config.goal(world)
new_agent = Agent(
agent_state,
agent_behavior,
agent_state,
agent_behavior,
agent_dyn,
agent_exec,
agent_exec,
agent_polygon,
agent_params,
agent_goal,
Expand Down

0 comments on commit d8a9615

Please sign in to comment.