示例#1
0
    def initialize_params(self, params):
        self._local_params = \
          self._params["Scenario"]["Generation"]["DeterministicScenarioGeneration"]

        self.goal_frame_center = self._local_params["goal_frame"][
            "center_pose", "Center pose of the goal frames", [0, 0, 0]]
        self.goal_frame_points = self._local_params["goal_frame"][
            "polygon_points", "Points of the goal frame polygon",
            [[-0.2, 1], [0.2, 1], [0.2, -1], [-0.2, -1], [-0.2, 1]]]
        self.goal_frame_poses = self._local_params[
            "goal_poses",
            "A list with x,y, theta specyfing the sequence of the goal frames",
            [[5, 10, 3.14 / 2 + 0.01], [10, 15, 3.14 /
                                        4], [20, 10, 3.14 /
                                             2], [15, 2, 3.14 / 2 - 0.7]]]

        json_converter = ModelJsonConversion()
        _agent_params = json_converter.agent_to_json(
            self.default_drone_model())
        if not isinstance(_agent_params, dict):
            _agent_params = _agent_params.convert_to_dict()

        self.drone_params = self._local_params[
            "drones", "list of dictionaries with drone definitions",
            [{
                "drone_model": _agent_params
            }]]
        self.ego_agent_id = self._local_params["ego_agent_id",
                                               "ID of the ego-agent", 0]
 def initialize_params(self, params):
     params_temp = \
       self._params["Scenario"]["Generation"]["UniformVehicleDistribution"]
     self._random_seed = 1000  # since ScenarioGeneration UniformVehicleDistribution
     # will soon be deprecated we introduce this hack
     self._map_file_name = params_temp[
         "MapFilename", "Path to the open drive map",
         "modules/runtime/tests/data/city_highway_straight.xodr", ]
     self._ego_goal_end = params_temp[
         "EgoGoalEnd", "The center of the ego agent's goal region polygon",
         [5117, 5200]]
     self._ego_goal_start = params_temp[
         "EgoGoalStart", "The coordinates of the start of the ego goal,\
        if empty only ego goal end is used as center of polygon ", []]
     self._ego_goal_state_limits = params_temp[
         "EgoGoalStateLimits",
         "x,y and theta limits around center line of lane between start and end applied to both lateral sides \
    (only valid if start and end goal of ego are given)", [0.1, 0, 0.08]]
     self._ego_route = params_temp[
         "EgoRoute",
         "A list of two points defining start and end point of initial ego driving corridor. \
        If empty, then one of the other agents is selected as ego agents.",
         [[5117.5, 5100], [5117.5, 5200]]]
     self._others_source = params_temp[
         "OthersSource",
         "A list of points around which other vehicles spawn. \
     Points should be on different lanes. XodrLanes must be near these points \
   (<0.5m) Provide a list of lists with x,y-coordinates",
         [[5114.626, 5061.8305]]]
     self._others_sink = params_temp[
         "OthersSink",
         "A list of points defining end of other vehicles routes.\
     Points should be on different lanes and match the order of the\
     source points. XodrLanes must be near these points (<0.5m) \
     Provide a list of lists with x,y-coordinates", [[5114.626, 5193.1725]]]
     assert len(self._others_sink) == len(self._others_source)
     self._vehicle_distance_range = params_temp["VehicleDistanceRange",
       "Distance range between vehicles in meter given as tuple from which" + \
       "distances are sampled uniformly",
       (10, 20)]
     self._other_velocity_range = params_temp["OtherVehicleVelocityRange",
       "Lower and upper bound of velocity in km/h given as tuple from which" + \
       " velocities are sampled uniformly",
       (20,30)]
     self._ego_velocity_range = params_temp["EgoVehicleVelocityRange",
       "Lower and upper bound of velocity in km/h given as tuple from which" + \
       " velocities are sampled uniformly",
       (20,30)]
     json_converter = ModelJsonConversion()
     self._agent_params = params_temp[
         "VehicleModel", "How to model the other agents",
         json_converter.agent_to_json(self.default_agent_model())]
     if not isinstance(self._agent_params, dict):
         self._agent_params = self._agent_params.convert_to_dict()
     np.random.seed(self._random_seed)
    def initialize_params(self, params):
        params_temp = self.params["Scenario"]["Generation"][
            "UniformVehicleDistribution"]

        self.map_file_name = params_temp[
            "MapFilename", "Path to the open drive map",
            "modules/runtime/tests/data/Crossing8Course.xodr"]
        self.ego_goal = params_temp[
            "EgoGoal", "The center of the ego agent's goal region polygon",
            [-191.789, -50.1725]]
        self.others_source = params_temp[
            "OthersSource",
            "A list of points around which other vehicles spawn. \
                                         Points should be on different lanes. Lanes must be near these points (<0.5m) \
                                         Provide a list of lists with x,y-coordinates",
            [[-16.626, -14.8305]]]
        self.others_sink = params_temp[
            "OthersSink",
            "A list of points around which other vehicles are deleted. \
                                        Points should be on different lanes and match the order of the source points. \
                                        Lanes must be near these points (<0.5m) \
                                        Provide a list of lists with x,y-coordinates",
            [[-191.789, -50.1725]]]
        assert len(self.others_sink) == len(self.others_source)

        self.vehicle_distance_range = params_temp[
            "VehicleDistanceRange",
            "Distance range between vehicles in meter given as tuple from which distances are sampled uniformly",
            (40, 50)]
        self.velocity_range = params_temp[
            "VehicleVelocityRange",
            "Lower and upper bound of velocity in km/h given as tuple from which velocities are sampled uniformly",
            (20, 30)]

        json_converter = ModelJsonConversion()
        self.agent_params = params_temp["VehicleModel", "How to model the agent", \
             json_converter.agent_to_json(self.default_agent_model())]
        if not isinstance(self.agent_params, dict):
            self.agent_params = self.agent_params.convert_to_dict()

        np.random.seed(self.random_seed)