Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

numpy random state varies after PR2() is called #54

Open
HiroIshida opened this issue Mar 2, 2024 · 0 comments
Open

numpy random state varies after PR2() is called #54

HiroIshida opened this issue Mar 2, 2024 · 0 comments

Comments

@HiroIshida
Copy link
Owner

HiroIshida commented Mar 2, 2024

As PR2() function is supposed to behave deterministically, the hash value of the random state should not change.

import hashlib
import pickle
import numpy as np
from skrobot.models.pr2 import PR2

for _ in range(4):
    pr2 = PR2()
    print(f"hash {hashlib.sha256(pickle.dumps(np.random.get_state())).hexdigest()}")

However, ...

h-ishida@azarashi:~/Dropbox/paper_writing/tro2024/benchmark2/moving_pr2_minifridge_sqp$ python3 hoge.py 
/home/h-ishida/python/scikit-robot/skrobot/model/robot_model.py:1721: UserWarning: texture specified in URDF is not supported
  warnings.warn(
hash 2024fb2f4db1d7ebdd72ab0628173e117c33d60eb6f916a2ce3de6536abc2832
hash 123437b8a64fbfc1dba8c82135f36f59fcd3bc4e76131a62e28871063905bc28
hash cc0aa4612ae4d9feebe20f6d912fa0d92e607fe228ab91e8853a70ee053f837d
hash 05924ab4d0eedc50dfd60e50d7c99f7aa8e12bec054651eb64740847eb848f31

Inserting hash evaluation snippets inside skrobot's urdf parsing part, I found that trimesh smells.
Screenshot from 2024-03-03 03-00-27

Yes, trimesh.apply_transform seemingly change the random state
image

Found it. This is called by mesh.apply_transform.
https://github.com/mikedh/trimesh/blob/b9f82a52d4f804220cb8829872dea9ba04fd6f82/trimesh/transformations.py#L2290

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant