From e09a588e7780c5cd821c43eb2c47ebf135d5e452 Mon Sep 17 00:00:00 2001 From: Dominik Roth Date: Sat, 15 Oct 2022 11:16:13 +0200 Subject: [PATCH] Allow not clearing path on reset --- columbus/env.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/columbus/env.py b/columbus/env.py index 7f5bb92..e4fc218 100644 --- a/columbus/env.py +++ b/columbus/env.py @@ -45,7 +45,7 @@ def parseObs(obsConf): class ColumbusEnv(gym.Env): metadata = {'render.modes': ['human']} - def __init__(self, observable=observables.Observable(), fps=60, env_seed=3.1, master_seed=None, start_pos=(0.5, 0.5), start_score=0, speed_fac=0.01, acc_fac=0.04, die_on_zero=False, return_on_score=-1, reward_mult=1, agent_drag=0, controll_type='SPEED', aux_reward_max=1, aux_penalty_max=0, aux_reward_discretize=0, void_is_type_barrier=True, void_damage=1, torus_topology=False, default_collision_elasticity=1, terminate_on_reward=False, agent_draw_path=False, max_steps=-1): + def __init__(self, observable=observables.Observable(), fps=60, env_seed=3.1, master_seed=None, start_pos=(0.5, 0.5), start_score=0, speed_fac=0.01, acc_fac=0.04, die_on_zero=False, return_on_score=-1, reward_mult=1, agent_drag=0, controll_type='SPEED', aux_reward_max=1, aux_penalty_max=0, aux_reward_discretize=0, void_is_type_barrier=True, void_damage=1, torus_topology=False, default_collision_elasticity=1, terminate_on_reward=False, agent_draw_path=False, clear_path_on_reset=True, max_steps=-1): super(ColumbusEnv, self).__init__() self.action_space = spaces.Box( low=-1, high=1, shape=(2,), dtype=np.float32) @@ -90,6 +90,7 @@ class ColumbusEnv(gym.Env): self.default_collision_elasticity = default_collision_elasticity self.terminate_on_reward = terminate_on_reward self.agent_draw_path = agent_draw_path + self.clear_path_on_reset = clear_path_on_reset self.max_steps = max_steps self._steps = 0 @@ -281,7 +282,8 @@ class ColumbusEnv(gym.Env): self.setup() self.entities.append(self.agent) # add it last, will be drawn on top self.observable.reset() - self._reset_paths() + if self.clear_path_on_reset: + self._reset_paths() return self.observable.get_observation() def _reset_paths(self):