def _get_step_return(self, actions, engine_info):
        """Add goal-dependent observation to the info dict."""
        o, r, tm, tc, i = super(MultiGoalIntersectionEnvBase, self)._get_step_return(actions, engine_info)

        if self.config["use_multigoal_intersection"]:
            for goal_name in self.engine.goal_manager.goals.keys():
                navi = self.engine.goal_manager.get_navigation(goal_name)
                goal_obs = self.observations["default_agent"].observe(self.agents[DEFAULT_AGENT], navi)
                i["obs/goals/{}".format(goal_name)] = goal_obs
            assert r == i["reward/default_reward"]
            assert i["route_completion"] == i["route_completion/goals/default"]

        else:
            i["obs/goals/default"] = self.observations["default_agent"].observe(self.agents[DEFAULT_AGENT])
        return o, r, tm, tc, i
Add goal-dependent observation to the info dict.
metadrive/envs/multigoal_intersection.py