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

Setting environment seed #7

Open
joshua-a-harris opened this issue Apr 21, 2022 · 0 comments
Open

Setting environment seed #7

joshua-a-harris opened this issue Apr 21, 2022 · 0 comments

Comments

@joshua-a-harris
Copy link

Hi,

I was just wondering if I am missing an obvious way to set an environment seed so that the arm and rgb objects are initialised in a set position and with the same rgb object combinations / deformations for a given seed?

If not, I ve modified a local version of the code in the following ways that seems to have the desired effect - does this look about right or might this not replicate something?:

  1. To set the seed for the arm position I pass an np.random.RandomState(seed) object instance as an additional argument (i.e random_state=) when initialising the _base_env Environment object in subtask_env_builder.py in the lines here. This seems to work to get the arm to always start in the same place for a given seed.
  2. To fix the position of the rgb objects and the type / deformation of the rgb objects I needed to make two changes:
  • I needed to add a sort (RGB_OBJECTS_TRAIN_SET.sort()) below these lines where I think the valid object combinations are initialised. Without this the order of the valid object deformations seems to be somewhat random (I think I m probably missing setting another seed somewhere - but this seems to work as a patch).
  • Then I set np.random.seed(seed) (using the same random state as used in 1.) at some point before these lines where the specific objects seem to be chosen.
  1. One thing that is still slightly confusing me is how the above seeds when the environment is initialised feed through to the env.reset()?

Any thoughts on whether this should work / makes sense / if there is an easier way to do it would be really appreciated!

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