def reset_env(env):
    """Resets the pendulum in the safe area."""
    env.reset()
    env.env.state = env.np_random.uniform(low=[-0.1, -0.5], high=[0.1, 0.5])
    env.env.last_u = None
    return env.env._get_obs()