You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current code for BaseMujocoEnv requires the env metadata dictionary to have fixed, pre-specified values. While this may be useful for future API changes, it doesn't seem very useful at the moment.
assert self.metadata["render_modes"] == [
"human",
"rgb_array",
"depth_array",
], self.metadata["render_modes"]
if "render_fps" in self.metadata:
assert (
int(np.round(1.0 / self.dt)) == self.metadata["render_fps"]
), f'Expected value: {int(np.round(1.0 / self.dt))}, Actual value: {self.metadata["render_fps"]}'
I propose to set the metadata attribute in BaseMujocoEnv to the current fixed values
This will enable classes derived from MujocoEnv to overwrite the dictionary (if required, in the future), but it will not force them to write an explicit metadata dictionary if the default values suffice, reducing redundancy and making derived classes more compact and readable.
Motivation
No response
Pitch
No response
Alternatives
No response
Additional context
No response
Checklist
I have checked that there is no similar issue in the repo
The text was updated successfully, but these errors were encountered:
The current implementation is to enable definition of metadata["render_fps"] after MujocoEnv.__init__ (see how Ant_v4 and Ant_v5 define metadata for example), if your proposal does not break anything, feel free to make a PR
Perfect, I have sent a pull request. The pull request avoids breaking the existing behavior by defining default metadata as class attribute, and then setting render_fps dynamically (as a function of self.dt) only if the key has not been overridden by a child class.
Proposal
The current code for BaseMujocoEnv requires the env metadata dictionary to have fixed, pre-specified values. While this may be useful for future API changes, it doesn't seem very useful at the moment.
I propose to set the metadata attribute in BaseMujocoEnv to the current fixed values
This will enable classes derived from MujocoEnv to overwrite the dictionary (if required, in the future), but it will not force them to write an explicit metadata dictionary if the default values suffice, reducing redundancy and making derived classes more compact and readable.
Motivation
No response
Pitch
No response
Alternatives
No response
Additional context
No response
Checklist
The text was updated successfully, but these errors were encountered: