robocasa.utils.model_zoo package

Submodules

robocasa.utils.model_zoo.file_utils module

robocasa.utils.model_zoo.file_utils.get_ext(path)
robocasa.utils.model_zoo.file_utils.get_name(path)
robocasa.utils.model_zoo.file_utils.get_stem(path)
robocasa.utils.model_zoo.file_utils.make_asset_path(base_asset_path, model_prefix, model_name)

robocasa.utils.model_zoo.log_utils module

class robocasa.utils.model_zoo.log_utils.NumpyEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)

Bases: JSONEncoder

Special json encoder for numpy types From https://stackoverflow.com/a/49677241

default(obj)

Implement this method in a subclass such that it returns a serializable object for o, or calls the base implementation (to raise a TypeError).

For example, to support arbitrary iterators, you could implement default like this:

def default(self, o):
    try:
        iterable = iter(o)
    except TypeError:
        pass
    else:
        return list(iterable)
    # Let the base class default method raise the TypeError
    return JSONEncoder.default(self, o)
robocasa.utils.model_zoo.log_utils.maybe_log_info(message, log=False, color='yellow', indent=False)
robocasa.utils.model_zoo.log_utils.save_meta(args, asset_path)

robocasa.utils.model_zoo.mjcf_gen_utils module

robocasa.utils.model_zoo.mjcf_gen_utils.decompose_convex(filename, work_dir, max_output_convex_hulls=32, voxel_resolution=100000, volume_error_percent=1.0, max_hull_vert_count=64)

Adapted from https://github.com/kevinzakka/obj2mjcf/blob/main/obj2mjcf/_cli.py

robocasa.utils.model_zoo.mjcf_gen_utils.generate_mjcf(asset_path, model_name, model_info, sc=1.0, texture_path=None, hide_vis_geoms=False, show_coll_geoms=False, show_sites=False, verbose=False)

Generate mjcf model for object

robocasa.utils.model_zoo.mjcf_gen_utils.get_bb_info(bb_mesh)

Extract size, position, and orientation (quat) from bounding box mesh

robocasa.utils.model_zoo.mjcf_gen_utils.get_file_name_and_type(path)

Extract name of object model file and file format

robocasa.utils.model_zoo.mjcf_gen_utils.get_geom_element(model_name, geom_info, sc=1.0, show_if_coll_geom=False)

Generate xml element for mjcf geom

robocasa.utils.model_zoo.mjcf_gen_utils.get_material_element(material_info)
robocasa.utils.model_zoo.mjcf_gen_utils.get_mesh_element(geom_info, sc=1.0)

Generate xml element for mjcf mesh asset

robocasa.utils.model_zoo.mjcf_gen_utils.get_texture_element(texture_info)
robocasa.utils.model_zoo.mjcf_gen_utils.parse_coll_model(coll_model_path, asset_path, verbose=False, transform=None)

Extract list of primitive geoms from collision model file

robocasa.utils.model_zoo.mjcf_gen_utils.parse_model(model_path, model_name, asset_path, obj_path=None, visual_only=False, center=False, prescale=False, rot=None, transform=None, verbose=False)

Extract meshes from main model file

robocasa.utils.model_zoo.mjcf_gen_utils.parse_model_info(model_path, model_name, coll_model_path, asset_path, obj_path=None, verbose=False, center=False, prescale=False, rot=None, transform=None)

Extract visual and collision geoms from main model file and collision model file

robocasa.utils.model_zoo.mjcf_obj module

robocasa.utils.model_zoo.mtl_utils module

Much of this code is directly copied from obj2mjcf: https://github.com/kevinzakka/obj2mjcf/blob/main/obj2mjcf/_cli.py

Credit: Kevin Zakka

class robocasa.utils.model_zoo.mtl_utils.Material(name: str, Ka: str | None = None, Kd: str | None = None, Ks: str | None = None, d: str | None = None, Tr: str | None = None, Ns: str | None = None, map_Kd: str | None = None)

Bases: object

Ka: str | None = None
Kd: str | None = None
Ks: str | None = None
Ns: str | None = None
Tr: str | None = None
d: str | None = None
static from_string(lines: Sequence[str]) Material

Construct a Material object from a string.

map_Kd: str | None = None
mjcf_rgba() str
mjcf_shininess() str
mjcf_specular() str
name: str
robocasa.utils.model_zoo.mtl_utils.get_image_paths(mtl_path)
robocasa.utils.model_zoo.mtl_utils.get_mtls(filename, work_dir)
robocasa.utils.model_zoo.mtl_utils.resize_texture(filename: Path, resize_percent) None

Resize a texture to a percentage of its original size.

robocasa.utils.model_zoo.object_play_env module

robocasa.utils.model_zoo.parser_utils module

robocasa.utils.model_zoo.parser_utils.get_base_parser()

Module contents