robosuite_task_zoo/environments/manipulation/tool_use.py
def _load_model(self):
        """
        Loads an xml model, puts it in self.model
        """
        super()._load_model()

        # Adjust base pose accordingly
        xpos = self.robots[0].robot_model.base_xpos_offset["table"](self.table_full_size[0])
        self.robots[0].robot_model.set_base_xpos(xpos)

        # load model for table top workspace
        mujoco_arena = TableArena(
            table_full_size=self.table_full_size,
            table_offset=self.table_offset,
            table_friction=(0.6, 0.005, 0.0001)
        )

        # Arena always gets set to zero origin
        mujoco_arena.set_origin([0, 0, 0])

        # Modify default agentview camera
        mujoco_arena.set_camera(
            camera_name="agentview",
            pos=[0.5386131746834771, -4.392035683362857e-09, 1.4903500240372423],
            quat=[0.6380177736282349, 0.3048497438430786, 0.30484986305236816, 0.6380177736282349]
        )

        mujoco_arena.set_camera(
            camera_name="sideview",
            pos=[0.5586131746834771, 0.3, 1.2903500240372423],
            quat=[0.4144233167171478, 0.3100920617580414,
            0.49641484022140503, 0.6968992352485657]
        )
        
        
        # initialize objects of interest
        darkwood = CustomMaterial(
            texture="WoodDark",
            tex_name="darkwood",
            mat_name="MatDarkWood",
            tex_attrib={"type": "cube"},
            mat_attrib={"texrepeat": "3 3", "specular": "0.4","shininess": "0.1"}
        )

        metal = CustomMaterial(
            texture="Metal",
            tex_name="metal",
            mat_name="MatMetal",
            tex_attrib={"type": "cube"},
            mat_attrib={"specular": "1", "shininess": "0.3", "rgba": "0.9 0.9 0.9 1"}
        )

        tex_attrib = {
            "type": "cube"
        }

        mat_attrib = {
            "texrepeat": "1 1",
            "specular": "0.4",
            "shininess": "0.1"
        }
        
        greenwood = CustomMaterial(
            texture="WoodGreen",
            tex_name="greenwood",
            mat_name="greenwood_mat",
            tex_attrib=tex_attrib,
            mat_attrib=mat_attrib,
        )
        redwood = CustomMaterial(
            texture="WoodRed",
            tex_name="redwood",
            mat_name="MatRedWood",
            tex_attrib=tex_attrib,
            mat_attrib=mat_attrib,
        )
        
        bluewood = CustomMaterial(
            texture="WoodBlue",
            tex_name="bluewood",
            mat_name="handle1_mat",
            tex_attrib={"type": "cube"},
            mat_attrib={"texrepeat": "1 1", "specular": "0.4", "shininess": "0.1"},
        )

        ceramic = CustomMaterial(
            texture="Ceramic",
            tex_name="ceramic",
            mat_name="MatCeramic",
            tex_attrib=tex_attrib,
            mat_attrib=mat_attrib,
        )

        ingredient_size = [0.02, 0.025, 0.02]
        self.cube = BoxObject(
            name="cube_bread",
            size_min=ingredient_size,
            size_max=ingredient_size,
            rgba=[1, 0, 0, 1],
            material=bluewood,
            density=500.,
        )
        
        self.lshape_tool = LShapeTool(
            name="LShapeTool",
        )
        self.pot_object = PotObject(
            name="PotObject",
        )
        pot_object = self.pot_object.get_obj(); pot_object.set("pos", array_to_string((0.0, 0.18, self.table_offset[2] + 0.05)))


        self.placement_initializer = SequentialCompositeSampler(name="ObjectSampler")
        
        # Create placement initializer
        self.placement_initializer.append_sampler(
        sampler = UniformRandomSampler(
            name="ObjectSampler-cube",
            mujoco_objects=self.cube,
            x_range=self.cube_x_range,
            y_range=self.cube_y_range,
            rotation=self.cube_rotation_range,
            rotation_axis='z',
            ensure_object_boundary_in_range=False,
            ensure_valid_placement=True,
            reference_pos=self.table_offset,
            z_offset=0.01,
        ))

        self.placement_initializer.append_sampler(
        sampler = UniformRandomSampler(
            name="ObjectSampler-lshape",
            mujoco_objects=self.lshape_tool,
            x_range=self.tool_x_range,
            y_range=self.tool_y_range,
            rotation=self.tool_rotation_range,
            rotation_axis='z',
            ensure_object_boundary_in_range=False,
            ensure_valid_placement=True,
            reference_pos=self.table_offset,
            z_offset=0.02,
        ))
        
        mujoco_objects = [
            self.pot_object,
            self.cube,
            self.lshape_tool
        ]

        # task includes arena, robot, and objects of interest
        self.model = ManipulationTask(
            mujoco_arena=mujoco_arena,
            mujoco_robots=[robot.robot_model for robot in self.robots], 
            mujoco_objects=mujoco_objects,
        )
        self.objects = [
            self.pot_object,
            self.cube,
            self.lshape_tool
        ]

        Loads an xml model, puts it in self.model
        
Loads an xml model, puts it in self.model
Loads an xml model puts it in self . model
def _load_model(self):
        super()._load_model()
        xpos = self.robots[0].robot_model.base_xpos_offset["table"](self.table_full_size[0])
        self.robots[0].robot_model.set_base_xpos(xpos)
        mujoco_arena = TableArena(
            table_full_size=self.table_full_size,
            table_offset=self.table_offset,
            table_friction=(0.6, 0.005, 0.0001)
        )
        mujoco_arena.set_origin([0, 0, 0])
        mujoco_arena.set_camera(
            camera_name="agentview",
            pos=[0.5386131746834771, -4.392035683362857e-09, 1.4903500240372423],
            quat=[0.6380177736282349, 0.3048497438430786, 0.30484986305236816, 0.6380177736282349]
        )
        mujoco_arena.set_camera(
            camera_name="sideview",
            pos=[0.5586131746834771, 0.3, 1.2903500240372423],
            quat=[0.4144233167171478, 0.3100920617580414,
            0.49641484022140503, 0.6968992352485657]
        )
        darkwood = CustomMaterial(
            texture="WoodDark",
            tex_name="darkwood",
            mat_name="MatDarkWood",
            tex_attrib={"type": "cube"},
            mat_attrib={"texrepeat": "3 3", "specular": "0.4","shininess": "0.1"}
        )
        metal = CustomMaterial(
            texture="Metal",
            tex_name="metal",
            mat_name="MatMetal",
            tex_attrib={"type": "cube"},
            mat_attrib={"specular": "1", "shininess": "0.3", "rgba": "0.9 0.9 0.9 1"}
        )
        tex_attrib = {
            "type": "cube"
        }
        mat_attrib = {
            "texrepeat": "1 1",
            "specular": "0.4",
            "shininess": "0.1"
        }
        greenwood = CustomMaterial(
            texture="WoodGreen",
            tex_name="greenwood",
            mat_name="greenwood_mat",
            tex_attrib=tex_attrib,
            mat_attrib=mat_attrib,
        )
        redwood = CustomMaterial(
            texture="WoodRed",
            tex_name="redwood",
            mat_name="MatRedWood",
            tex_attrib=tex_attrib,
            mat_attrib=mat_attrib,
        )
        bluewood = CustomMaterial(
            texture="WoodBlue",
            tex_name="bluewood",
            mat_name="handle1_mat",
            tex_attrib={"type": "cube"},
            mat_attrib={"texrepeat": "1 1", "specular": "0.4", "shininess": "0.1"},
        )
        ceramic = CustomMaterial(
            texture="Ceramic",
            tex_name="ceramic",
            mat_name="MatCeramic",
            tex_attrib=tex_attrib,
            mat_attrib=mat_attrib,
        )
        ingredient_size = [0.02, 0.025, 0.02]
        self.cube = BoxObject(
            name="cube_bread",
            size_min=ingredient_size,
            size_max=ingredient_size,
            rgba=[1, 0, 0, 1],
            material=bluewood,
            density=500.,
        )
        self.lshape_tool = LShapeTool(
            name="LShapeTool",
        )
        self.pot_object = PotObject(
            name="PotObject",
        )
        pot_object = self.pot_object.get_obj(); pot_object.set("pos", array_to_string((0.0, 0.18, self.table_offset[2] + 0.05)))
        self.placement_initializer = SequentialCompositeSampler(name="ObjectSampler")
        self.placement_initializer.append_sampler(
        sampler = UniformRandomSampler(
            name="ObjectSampler-cube",
            mujoco_objects=self.cube,
            x_range=self.cube_x_range,
            y_range=self.cube_y_range,
            rotation=self.cube_rotation_range,
            rotation_axis='z',
            ensure_object_boundary_in_range=False,
            ensure_valid_placement=True,
            reference_pos=self.table_offset,
            z_offset=0.01,
        ))
        self.placement_initializer.append_sampler(
        sampler = UniformRandomSampler(
            name="ObjectSampler-lshape",
            mujoco_objects=self.lshape_tool,
            x_range=self.tool_x_range,
            y_range=self.tool_y_range,
            rotation=self.tool_rotation_range,
            rotation_axis='z',
            ensure_object_boundary_in_range=False,
            ensure_valid_placement=True,
            reference_pos=self.table_offset,
            z_offset=0.02,
        ))
        mujoco_objects = [
            self.pot_object,
            self.cube,
            self.lshape_tool
        ]
        self.model = ManipulationTask(
            mujoco_arena=mujoco_arena,
            mujoco_robots=[robot.robot_model for robot in self.robots], 
            mujoco_objects=mujoco_objects,
        )
        self.objects = [
            self.pot_object,
            self.cube,
            self.lshape_tool
        ]
def _load_model ( self ) : super ( ) . _load_model ( ) xpos = self . robots [ 0 ] . robot_model . base_xpos_offset [ "table" ] ( self . table_full_size [ 0 ] ) self . robots [ 0 ] . robot_model . set_base_xpos ( xpos ) mujoco_arena = TableArena ( table_full_size = self . table_full_size , table_offset = self . table_offset , table_friction = ( 0.6 , 0.005 , 0.0001 ) ) mujoco_arena . set_origin ( [ 0 , 0 , 0 ] ) mujoco_arena . set_camera ( camera_name = "agentview" , pos = [ 0.5386131746834771 , - 4.392035683362857e-09 , 1.4903500240372423 ] , quat = [ 0.6380177736282349 , 0.3048497438430786 , 0.30484986305236816 , 0.6380177736282349 ] ) mujoco_arena . set_camera ( camera_name = "sideview" , pos = [ 0.5586131746834771 , 0.3 , 1.2903500240372423 ] , quat = [ 0.4144233167171478 , 0.3100920617580414 , 0.49641484022140503 , 0.6968992352485657 ] ) darkwood = CustomMaterial ( texture = "WoodDark" , tex_name = "darkwood" , mat_name = "MatDarkWood" , tex_attrib = { "type" : "cube" } , mat_attrib = { "texrepeat" : "3 3" , "specular" : "0.4" , "shininess" : "0.1" } ) metal = CustomMaterial ( texture = "Metal" , tex_name = "metal" , mat_name = "MatMetal" , tex_attrib = { "type" : "cube" } , mat_attrib = { "specular" : "1" , "shininess" : "0.3" , "rgba" : "0.9 0.9 0.9 1" } ) tex_attrib = { "type" : "cube" } mat_attrib = { "texrepeat" : "1 1" , "specular" : "0.4" , "shininess" : "0.1" } greenwood = CustomMaterial ( texture = "WoodGreen" , tex_name = "greenwood" , mat_name = "greenwood_mat" , tex_attrib = tex_attrib , mat_attrib = mat_attrib , ) redwood = CustomMaterial ( texture = "WoodRed" , tex_name = "redwood" , mat_name = "MatRedWood" , tex_attrib = tex_attrib , mat_attrib = mat_attrib , ) bluewood = CustomMaterial ( texture = "WoodBlue" , tex_name = "bluewood" , mat_name = "handle1_mat" , tex_attrib = { "type" : "cube" } , mat_attrib = { "texrepeat" : "1 1" , "specular" : "0.4" , "shininess" : "0.1" } , ) ceramic = CustomMaterial ( texture = "Ceramic" , tex_name = "ceramic" , mat_name = "MatCeramic" , tex_attrib = tex_attrib , mat_attrib = mat_attrib , ) ingredient_size = [ 0.02 , 0.025 , 0.02 ] self . cube = BoxObject ( name = "cube_bread" , size_min = ingredient_size , size_max = ingredient_size , rgba = [ 1 , 0 , 0 , 1 ] , material = bluewood , density = 500. , ) self . lshape_tool = LShapeTool ( name = "LShapeTool" , ) self . pot_object = PotObject ( name = "PotObject" , ) pot_object = self . pot_object . get_obj ( ) ; pot_object . set ( "pos" , array_to_string ( ( 0.0 , 0.18 , self . table_offset [ 2 ] + 0.05 ) ) ) self . placement_initializer = SequentialCompositeSampler ( name = "ObjectSampler" ) self . placement_initializer . append_sampler ( sampler = UniformRandomSampler ( name = "ObjectSampler-cube" , mujoco_objects = self . cube , x_range = self . cube_x_range , y_range = self . cube_y_range , rotation = self . cube_rotation_range , rotation_axis = 'z' , ensure_object_boundary_in_range = False , ensure_valid_placement = True , reference_pos = self . table_offset , z_offset = 0.01 , ) ) self . placement_initializer . append_sampler ( sampler = UniformRandomSampler ( name = "ObjectSampler-lshape" , mujoco_objects = self . lshape_tool , x_range = self . tool_x_range , y_range = self . tool_y_range , rotation = self . tool_rotation_range , rotation_axis = 'z' , ensure_object_boundary_in_range = False , ensure_valid_placement = True , reference_pos = self . table_offset , z_offset = 0.02 , ) ) mujoco_objects = [ self . pot_object , self . cube , self . lshape_tool ] self . model = ManipulationTask ( mujoco_arena = mujoco_arena , mujoco_robots = [ robot . robot_model for robot in self . robots ] , mujoco_objects = mujoco_objects , ) self . objects = [ self . pot_object , self . cube , self . lshape_tool ]
Loads an xml model, puts it in self.model
Loads an xml model puts it in self . model
"""
        Loads an xml model, puts it in self.model
        """ # Adjust base pose accordingly # load model for table top workspace # Arena always gets set to zero origin # Modify default agentview camera # initialize objects of interest # Create placement initializer # task includes arena, robot, and objects of interest
self