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

[Bugfix] [Rearrange] Reset the sensors positons correctly version 2 #952

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions habitat/tasks/rearrange/multi_task/composite_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,5 @@ def reset(self, episode: Episode):
if self._cur_node_idx >= 0:
self.jump_to_node(self._cur_node_idx, episode)

self._sim.maybe_update_robot()
return self._get_observations(episode)
13 changes: 11 additions & 2 deletions habitat/tasks/rearrange/rearrange_sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,8 +628,7 @@ def step(self, action: Union[str, int]) -> Observations:
add_back_viz_objs[name] = (before_pos, r)
self.viz_ids = defaultdict(lambda: None)

if self.habitat_config.UPDATE_ROBOT:
self.robots_mgr.update_robots()
self.maybe_update_robot()

if self.habitat_config.CONCUR_RENDER:
self._prev_sim_obs = self.start_async_render()
Expand Down Expand Up @@ -670,6 +669,16 @@ def step(self, action: Union[str, int]) -> Observations:

return obs

def maybe_update_robot(self):
"""
Calls the update robots method on the robot manager if the
`UPDATE_ROBOT` configuration is set to True. Among other
things, this will set the robot's sensors' positions to their new
positions.
"""
if self.habitat_config.UPDATE_ROBOT:
self.robots_mgr.update_robots()

def visualize_position(
self,
position: np.ndarray,
Expand Down
1 change: 1 addition & 0 deletions habitat/tasks/rearrange/rearrange_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ def reset(self, episode: Episode, fetch_observations: bool = True):
self._done = False
self._cur_episode_step = 0
if fetch_observations:
self._sim.maybe_update_robot()
return self._get_observations(episode)
else:
return None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ def reset(self, episode: Episode):
self.prev_dist_to_push = -1

self.prev_snapped_marker_name = None
self._sim.maybe_update_robot()
return self._get_observations(episode)

def _disable_art_sleep(self):
Expand Down
2 changes: 1 addition & 1 deletion habitat/tasks/rearrange/sub_tasks/nav_to_obj_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ def reset(self, episode: Episode):
sim.viz_ids["nav_targ_pos"],
r=0.2,
)

self._sim.maybe_update_robot()
return self._get_observations(episode)


Expand Down
1 change: 1 addition & 0 deletions habitat/tasks/rearrange/sub_tasks/pick_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,5 +283,6 @@ def reset(self, episode: Episode, fetch_observations: bool = True):
self._targ_idx = sel_idx

if fetch_observations:
self._sim.maybe_update_robot()
return self._get_observations(episode)
return None
1 change: 1 addition & 0 deletions habitat/tasks/rearrange/sub_tasks/place_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ def reset(self, episode: Episode):
self.was_prev_holding = self.targ_idx

sim.internal_step(-1)
self._sim.maybe_update_robot()
return self._get_observations(episode)
1 change: 1 addition & 0 deletions habitat/tasks/rearrange/sub_tasks/reach_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,5 @@ def reset(self, episode):
global_pos, self._sim.viz_ids["reach_target"]
)

self._sim.maybe_update_robot()
return self._get_observations(episode)