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

Defaults the gym video recorder fps to match episode decimation #894

Conversation

ozhanozen
Copy link
Contributor

Sets the "render_fps" metadata used by the gym.wrappers.RecordVideo such that, if it is used, the produced video will have the correct episode length (i.e., the environment in the video will play at the correct speed).

The correct render_fps should be equal to 1 / (self.cfg.decimation * self.cfg.sim.dt) which I integrated to the init function of the ManagerBasedRLEnv. This seems to work well.

Fixes #892

Type of change

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

Screenshots

Screenshot 2024-08-28 at 18 10 30

Checklist

  • I have run the pre-commit checks with ./isaaclab.sh --format
  • 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
  • I have updated the changelog and the corresponding version in the extension's config/extension.toml file
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

Copy link
Contributor

@Mayankm96 Mayankm96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Mayankm96 Mayankm96 changed the title Defaults the gym video recorder fps to match episode length Defaults the gym video recorder fps to match episode decimation Aug 29, 2024
@ozhanozen
Copy link
Contributor Author

Thanks a lot for the fix! Could you please also add it here?

https://github.com/isaac-sim/IsaacLab/blob/main/source/extensions/omni.isaac.lab/omni/isaac/lab/envs/direct_rl_env.py#L186-L188

I have added.

Also, I have changed the code comment slightly to this:
# -- set the framerate of the gym video recorder wrapper so that the playback speed of the produced video matches the simulation

ozhanozen and others added 2 commits August 29, 2024 14:13
Co-authored-by: Mayank Mittal <12863862+Mayankm96@users.noreply.github.com>
Signed-off-by: Özhan Özen <41010165+ozhanozen@users.noreply.github.com>
Co-authored-by: Mayank Mittal <12863862+Mayankm96@users.noreply.github.com>
Signed-off-by: Özhan Özen <41010165+ozhanozen@users.noreply.github.com>
@Mayankm96 Mayankm96 merged commit 8fcbf85 into isaac-sim:main Aug 29, 2024
1 of 2 checks passed
@ozhanozen ozhanozen deleted the fix/video-recorder-fps branch August 29, 2024 15:23
iamdrfly pushed a commit to iamdrfly/IsaacLab that referenced this pull request Nov 21, 2024
…c-sim#894)

Sets the "render_fps" metadata used by the gym.wrappers.RecordVideo such
that, if it is used, the produced video will have the correct episode
length (i.e., the environment in the video will play at the correct
speed).

The correct render_fps should be equal to `1 / (self.cfg.decimation *
self.cfg.sim.dt)` which I integrated to the init function of the
ManagerBasedRLEnv. This seems to work well.

Fixes isaac-sim#892

## Type of change

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

## Screenshots

<img width="1048" alt="Screenshot 2024-08-28 at 18 10 30"
src="https://github.com/user-attachments/assets/d4fd8482-fbbc-48fa-8890-6a75a3fd99dc">

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
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] The length of the video from gym.wrappers.RecordVideo does not match the episode length
2 participants