Exemple #1
0
    def __init__(
        self,
        table_full_size=(0.8, 0.8, 0.05),
        table_friction=(1, 0.005, 0.0001),
        table_offset=(0, 0, 0.8),
        has_legs=True,
        xml="arenas/table_arena.xml",
    ):
        super().__init__(xml_path_completion(xml))

        self.table_full_size = np.array(table_full_size)
        self.table_half_size = self.table_full_size / 2
        self.table_friction = table_friction
        self.table_offset = table_offset
        self.center_pos = self.bottom_pos + np.array(
            [0, 0, -self.table_half_size[2]]) + self.table_offset

        self.table_body = self.worldbody.find("./body[@name='table']")
        self.table_collision = self.table_body.find(
            "./geom[@name='table_collision']")
        self.table_visual = self.table_body.find(
            "./geom[@name='table_visual']")
        self.table_top = self.table_body.find("./site[@name='table_top']")

        self.has_legs = has_legs
        self.table_legs_visual = [
            self.table_body.find("./geom[@name='table_leg1_visual']"),
            self.table_body.find("./geom[@name='table_leg2_visual']"),
            self.table_body.find("./geom[@name='table_leg3_visual']"),
            self.table_body.find("./geom[@name='table_leg4_visual']"),
        ]

        self.configure_location()
    def _init_floor(self, image):
        """
        Intiailizes the floor

        Args:
            image (string): String for the file to use as an image for the floor

        """
        floor_mesh = nvisii.mesh.create_plane(name="plane",
                                              size=nvisii.vec2(3, 3))

        floor_entity = nvisii.entity.create(
            name="floor",
            mesh=floor_mesh,
            material=nvisii.material.create("plane"),
            transform=nvisii.transform.create("plane"))
        floor_entity.get_transform().set_scale(nvisii.vec3(1))
        floor_entity.get_transform().set_position(nvisii.vec3(0, 0, 0))

        texture_image = xml_path_completion("textures/" + image)
        texture = nvisii.texture.create_from_file(name='floor_texture',
                                                  path=texture_image)

        floor_entity.get_material().set_base_color_texture(texture)
        floor_entity.get_material().set_roughness(0.4)
        floor_entity.get_material().set_specular(0)
    def _init_walls(self, image):
        """
        Intiailizes the walls

        Args:
            image (string): String for the file to use as an image for the walls
        """
        texture_image = xml_path_completion("textures/" + image)
        texture = nvisii.texture.create_from_file(name='wall_texture',
                                                  path=texture_image)

        for wall in self.env.model.mujoco_arena.worldbody.findall(
                "./geom[@material='walls_mat']"):

            name = wall.get('name')
            size = [float(x) for x in wall.get('size').split(' ')]

            pos, quat = self._get_orientation_geom(name)

            wall_entity = nvisii.entity.create(
                name=name,
                mesh=nvisii.mesh.create_box(name=name,
                                            size=nvisii.vec3(
                                                size[0], size[1], size[2])),
                transform=nvisii.transform.create(name),
                material=nvisii.material.create(name))

            wall_entity.get_transform().set_position(
                nvisii.vec3(pos[0], pos[1], pos[2]))

            wall_entity.get_transform().set_rotation(
                nvisii.quat(quat[0], quat[1], quat[2], quat[3]))

            wall_entity.get_material().set_base_color_texture(texture)
Exemple #4
0
 def __init__(self, name):
     super().__init__(
         xml_path_completion("objects/master_chef_can_visual.xml"),
         name=name,
         joints=None,
         obj_type="visual",
         duplicate_collision_geoms=True)
Exemple #5
0
 def __init__(self, name):
     super().__init__(
         xml_path_completion("objects/plate-with-hole.xml"),
         name=name,
         joints=None,
         obj_type="all",
         duplicate_collision_geoms=True,
     )
Exemple #6
0
 def __init__(self, name):
     super().__init__(
         xml_path_completion("objects/square-nut.xml"),
         name=name,
         joints=[dict(type="free", damping="0.0005")],
         obj_type="all",
         duplicate_collision_geoms=True,
     )
Exemple #7
0
 def __init__(self):
     super().__init__(xml_path_completion("base.xml"))
     # Modify the simulation timestep to be the requested value
     options = find_elements(root=self.root,
                             tags="option",
                             attribs=None,
                             return_first=True)
     options.set("timestep", convert_to_string(macros.SIMULATION_TIMESTEP))
    def __init__(self, idn=0):
        super().__init__(xml_path_completion("robots/panda/robot.xml"),
                         idn=idn)

        # Set joint damping
        self.set_joint_attribute(attrib="damping",
                                 values=np.array(
                                     (0.1, 0.1, 0.1, 0.1, 0.1, 0.01, 0.01)))
Exemple #9
0
    def __init__(self):
        super().__init__(xml_path_completion("robots/hdt_angler/robot.xml"))

        self.bottom_offset = np.array([0, 0, -0.913])
        self.set_joint_damping()
        self._model_name = "hdt"
        # Careful of init_qpos -- certain init poses cause ik controller to go unstable (e.g: pi/4 instead of -pi/4
        # for the final joint angle)
        self._init_qpos = np.array([0., 0., 0., 0., 0., 0.])
Exemple #10
0
 def __init__(self, name):
     super().__init__(
         xml_path_completion(
             "objects/o0001.xml"
         ),  # currently this returns a path inside of my anaconda env...
         name=name,
         joints=[dict(type="free", damping="0.0005")],
         obj_type="all",
         duplicate_collision_geoms=True)
Exemple #11
0
 def __init__(self, name=None, joints=None, friction=None, damping=None, lock=False):
     xml_path = "objects/door.xml"
     if lock:
         xml_path = "objects/door_lock.xml"
     super().__init__(xml_path_completion(xml_path), name=name, joints=joints)
     self.lock = lock
     self.friction = friction
     self.damping = damping
     if self.friction is not None:
         self._set_door_friction(self.friction)
     if self.damping is not None:
         self._set_door_damping(self.damping)
    def __init__(
        self, bin1_pos=(0.1, -0.5, 0.8), table_full_size=(0.39, 0.49, 0.82), table_friction=(1, 0.005, 0.0001)
    ):
        super().__init__(xml_path_completion("arenas/bins_arena.xml"))

        self.table_full_size = np.array(table_full_size)
        self.table_half_size = self.table_full_size / 2
        self.table_friction = table_friction

        self.bin1_body = self.worldbody.find("./body[@name='bin1']")
        self.bin2_body = self.worldbody.find("./body[@name='bin2']")
        self.table_top_abs = np.array(bin1_pos)

        self.configure_location()
Exemple #13
0
    def __init__(self,
                 table_full_size=(0.39, 0.49, 0.82),
                 table_friction=(1, 0.005, 0.0001)):
        """
        Args:
            table_full_size: full dimensions of the table
            friction: friction parameters of the table
        """
        super().__init__(xml_path_completion("arenas/bin_packing_arena.xml"))

        self.table_full_size = np.array(table_full_size)
        self.table_half_size = self.table_full_size / 2
        self.table_friction = table_friction

        self.floor = self.worldbody.find("./geom[@name='floor']")
        self.bin1_body = self.worldbody.find("./body[@name='bin1']")
        self.bin2_body = self.worldbody.find("./body[@name='bin2']")

        self.configure_location()
    def __init__(
        self,
        table_friction=(1, 0.005, 0.0001),
        xml="arenas/custom_table.xml",
        mesh_file="/home/kj/robosuite/robosuite/models/assets/arenas/meshes/custom_table.stl",
        mesh_scale=0.01,
    ):
        with open(mesh_file, 'rb') as f:
            self.mesh = trimesh.load(f, "stl")
        self.mesh.apply_scale(mesh_scale)
        # self.mesh.apply_translation(-self.mesh.center_mass)
        self.table_full_size = self.mesh.bounds[1] - self.mesh.bounds[0]
        # print(self.mesh.bounds)
        self.table_half_size = self.table_full_size / 2
        self.table_friction = table_friction
        self.table_offset = np.array([0., 0., 0.])

        super().__init__(xml_path_completion(xml))
        self.floor = self.worldbody.find("./geom[@name='floor']")
    def __init__(
        self, table_full_size=(0.8, 0.8, 0.8), table_friction=(1, 0.005, 0.0001)
    ):
        """
        Args:
            table_full_size: full dimensions of the table
            friction: friction parameters of the table
        """
        assets_root = os.path.dirname(__file__)
        super().__init__(xml_path_completion("{}/bin_arena.xml".format(assets_root)))

        self.table_full_size = np.array(table_full_size)
        self.table_half_size = self.table_full_size / 2
        self.table_friction = table_friction

        self.floor = self.worldbody.find("./geom[@name='floor']")
        self.table_body = self.worldbody.find("./body[@name='table']")
        self.table_collision = self.table_body.find("./geom[@name='table_collision']")
        self.table_visual = self.table_body.find("./geom[@name='table_visual']")
        self.table_top = self.table_body.find("./site[@name='table_top']")

        self.configure_location()
Exemple #16
0
    def __init__(self, name, friction=None, damping=None, lock=False):
        xml_path = "objects/door.xml"
        if lock:
            xml_path = "objects/door_lock.xml"
        super().__init__(xml_path_completion(xml_path),
                         name=name,
                         joints=None,
                         obj_type="all",
                         duplicate_collision_geoms=True)

        # Set relevant body names
        self.door_body = self.naming_prefix + "door"
        self.frame_body = self.naming_prefix + "frame"
        self.latch_body = self.naming_prefix + "latch"
        self.hinge_joint = self.naming_prefix + "hinge"

        self.lock = lock
        self.friction = friction
        self.damping = damping
        if self.friction is not None:
            self._set_door_friction(self.friction)
        if self.damping is not None:
            self._set_door_damping(self.damping)
    def __init__(self,
                 table_full_size=(0.8, 0.8, 0.8),
                 table_friction=(1, 0.005, 0.0001)):
        """
        Args:
            table_full_size: full dimensions of the table
            friction: friction parameters of the table
        """
        super().__init__(xml_path_completion("arenas/table_cabinet_arena.xml"))

        self.table_full_size = np.array(table_full_size)
        self.table_half_size = self.table_full_size / 2
        self.table_friction = table_friction

        self.floor = self.worldbody.find("./geom[@name='floor']")
        self.table_body = self.worldbody.find("./body[@name='table']")
        self.table_collision = self.table_body.find(
            "./geom[@name='table_collision']")
        self.table_visual = self.table_body.find(
            "./geom[@name='table_visual']")
        self.table_top = self.table_body.find("./site[@name='table_top']")

        self.configure_location()
Exemple #18
0
 def __init__(self, name=None, joints=None):
     super().__init__(xml_path_completion("objects/plate-with-hole.xml"), name=name, joints=joints)
Exemple #19
0
 def __init__(self, idn=0):
     super().__init__(xml_path_completion("grippers/robotiq_gripper_s.xml"),
                      idn=idn)
Exemple #20
0
 def __init__(self, name):
     super().__init__(xml_path_completion("objects/lemon.xml"),
                      name=name,
                      obj_type="all",
                      duplicate_collision_geoms=True)
 def __init__(self, idn=0):
     super().__init__(xml_path_completion("grippers/rethink_gripper.xml"),
                      idn=idn)
Exemple #22
0
 def __init__(self, idn=0):
     super().__init__(xml_path_completion("robots/ur5e/robot.xml"), idn=idn)
Exemple #23
0
 def __init__(self, idn=0, path=None):
     if path == None:
         super().__init__(xml_path_completion("robots/ur5e/robot.xml"),
                          idn=idn)
     else:
         super().__init__(path, idn=idn)
Exemple #24
0
 def __init__(self, name=None, joints=None):
     super().__init__(xml_path_completion("objects/half_cylinder_box.xml"), name=name, joints=joints)
Exemple #25
0
 def __init__(self, idn=0):
     super().__init__(xml_path_completion('grippers/wiping_gripper.xml'),
                      idn=idn)
 def __init__(self):
     super().__init__(xml_path_completion("grippers/hdt_gripper.xml"))
Exemple #27
0
 def __init__(self, name=None, joints=None):
     super().__init__(xml_path_completion("objects/bread.xml"), name=name, joints=joints)
Exemple #28
0
 def __init__(self, idn=0, bottom_offset=(0, 0, 0)):
     super().__init__(xml_path_completion("robots/laikago/robot.xml"), idn=idn, bottom_offset=bottom_offset)
    def __init__(self):
        super().__init__(xml_path_completion("robots/jr2/jr2_with_arm.xml"))

        self.bottom_offset = np.array([0, 0, 0])
Exemple #30
0
 def __init__(self):
     super().__init__(xml_path_completion("arenas/walking_arena.xml"))
     self.floor = self.worldbody.find("./geom[@name='floor']")