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] Support custom width, height, and scene geometries in the MuJoCo renderer #730

Closed
1 task done
guyazran opened this issue Oct 2, 2023 · 7 comments · Fixed by #731
Closed
1 task done
Labels
enhancement New feature or request

Comments

@guyazran
Copy link
Contributor

guyazran commented Oct 2, 2023

Proposal

I want to add the option to choose the width and height of the offscreen renderer outputs individually and not rely on the visual settings in the XML. I also want to be able to control the maxgeom limit set in the base renderer class.

Motivation

The window viewer implementation for mujoco rendering in gymnasium is the best one out there. But using this viewer and another viewer for offscreen rendering yields glfw errors. The offscreen viewer class implementation has two flaws that prevent me from using it in my project:

  1. offscreen renderers have dimensions that are specific to the visual settings in the XML.
  2. the maxgeom setting is at a low 1000 and my scenes are very cluttered.

Pitch

  1. support for offscreen renderers to use specific height and width, similar to the mujoco.Renderer class.
  2. control the maxgeom setting when creating the scene object in the base viewer class.

Alternatives

No response

Additional context

I have a pull request lined up with the required implementation that I will upload shortly

Checklist

  • I have checked that there is no similar issue in the repo
@Kallinteris-Andreas
Copy link
Collaborator

  1. what MuJoCo Model are you running
  2. MuJuCo environments already have height and width arguments

@guyazran
Copy link
Contributor Author

guyazran commented Oct 3, 2023

  1. You mean XML model? we use our own custom model
  2. yes, but if I want to render multiple cameras then I cannot control their resolution independently

@Kallinteris-Andreas
Copy link
Collaborator

Kallinteris-Andreas commented Oct 3, 2023

  1. are you using your own custom MuJocoEnv class?
  2. the Gymnasium API does not support multiple render view ports (i. e. multiple cameras), render() returns a single image not a list of images

@guyazran
Copy link
Contributor Author

guyazran commented Oct 3, 2023

  1. yes
  2. I have a fetch robot with a camera on its head and another bird's-eye view camera. both cameras are a part of the observation space and have different resolutions. is this not possible?

@Kallinteris-Andreas
Copy link
Collaborator

Kallinteris-Andreas commented Oct 3, 2023

2. Unfortunately the current API does not support, multiple cameras (and by extension not multiple cameras with different resolutions)

The API we should probably extend it to support that (we have gotten few requests for that)

Never mind my previous comments regarding the gymnasium API not supporting multiple camera, that was wrong sorry (

width: int = DEFAULT_SIZE,
)

That being said the MuJoCo renderer does not currently support that feature, that should be patched in

  1. do you want to use both your cameras with rgb_array

@guyazran
Copy link
Contributor Author

guyazran commented Oct 3, 2023

  1. currently yes, but in the future I would like to also use depth, and even segmentation images.

@guyazran
Copy link
Contributor Author

guyazran commented Oct 3, 2023

here is an example use-case: example.zip

I ran this on MacOS 14.0 via anaconda python version 3.11. This uses the code from my pull request #731, installed using the provided environment.yml file. with the PR code, feature works as expected

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

Successfully merging a pull request may close this issue.

2 participants