hydrogym icon indicating copy to clipboard operation
hydrogym copied to clipboard

Actuators Set to Zero on env.reset()

Open nzolman opened this issue 2 years ago • 0 comments

Not sure that this is a bug exactly, but thought it should be documented/discussed. If you save a FlowConfig (firedrake) checkpoint where the actuators are not zero and load the checkpoint, the actuators are initialized to the values when they were saved at. However, if this is in a FlowEnv and env.reset() is run, the actuators are set to zero. I would have expected these to be reset to the value the flow was loaded with.

Pseudo-code:

# original environment
env = FlowEnv(config)
env.reset()

action = random_action()
env.step(action)

# non-zero
actuator_states = [actuator.u.values() for actuator in env.flow.actuators]

env.flow.save_checkpoint('/path/to/checkpoint/')

# load the checkpoint into a new FlowEnv
new_config = {'...', 'flow_config': {'restart': '/path/to/checkpoint/'}}
loaded_env = FlowEnv(config)

# same as before the save
loaded_actuator_states = [actuator.u.values() for actuator in loaded_env.flow.actuators]

# These are set to zero.
loaded_env.reset()
reset_actuator_states = [actuator.u.values() for actuator in loaded_env.flow.actuators]

I'm using the latest version on main (commit 38826f43cbc9ef71ca2b66be89ae7b78549522ce)

nzolman avatar Oct 14 '23 20:10 nzolman