-
Notifications
You must be signed in to change notification settings - Fork 505
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
[Feature] Adding human render to gym wrapper #944
[Feature] Adding human render to gym wrapper #944
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but we should have test for human render mode.
YES x 1000. |
I think a good first step is adding |
Ok, I added a test. Looks like pygame is already on CI. |
I do not think pygame cannot run on CI because there is no monitor. This will make this feature very hard to test on CI. Do you have suggestions? |
I will be using Mock to replace pygame in the test. This way I will avoid having to open the pygame window on the CI machine. It will also prevent having the pygame window open when testing locally, which would shift the cursor focus (would be unnecessarily distracting) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good, some light comments.
habitat/utils/gym_adapter.py
Outdated
self._screen = pygame.display.set_mode( | ||
[frame.shape[1], frame.shape[0]] | ||
) | ||
draw_frame = np.transpose(frame, (1, 0, 2)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's great to add a comment like (C, H, W) -> (H, C, W)
for transpose operations.
habitat/utils/gym_adapter.py
Outdated
) | ||
draw_frame = np.transpose(frame, (1, 0, 2)) | ||
draw_frame = pygame.surfarray.make_surface(draw_frame) | ||
self._screen.fill((0, 0, 0)) # type: ignore[attr-defined] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's avoid magic unnamed numerical consts:
self._screen.fill((0, 0, 0)) # type: ignore[attr-defined] | |
BLACK_COLOR = (0, 0, 0) | |
self._screen.fill(BLACK_COLOR) # type: ignore[attr-defined] |
* adding human render to gym wrapper * adding rendering to the test * adding logging to CI to debug the error * using moduleskip * mocking pygame to not have a pygame display during testing * reloading module * less verbose CI * removing useless method calls * changing the default to human for render just like the gym interface does * addressing comments Co-authored-by: vincentpierre <vincentpierre@users.noreply.github.com>
* adding human render to gym wrapper * adding rendering to the test * adding logging to CI to debug the error * using moduleskip * mocking pygame to not have a pygame display during testing * reloading module * less verbose CI * removing useless method calls * changing the default to human for render just like the gym interface does * addressing comments Co-authored-by: vincentpierre <vincentpierre@users.noreply.github.com>
Motivation and Context
HabRenderWrapper
since it seems it only adds extra metrics to the rendering (these metrics should be added to the task configuration if they are needed). Please adviseHow Has This Been Tested
Types of changes
Checklist