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

Fix rendering bug by setting frame height and width #236

Merged
merged 1 commit into from
Oct 13, 2024

Conversation

violasox
Copy link
Contributor

Description

Gymnasium 1.0.0 added the width and height parameters to the initialization method of the MujocoRenderer class. If no values are passed in, they default to None and this causes rendering to fail when the render_mode is set to rgb_array (at least for onscreen rendering). This fix passes the height and width parameters in the BaseRobotEnv class to the MujocoRenderer in robot_env.py, resolving the issue.

Fixes #235

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have run the pre-commit checks with pre-commit run --all-files (see CONTRIBUTING.md instructions to set it up)
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@Kallinteris-Andreas
Copy link
Collaborator

Could you please add the tests that runs all of the gymnasium robotics environments and passes the width and height arguments?

@violasox
Copy link
Contributor Author

violasox commented Oct 11, 2024

It looks like test_render_modes already tests this, and I just confirmed that my fix causes the number of failures on these tests to go from 118 to 54 (the remaining failed tests seem to be because the AntMaze environments can't be loaded, which should maybe be a separate bug report...). It seems like these tests are being skipped in the build?

Edit - If you mean adding passing the height and width parameters when making the environments and testing that the rendered image has the right shape, I'd be happy to update the tests to do this

@Kallinteris-Andreas
Copy link
Collaborator

Sorry for being late, had to fix a few bugs, please merge main then I can accept the PR, Thanks!

it should be fine to not test image size, since it is already tested in MujocoRenderer

@Kallinteris-Andreas Kallinteris-Andreas merged commit 6076f05 into Farama-Foundation:main Oct 13, 2024
5 of 6 checks passed
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

Successfully merging this pull request may close these issues.

[Bug Report] Rendering issue for rgb_array render mode with gymnasium 1.0.0
2 participants