I would like to create a controller for the gym Hopper environment. Therefore I would like to create a state/dynamics equation to use afterwards finite difference. This dynamic function should have an observation and action as input and the next state as output, so somewhat similar to this pseudo-code:

Code: Select all

```
def state_equation(observation, action):
env.set_state(observation) #THIS function is missing..
next_state, _, _, _ = env.step(action)
return next_state
```

I know that I can use following commands to save and restore a state but this doesn't help since I want to set the environment to a state given any observation without visiting and saving it before..

Code: Select all

```
stateId = p.saveState()
p.restoreState(stateId)
```

**So in the end my question is:**Is there any way to realize the dynamics function ? Or a solution to reset the environment with a given observation? Or any other advice to solve my problem?

Thank you very much in advance for any advice and kind regards !