matrpo/trainer/matrpo.py
def make_env(self, scenario_id, seed, logger_dir, reward_scale, info_keywords, mpi_rank=0, subrank=0):
        """
        Create a wrapped, monitored gym.Env for safety.
        """
        scenario = scenarios.load('{}.py'.format(scenario_id)).Scenario()
        if not hasattr(scenario, 'post_step'): scenario.post_step = None
        world = scenario.make_world()
        env_dict = {
            "world": world,
            'reset_callback': scenario.reset_world,
            'reward_callback': scenario.reward, 
            'observation_callback': scenario.observation,
            'post_step_callback': scenario.post_step,
            'info_callback': scenario.benchmark_data,
            'shared_viewer':  True,
            }
        env = gym.make(self.env_id, **env_dict)
        env.seed(seed + subrank if seed is not None else None)
        env = Monitor(env,
                    logger_dir and os.path.join(logger_dir, str(mpi_rank) + '.' + str(subrank)),
                    allow_early_resets=True,
                    info_keywords=info_keywords)
        env = ClipActionsWrapper(env)
        if reward_scale != 1.0:
            from baselines.common.retro_wrappers import RewardScaler
            env = RewardScaler(env, reward_scale)
        return env

        Create a wrapped, monitored gym.Env for safety.
        
Create a wrapped, monitored gym.Env for safety.
Create a wrapped monitored gym . Env for safety .
def make_env(self, scenario_id, seed, logger_dir, reward_scale, info_keywords, mpi_rank=0, subrank=0):
        scenario = scenarios.load('{}.py'.format(scenario_id)).Scenario()
        if not hasattr(scenario, 'post_step'): scenario.post_step = None
        world = scenario.make_world()
        env_dict = {
            "world": world,
            'reset_callback': scenario.reset_world,
            'reward_callback': scenario.reward, 
            'observation_callback': scenario.observation,
            'post_step_callback': scenario.post_step,
            'info_callback': scenario.benchmark_data,
            'shared_viewer':  True,
            }
        env = gym.make(self.env_id, **env_dict)
        env.seed(seed + subrank if seed is not None else None)
        env = Monitor(env,
                    logger_dir and os.path.join(logger_dir, str(mpi_rank) + '.' + str(subrank)),
                    allow_early_resets=True,
                    info_keywords=info_keywords)
        env = ClipActionsWrapper(env)
        if reward_scale != 1.0:
            from baselines.common.retro_wrappers import RewardScaler
            env = RewardScaler(env, reward_scale)
        return env
def make_env ( self , scenario_id , seed , logger_dir , reward_scale , info_keywords , mpi_rank = 0 , subrank = 0 ) : scenario = scenarios . load ( '{}.py' . format ( scenario_id ) ) . Scenario ( ) if not hasattr ( scenario , 'post_step' ) : scenario . post_step = None world = scenario . make_world ( ) env_dict = { "world" : world , 'reset_callback' : scenario . reset_world , 'reward_callback' : scenario . reward , 'observation_callback' : scenario . observation , 'post_step_callback' : scenario . post_step , 'info_callback' : scenario . benchmark_data , 'shared_viewer' : True , } env = gym . make ( self . env_id , ** env_dict ) env . seed ( seed + subrank if seed is not None else None ) env = Monitor ( env , logger_dir and os . path . join ( logger_dir , str ( mpi_rank ) + '.' + str ( subrank ) ) , allow_early_resets = True , info_keywords = info_keywords ) env = ClipActionsWrapper ( env ) if reward_scale != 1.0 : from baselines . common . retro_wrappers import RewardScaler env = RewardScaler ( env , reward_scale ) return env
Create a wrapped, monitored gym.Env for safety.
Create a wrapped monitored gym . Env for safety .
"""
        Create a wrapped, monitored gym.Env for safety.
        """
self
scenario_id
seed
logger_dir
reward_scale
info_keywords
mpi_rank
subrank