Commit 9bd9e382 authored by jameskrw's avatar jameskrw
Browse files

added info masking for vlm

parent 67185634
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -108,7 +108,7 @@ class PrimitiveSkillEnv(BaseEnv):
    
    
    def _render(self,info,init_obs=False,valid_actions=None):
        new_info=handle_info(info.copy(),mask_success=self.config.mask_success)
        new_info=handle_info(info.copy(),mask_success=self.config.mask_success,env=self.env)
        object_positions=new_info['obj_positions']
        other_information=new_info['other_info']
        instruction=self.env.instruction()
+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ class AlignTwoCubeEnv(BaseEnv):
    SUPPORTED_ROBOTS = ["panda", "xmate3_robotiq", "fetch"]
    agent: Union[Panda, Xmate3Robotiq, Fetch]
    skill_config=None
    vlm_info_keys=[]

    def __init__(self, stage=0,*args, robot_uids="panda", robot_init_qpos_noise=0.02, **kwargs):
        self.stage=stage
+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ class PlaceTwoCubeEnv(BaseEnv):
    SUPPORTED_ROBOTS = ["panda", "xmate3_robotiq", "fetch"]
    agent: Union[Panda, Xmate3Robotiq, Fetch]
    skill_config=None
    vlm_info_keys=[]

    def __init__(self, stage=0,*args, robot_uids="panda", robot_init_qpos_noise=0.02, **kwargs):
        self.stage=stage
+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ from collections import defaultdict
class PutAppleInDrawerEnv(BaseEnv):
    SUPPORTED_ROBOTS = ["panda", "xmate3_robotiq", "fetch"]
    agent: Union[Panda, Xmate3Robotiq, Fetch]

    vlm_info_keys=["drawer_open_value"]
    # Asset configuration and constants
    DRAWER_ASSET_ID = "partnet_mobility_cabinet"
    handle_types = ["prismatic"]  # We are interested in prismatic joints (drawers)
+3 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ class StackThreeCubeEnv(BaseEnv):
    SUPPORTED_ROBOTS = ["panda", "xmate3_robotiq", "fetch"]
    agent: Union[Panda, Xmate3Robotiq, Fetch]
    skill_config=None
    vlm_info_keys=['cube_size']

    def __init__(self, stage=0,*args, robot_uids="panda", robot_init_qpos_noise=0.02, **kwargs):
        self.stage=stage
@@ -145,7 +146,8 @@ class StackThreeCubeEnv(BaseEnv):
        def stage3_success(info):
            purple_not_grasped = ~info["is_purple_cube_grasped"]
            purple_on_red = (torch.linalg.norm(info["purple_cube_pos"][:2] - info["red_cube_pos"][:2]) < self.cube_size/2) and (info["purple_cube_pos"][2] > (info["red_cube_pos"][2] + self.cube_size/2))
            return purple_on_red and purple_not_grasped
            
            return purple_on_red and purple_not_grasped and stage1_success(info)
        
        info["stage0_success"] = stage0_success(info)
        info["stage1_success"] = stage1_success(info)
Loading