Skip to content

Fix video saving bug for the first frame in data generation#199

Merged
yuecideng merged 1 commit intomainfrom
yueci/fix-record-camera
Mar 25, 2026
Merged

Fix video saving bug for the first frame in data generation#199
yuecideng merged 1 commit intomainfrom
yueci/fix-record-camera

Conversation

@yuecideng
Copy link
Contributor

Description

Small fix.

Type of change

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

Screenshots

Please attach before and after screenshots of the change if applicable.

Checklist

  • I have run the black . command to format the code base.
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • Dependencies have been updated, if applicable.

Copilot AI review requested due to automatic review settings March 25, 2026 06:12
@yuecideng yuecideng added the bug Something isn't working label Mar 25, 2026
@yuecideng yuecideng merged commit 33e0c40 into main Mar 25, 2026
6 checks passed
@yuecideng yuecideng deleted the yueci/fix-record-camera branch March 25, 2026 06:12
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes an episode-boundary condition in the camera recording event functor so the first frame of a new episode is not incorrectly saved into the previous episode’s video during data generation.

Changes:

  • Update the save-trigger condition in record_camera_data.__call__ to save recorded frames when elapsed_steps indicates a reset boundary.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 145 to 149
# TODO: the current implementation will lost the final episode frames recording.
# Check if the frames should be saved for the current episode
if env.elapsed_steps.sum().item() == len(env_ids) and len(self._frames) > 0:
if env.elapsed_steps.sum().item() == 0 and len(self._frames) > 0:
video_name = f"episode_{self._current_episode}_{self._name}"
images_to_video(self._frames, save_path, video_name, fps=20)
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

This bug fix changes the episode-boundary detection (saving when elapsed_steps sum is 0). Since this is easy to regress and the repo has event-functor tests, please add a small unit test that mocks/stubs images_to_video and verifies that when elapsed_steps==0, the previous episode frames are saved before appending the first frame of the new episode (i.e., first frame is not included in the previous video).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants