コード例 #1
0
ファイル: viewer.py プロジェクト: GAIL-4-BARK/bark
    def __init__(self, params=None, **kwargs):
        if(params is None):
           params = ParameterServer()
        Viewer.__init__(self)
        # color parameters
        # agents
        self.color_other_agents_line = params["Visualization"]["Agents"]["Color"]["Other"]["Lines", "Color of other agents", (0.7,0.7,0.7)]
        self.color_other_agents_face = params["Visualization"]["Agents"]["Color"]["Other"]["Face", "Color of other agents", (0.7,0.7,0.7)]
        self.color_eval_agents_line = params["Visualization"]["Agents"]["Color"]["Controlled"]["Lines", "Color of controlled, evaluated agents", (0.,.27,.58)]
        self.color_eval_agents_face = params["Visualization"]["Agents"]["Color"]["Controlled"]["Face", "Color of controlled, evaluated agents", (.49, .63, .83)]
        self.use_colormap_for_other_agents = params["Visualization"]["Agents"]["Color"]["UseColormapForOtherAgents", "Flag to enable color map for other agents", False]
        self.alpha_eval_agent = params["Visualization"]["Agents"]["Alpha"]["Controlled", "Alpha of evalagents", 1.]
        self.alpha_other_agents = params["Visualization"]["Agents"]["Alpha"]["Other", "Alpha of other agents", 1]
        self.route_color =  params["Visualization"]["Agents"]["ColorRoute", "Color of agents routes", (0.2,0.2,0.2)]
        self.draw_route = params["Visualization"]["Agents"]["DrawRoute", "Draw Route of each agent", False]
        self.draw_agent_id = params["Visualization"]["Agents"]["DrawAgentId", "Draw id of each agent", True]
        self.draw_eval_goals = params["Visualization"]["Agents"]["DrawEvalGoals", "Draw Route of eval agent goals", True]
        self.eval_goal_color = params["Visualization"]["Agents"]["EvalGoalColor", "Color of eval agent goals", (.49, .63, .83)]
        self.draw_history = params["Visualization"]["Agents"]["DrawHistory", "Draw history with alpha trace for each agent", False]
        # map
        self.color_lane_boundaries = params["Visualization"]["Map"]["XodrLanes"]["Boundaries"]["Color", "Color of agents except ego vehicle", (0.7,0.7,0.7)]
        self.alpha_lane_boundaries = params["Visualization"]["Map"]["XodrLanes"]["Boundaries"]["Alpha", "Color of agents except ego vehicle", 1.0]
        self.plane_color = params["Visualization"]["Map"]["Plane"]["Color", "Color of the background plane", (1, 1, 1, 1)]
        self.plane_alpha = params["Visualization"]["Map"]["Plane"]["Alpha", "Alpha of the background plane", 1.0]
        self.map_linewidth = params["Visualization"]["Map"]["XodrLanes"]["Boundaries"]["Linewidth", "Linewidth of linestrings", 1.0]

        self.parameters = params

        self.use_world_bounds = kwargs.pop("use_world_bounds", False)
        self.follow_agent_id = kwargs.pop("follow_agent_id", None)

        self.center = kwargs.pop("center", np.array([0, 0]))

        self.world_x_range = kwargs.pop("x_range", np.array([-40, 40]))
        self.world_y_range = kwargs.pop("y_range", np.array([-40, 40]))

        self.enforce_x_length = kwargs.pop("enforce_x_length", True)
        self.enforce_y_length = kwargs.pop("enforce_y_length", False)
        self.x_length = kwargs.pop("x_length", np.sum(np.absolute(self.world_x_range)))
        self.y_length = kwargs.pop("y_length", np.sum(np.absolute(self.world_y_range)))

        self.dynamic_world_x_range = self.world_x_range.copy()
        self.dynamic_world_y_range = self.world_y_range.copy()
コード例 #2
0
ファイル: viewer.py プロジェクト: weigaofei/bark
    def __init__(self, params=None, **kwargs):
        if (params is None):
            params = ParameterServer()
        Viewer.__init__(self)
        # color parameters
        # agents
        self.color_other_agents_line = params["Visualization"]["Agents"][
            "Color"]["Other"]["Lines", "Color of other agents",
                              (0.1, 0.1, 0.1)]
        self.color_other_agents_face = params["Visualization"]["Agents"][
            "Color"]["Other"]["Face", "Color of other agents", (0.7, 0.7, 0.7)]
        self.color_eval_agents_line = params["Visualization"]["Agents"][
            "Color"]["Controlled"]["Lines",
                                   "Color of controlled, evaluated agents",
                                   (0.9, 0, 0)]
        self.color_eval_agents_face = params["Visualization"]["Agents"][
            "Color"]["Controlled"]["Face",
                                   "Color of controlled, evaluated agents",
                                   (0.9, 0, 0)]
        self.use_colormap_for_other_agents = params["Visualization"]["Agents"][
            "Color"]["UseColormapForOtherAgents",
                     "Flag to enable color map for other agents", True]
        self.if_colormap_use_line_others = params["Visualization"]["Agents"][
            "Color"][
                "IfColormapUseLineColorOthers",
                "Flag to enable that line color can be fixed for other agents while using colormap",
                True]
        self.alpha_eval_agent = params["Visualization"]["Agents"]["Alpha"][
            "Controlled", "Alpha of evalagents", 0.8]
        self.alpha_other_agents = params["Visualization"]["Agents"]["Alpha"][
            "Other", "Alpha of other agents", 1]
        self.route_color = params["Visualization"]["Agents"][
            "ColorRoute", "Color of agents routes", (0.2, 0.2, 0.2)]
        self.draw_route = params["Visualization"]["Agents"][
            "DrawRoute", "Draw Route of each agent", False]
        self.draw_agent_id = params["Visualization"]["Agents"][
            "DrawAgentId", "Draw id of each agent", True]
        self.draw_invalid_agents = params["Visualization"]["Agents"][
            "DrawInvalidAgents", "Draw invalid agents with patch", False]
        self.draw_orientation_arrow = params["Visualization"]["Agents"][
            "DrawOrientationArrow", "Draw Orientation of Arrow", False]
        self.draw_behavior_plan_eval_agent = params["Visualization"]["Agents"][
            "DrawBehaviorPlanEvalAgent",
            "Draw behavior plan of evalauted agent", False]
        self.draw_eval_goals = params["Visualization"]["Agents"][
            "DrawEvalGoals", "Draw Route of eval agent goals", True]
        self.eval_goal_color = params["Visualization"]["Agents"][
            "EvalGoalColor", "Color of eval agent goals", (.49, .63, .83)]
        self.draw_history = params["Visualization"]["Agents"][
            "DrawHistory", "Draw history with alpha trace for each agent",
            False]
        self.draw_history_draw_face = params["Visualization"]["Agents"][
            "DrawHistoryDrawFace",
            "Flag to specify if face is drawn in history mode", True]

        # map
        self.color_lane_boundaries = params["Visualization"]["Map"][
            "XodrLanes"]["Boundaries"]["Color",
                                       "Color of agents except ego vehicle",
                                       (0.7, 0.7, 0.7)]
        self.alpha_lane_boundaries = params["Visualization"]["Map"][
            "XodrLanes"]["Boundaries"]["Alpha",
                                       "Color of agents except ego vehicle",
                                       1.0]
        self.plane_color = params["Visualization"]["Map"]["Plane"][
            "Color", "Color of the background plane", (1, 1, 1, 1)]
        self.plane_alpha = params["Visualization"]["Map"]["Plane"][
            "Alpha", "Alpha of the background plane", 1.0]
        self.map_linewidth = params["Visualization"]["Map"]["XodrLanes"][
            "Boundaries"]["Linewidth", "Linewidth of linestrings", 1.0]
        self._draw_aerial_image = params["Visualization"]["Map"][
            "DrawAerialImage", "Flag to draw aerial image behind map", False]

        self.draw_ltl_debug_info = params["Visualization"]["Evaluation"][
            "DrawLTLDebugInfo",
            "Flag to specify if debug info to ltl evaluators shall be plotted",
            False]

        self.draw_rss_debug_info = params["Visualization"]["Evaluation"][
            "DrawRssDebugInfo",
            "Flag to specify if debug info to rss evaluators shall be plotted",
            False]

        self.draw_rss_safety_responses = params["Visualization"]["Evaluation"][
            "DrawRssSafetyResponses",
            "Flag to specify if visualizating rss safety responses.", False]

        self._draw_ego_rss_safety_responses = params["Visualization"][
            "Evaluation"][
                "DrawEgoRSSSafetyResponses",
                "Flag to specify if visualizating rss safety responses.",
                False]
        self._rss_min_braking_distances = params["Visualization"][
            "Evaluation"][
                "DrawMinRSSBrakingDistances",
                "Flag whether the min. braking distances shall be plotted.",
                False]

        self.parameters = params
        self.agent_color_map = {}
        self.max_agents_color_map = 0

        self.use_world_bounds = kwargs.pop("use_world_bounds", False)
        self.follow_agent_id = kwargs.pop("follow_agent_id", None)

        self.center = kwargs.pop("center", np.array([0, 0]))

        self.world_x_range = kwargs.pop("x_range", np.array([-40, 40]))
        self.world_y_range = kwargs.pop("y_range", np.array([-40, 40]))

        self.enforce_x_length = kwargs.pop("enforce_x_length", True)
        self.enforce_y_length = kwargs.pop("enforce_y_length", False)
        self.x_length = kwargs.pop("x_length",
                                   np.sum(np.absolute(self.world_x_range)))
        self.y_length = kwargs.pop("y_length",
                                   np.sum(np.absolute(self.world_y_range)))

        self.dynamic_world_x_range = self.world_x_range.copy()
        self.dynamic_world_y_range = self.world_y_range.copy()
コード例 #3
0
ファイル: viewer.py プロジェクト: bark-simulator/bark
 def __init__(self, params=None, **kwargs):
     if (params is None):
         params = ParameterServer()
     Viewer.__init__(self)
     self.initialize_params(params, kwargs)