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

[Proposal] [FuncEnv] Add params argument to __init__ #905

Open
1 task done
Kallinteris-Andreas opened this issue Feb 3, 2024 · 3 comments
Open
1 task done

[Proposal] [FuncEnv] Add params argument to __init__ #905

Kallinteris-Andreas opened this issue Feb 3, 2024 · 3 comments
Labels
before-1.0 enhancement New feature or request

Comments

@Kallinteris-Andreas
Copy link
Collaborator

Kallinteris-Andreas commented Feb 3, 2024

Proposal

Currently, the __init__ function does not take the params argument, instead it takes the options argument

def __init__(self, options: dict[str, Any] | None = None):
"""Initialize the environment constants."""
self.__dict__.update(options or {})
self.default_params = self.get_default_params()

But the params of the environment are needed to initialize the object (such as to set observation_space member variable)

additional changes requirements:
get_default_params should be changed to not require the instantiation of the environment to be used as it will be required in __init__

def get_default_params(self, **kwargs) -> Params | None:
"""Get the default params."""
return None

to

 def get_default_params(**kwargs) -> Params | None: 
     """Get the default params.""" 
     return None

and update FunctionalJaxEnv(gym.Env) with that change

@RedTachyon

Motivation

I have been developing the MJX based environments and this is a requirement

Pitch

No response

Alternatives

If there is no need to the `options' argument, remove it

Additional context

Here are 2 examples of params I need for MJX

  1. xml_file indicates the file of the robot model to be used and sets up the internal MuJoCo model and everything else that depends on it like action and observation spaces

  2. exclude_current_positions_from_observation changes, how much of the state space is observable, it is need in __init__() to observation_space and later in observation()

Checklist

  • I have checked that there is no similar issue in the repo
@Kallinteris-Andreas Kallinteris-Andreas added the enhancement New feature or request label Feb 3, 2024
@Kallinteris-Andreas Kallinteris-Andreas changed the title [Proposal] Add params argument to FuncEnv [Proposal] [FuncEnv] Add params argument to __init__ Feb 3, 2024
@pulak-gautam
Copy link

Since 1.0 has been released, will this be worked on? I am in the same boat (writing MJX envs). Is there any workaround for now?

@Kallinteris-Andreas
Copy link
Collaborator Author

@pulak-gautam would you like to make a PR for this

@pulak-gautam
Copy link

Yes, more than happy to! I'll start working on it and submit the PR shortly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
before-1.0 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants