ManiSkill icon indicating copy to clipboard operation
ManiSkill copied to clipboard

ManiSkill1 environments when resetting state have some discrepancies

Open StoneT2000 opened this issue 2 years ago • 0 comments

The pytest that shows this is

@pytest.mark.parametrize("env_id", ENV_IDS)
def test_states(env_id):
    env: BaseEnv = gym.make(env_id)
    obs, _ = env.reset(seed=1000)
    for _ in range(5):
        env.step(env.action_space.sample())
    state = env.get_state()
    obs = env.get_obs()

    for _ in range(50):
        env.step(env.action_space.sample())
    env.set_state(state)
    new_obs = env.get_obs()
    assert_obs_equal(obs, new_obs)
    env.close()
    del env

Unsure atm but for ManiSkill1 environments (e.g. PushChair-v1) there are small relative errors in the observations after resetting state. E.g.

>           np.testing.assert_allclose(obs1, obs2, atol=1e-4)
E           AssertionError: 
E           Not equal to tolerance rtol=1e-07, atol=0.0001
E           
E           Mismatched elements: 7 / 98 (7.14%)
E           Max absolute difference: 0.00044608
E           Max relative difference: 0.00028641
E            x: array([ 5.143180e-01,  4.199232e-01,  3.623223e-01, -9.103211e-02,
E                  -1.746987e+00,  1.357906e-01,  3.096418e+00,  9.557973e-01,
E                   2.220907e-02,  2.210767e-02,  1.046590e-01,  1.807972e-02,...
E            y: array([ 5.143180e-01,  4.199232e-01,  3.623223e-01, -9.103211e-02,
E                  -1.746987e+00,  1.357906e-01,  3.096418e+00,  9.557973e-01,
E                   2.220907e-02,  2.210767e-02,  1.046590e-01,  1.807972e-02,...

tests/utils.py:92: AssertionError

StoneT2000 avatar Aug 03 '23 22:08 StoneT2000