-
Notifications
You must be signed in to change notification settings - Fork 9
Update lerobot recorder #145
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
Changes from all commits
5a18d94
78c6495
3f2b303
536c17a
2cac45f
3d58d98
b659ad1
a1c2e4b
f2f9fd0
4926e1f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -164,21 +164,15 @@ def device(self) -> torch.device: | |||||||||||||||
|
|
||||||||||||||||
| @cached_property | ||||||||||||||||
| def single_observation_space(self) -> gym.spaces.Space: | ||||||||||||||||
| if self.num_envs == 1: | ||||||||||||||||
| return gym_utils.convert_observation_to_space(self._init_raw_obs) | ||||||||||||||||
| else: | ||||||||||||||||
| return gym_utils.convert_observation_to_space( | ||||||||||||||||
| self._init_raw_obs, unbatched=True | ||||||||||||||||
| ) | ||||||||||||||||
| return gym_utils.convert_observation_to_space( | ||||||||||||||||
| self._init_raw_obs, unbatched=True | ||||||||||||||||
| ) | ||||||||||||||||
|
|
||||||||||||||||
| @cached_property | ||||||||||||||||
| def observation_space(self) -> gym.spaces.Space: | ||||||||||||||||
| if self.num_envs == 1: | ||||||||||||||||
| return self.single_observation_space | ||||||||||||||||
| else: | ||||||||||||||||
| return gym.vector.utils.batch_space( | ||||||||||||||||
| self.single_observation_space, n=self.num_envs | ||||||||||||||||
| ) | ||||||||||||||||
| return gym_utils.convert_observation_to_space( | ||||||||||||||||
| self._init_raw_obs, unbatched=False | ||||||||||||||||
| ) | ||||||||||||||||
|
|
||||||||||||||||
| @cached_property | ||||||||||||||||
| def flattened_observation_space(self) -> gym.spaces.Box: | ||||||||||||||||
|
|
@@ -208,6 +202,11 @@ def action_space(self) -> gym.spaces.Space: | |||||||||||||||
| def elapsed_steps(self) -> Union[int, torch.Tensor]: | ||||||||||||||||
| return self._elapsed_steps | ||||||||||||||||
|
|
||||||||||||||||
| @property | ||||||||||||||||
| def has_sensors(self) -> bool: | ||||||||||||||||
| """Return whether the environment has sensors.""" | ||||||||||||||||
| return len(self.sensors) > 0 | ||||||||||||||||
|
|
||||||||||||||||
| def get_sensor(self, name: str, **kwargs) -> BaseSensor: | ||||||||||||||||
| """Get the sensor instance by name. | ||||||||||||||||
|
|
||||||||||||||||
|
|
@@ -576,10 +575,10 @@ def reset( | |||||||||||||||
| self.sim.reset_objects_state( | ||||||||||||||||
| env_ids=reset_ids, excluded_uids=self._detached_uids_for_reset | ||||||||||||||||
| ) | ||||||||||||||||
| self._elapsed_steps[reset_ids] = 0 | ||||||||||||||||
|
|
||||||||||||||||
| # Reset hook for user to perform any custom reset logic. | ||||||||||||||||
| self._initialize_episode(reset_ids, **options) | ||||||||||||||||
| self._elapsed_steps[reset_ids] = 0 | ||||||||||||||||
|
Comment on lines
579
to
+581
|
||||||||||||||||
| # Reset hook for user to perform any custom reset logic. | |
| self._initialize_episode(reset_ids, **options) | |
| self._elapsed_steps[reset_ids] = 0 | |
| # Reset elapsed steps for the environments being reset before initialization. | |
| self._elapsed_steps[reset_ids] = 0 | |
| # Reset hook for user to perform any custom reset logic. | |
| self._initialize_episode(reset_ids, **options) |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -178,6 +178,9 @@ def __init__(self, cfg: EmbodiedEnvCfg, **kwargs): | |||||||||||||||||
|
|
||||||||||||||||||
| super().__init__(cfg, **kwargs) | ||||||||||||||||||
|
|
||||||||||||||||||
| if self.cfg.dataset and not self.cfg.filter_dataset_saving: | ||||||||||||||||||
| self.dataset_manager = DatasetManager(self.cfg.dataset, self) | ||||||||||||||||||
yuecideng marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||
|
|
||||||||||||||||||
| self.episode_obs_buffer: Dict[int, List[EnvObs]] = { | ||||||||||||||||||
| i: [] for i in range(self.num_envs) | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
@@ -208,9 +211,6 @@ def _init_sim_state(self, **kwargs): | |||||||||||||||||
| if self.cfg.rewards: | ||||||||||||||||||
| self.reward_manager = RewardManager(self.cfg.rewards, self) | ||||||||||||||||||
|
|
||||||||||||||||||
| if self.cfg.dataset and not self.cfg.filter_dataset_saving: | ||||||||||||||||||
| self.dataset_manager = DatasetManager(self.cfg.dataset, self) | ||||||||||||||||||
|
|
||||||||||||||||||
| def _apply_functor_filter(self) -> None: | ||||||||||||||||||
| """Apply functor filters to the environment components based on configuration. | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
@@ -397,6 +397,7 @@ def _initialize_episode( | |||||||||||||||||
| ] | ||||||||||||||||||
|
|
||||||||||||||||||
| if successful_env_ids: | ||||||||||||||||||
|
|
||||||||||||||||||
|
||||||||||||||||||
Copilot
AI
Feb 21, 2026
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.
The removed log message "No successful episodes to save" provided useful debugging information when save operations are triggered but no data needs to be saved. Consider adding equivalent logging in the parent if-statement to maintain visibility into save operations, or document why this logging was removed.
| ) | |
| ) | |
| else: | |
| # Log when a save is requested but there are no successful episodes | |
| logger.debug( | |
| "Save requested but no successful episodes to save for env_ids=%s", | |
| env_ids_to_process, | |
| ) |
Uh oh!
There was an error while loading. Please reload this page.