Skip to content

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

@Kallinteris-Andreas

Description

@Kallinteris-Andreas

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

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions