Allow not clearing path on reset

This commit is contained in:
Dominik Moritz Roth 2022-10-15 11:16:13 +02:00
parent 61160c8595
commit e09a588e77

View File

@ -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,6 +282,7 @@ class ColumbusEnv(gym.Env):
self.setup()
self.entities.append(self.agent) # add it last, will be drawn on top
self.observable.reset()
if self.clear_path_on_reset:
self._reset_paths()
return self.observable.get_observation()