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

Refactor to support expanded Simulator reset in RearrangeTask #2018

Merged
merged 2 commits into from
Aug 21, 2024

Conversation

aclegg3
Copy link
Contributor

@aclegg3 aclegg3 commented Aug 20, 2024

Motivation and Context

This PR aims to refactor RearrangeTask to support the expanded reset functionality from facebookresearch/habitat-sim#2451
Primary change: apply auto-sleep and handle articulated_agent base setting after expanded state reset

Context: previously the Simulator.reset() only set time to 0, so RearrangeTask code was able to leave the robot in place between reset and objects would stay sleeping (e.g. for benchmarking or idle scenarios). Now the objects are set to origin or scene_instance initial state and the reset logic must also handle initial state resetting and re-sleeping (since objects wake when moved).

How Has This Been Tested

Previously the hab2_benchmark test was failing due to regression because the robot was resetting to the origin inside a furniture and objects were awoken on initial reset.

I expect to see the CI pass to validate the change.

Types of changes

  • [Refactoring] Large changes to the code that improve its functionality or performance

Checklist

  • My code follows the code style of this project.
  • I have updated the documentation if required.
  • I have read the CONTRIBUTING document.
  • I have completed my CLA (see CONTRIBUTING)
  • I have added tests to cover my changes if required.

@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Aug 20, 2024
Copy link
Contributor

@0mdc 0mdc left a comment

Choose a reason for hiding this comment

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

LGTM.

@@ -243,8 +243,11 @@ def reset(self, episode: Episode, fetch_observations: bool = True):
self._is_episode_active = True

if self._should_place_articulated_agent:
# here we are randomizing the base pos and rotation if necessary
Copy link
Contributor

Choose a reason for hiding this comment

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

That config field name is ambiguous. It may be worth the trouble renaming (not in this PR).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, this part of the code is ripe for refactor

for agent_idx in range(self._sim.num_articulated_agents):
self._set_articulated_agent_start(agent_idx)
# here we are setting initial joint states and such from configs, if a configured fixed base start state was provided, it is set
self._sim.agents_mgr.post_obj_load_reconfigure()
Copy link
Contributor

Choose a reason for hiding this comment

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

Same with this method name.

@aclegg3 aclegg3 merged commit 4a23445 into main Aug 21, 2024
4 checks passed
@aclegg3 aclegg3 deleted the alex-08_20-expanded_reset_migration_rearrange branch August 21, 2024 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Do not delete this pull request or issue due to inactivity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants