Skip to content

Commit

Permalink
UPGRADE: Adding franka-kitchen randomization to the RANDOM_ENTRY_POIN…
Browse files Browse the repository at this point in the history
…T. This is what was called RANDOMDESK_ENTRY_POINT in the R3M codebase. This randomization is important to study visual generalizaiton. Otherwise proprioception alone is enough to solve the tasks
  • Loading branch information
vikashplus committed Mar 15, 2023
1 parent 5e7e6b8 commit 93bc43b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions mj_envs/envs/multi_task/common/franka_kitchen_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,18 @@ def __init__(self, model_path, obsd_model_path=None, seed=None, **kwargs):

super()._setup(**kwargs)

def reset(self, reset_qpos=None, reset_qvel=None):
def reset(self, reset_qpos=None, reset_qvel=None, reset_franka_wrt_kitchen=True):
if reset_qpos is None:
reset_qpos = self.init_qpos.copy()
reset_qpos[self.robot_dofs] += (
0.05
* (self.np_random.uniform(size=len(self.robot_dofs)) - 0.5)
* (self.robot_ranges[:, 1] - self.robot_ranges[:, 0])
)
return super().reset(reset_qpos=reset_qpos, reset_qvel=reset_qvel)

# reset franka wrt kitchen
if reset_franka_wrt_kitchen:
bid = self.sim.model.body_name2id("chef")
self.sim.model.body_pos[bid] = np.array([0, 0, 1.8]) + self.np_random.uniform(-0.1, 0.1, (3,))

This comment has been minimized.

Copy link
@vikashplus

vikashplus Jun 29, 2023

Author Owner

BUG ALERT!
This change was introduced to add randomization in the kitchen envs by making the franka_base reposition wrt to the kitchen at every reset.

  • BUG: In our observations, ee_pos is present which provides global information about the grippers thereby also revealing the relative location between the kitchen and the robot.
  • IMPLICATIONS: For state-based envs, this isn't as problematic. But for visual envs, this is quite problematic as the information that is required for visual generalization is being leaked by the ee_pose.
    cc @ShahRutav
  • FIX: The proposed fix is to update the ee_pose to provide values relative to the Franka robot's base, instead of the global ee_pose

return super().reset(reset_qpos=reset_qpos, reset_qvel=reset_qvel)

0 comments on commit 93bc43b

Please sign in to comment.