From 6fd31c7e1a038e49ffc5ae835fea3e85c760ce01 Mon Sep 17 00:00:00 2001 From: Ahmed El Sheikh Date: Sun, 25 Aug 2024 18:38:35 +0100 Subject: [PATCH] Ensure data is reloaded from prerun after env.reset() --- closed_loop_AFC/jet_cylinder/environment.py | 4 ++++ closed_loop_AFC/rotating_cylinder/environment.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/closed_loop_AFC/jet_cylinder/environment.py b/closed_loop_AFC/jet_cylinder/environment.py index 32e7ca3..277270b 100644 --- a/closed_loop_AFC/jet_cylinder/environment.py +++ b/closed_loop_AFC/jet_cylinder/environment.py @@ -249,6 +249,10 @@ def step(self, action): r"""Distribute the control action smoothly and linearly over `self.action_interval` simulation time steps.""" return self._smooth_step(action) + def reset(self, seed=None, options=None): + self._prerun_data_required = self._latest_available_sim_time > 0.0 + return super().reset(seed=seed, options=options) + def _get_action(self, action, write_var_list): acuation_interface_field = self._action_to_patch_field(action) write_data = { diff --git a/closed_loop_AFC/rotating_cylinder/environment.py b/closed_loop_AFC/rotating_cylinder/environment.py index 42c6be5..f7689a7 100644 --- a/closed_loop_AFC/rotating_cylinder/environment.py +++ b/closed_loop_AFC/rotating_cylinder/environment.py @@ -240,6 +240,10 @@ def step(self, action): r"""Distribute the control action smoothly and linearly over `self.action_interval` simulation time steps.""" return self._smooth_step(action) + def reset(self, seed=None, options=None): + self._prerun_data_required = self._latest_available_sim_time > 0.0 + return super().reset(seed=seed, options=options) + def _get_action(self, action, write_var_list): acuation_interface_field = self._action_to_patch_field(action) write_data = {