Skip to content

Core

rpad.partnet_mobility_utils.data.PMObject

This class describes the grouping of files for each object.

category: str property

Object category.

has_extra_objs: bool property

Some of the items in the dataset have extra obj files in their textured_objs directory.

meta_fn: Path property

The metadata file

obj_id: str property

The object ID.

semantics_fn: Path property

The semantics file

urdf_fn: Path property

The URDF file

usable: bool property

Are all the objects specified in the URDF contianed in the textured_objs folder?

well_formed: bool property

Does the set of objs in the textured_objs folder exactly match those described in the URDF?

__init__(obj_dir)

Initializer.

Parameters:

Name Type Description Default
obj_dir Union[str, Path]

The object-level directory. For instance, "pm/111000/". This file should contain a urdf file, semantics.txt, and metadata.txt.

required

rpad.partnet_mobility_utils.data.Metadata dataclass

This represents provides access to the metadata for the object, found in metadata.txt.

Attributes:

Name Type Description
model_cat str

The model category. Will be something like "Chair".

from_file(fn) staticmethod

Parse the metadata file.

Parameters:

Name Type Description Default
fn Union[str, Path]

The metadata filename to parse.

required

Returns:

Type Description
Metadata

Metadata

rpad.partnet_mobility_utils.data.Semantics dataclass

Each object includes a semantics.txt file, which describes the semantics of each joint.

This class wraps the semantic file, and provides functions to filter down to specific joints by type, name, or label.

by_label(label)

Filter down all semantics in the object by label name.

Parameters:

Name Type Description Default
label str

The semantic joint label (i.e. "button")

required

Returns:

Type Description
List[JointSemantic]

List[JointSemantic]: Joints matching this label.

by_name(name)

Get the semantics for a specific joint.

Parameters:

Name Type Description Default
name str

Joint name.

required

Returns:

Type Description
JointSemantic

JointSemantic

by_type(joint_type)

Filter down all semantics in the object by joint type.

Parameters:

Name Type Description Default
joint_type Union[JointType, Sequence[JointType]]

One or more joint types

required

Returns:

Type Description
List[JointSemantic]

List[JointSemantic]: A list of JointSemantics matching the joint_type.

from_file(fn) staticmethod

Parse a semantics file.

Parameters:

Name Type Description Default
fn Union[str, Path]

Semantics filename (should end in semantics.txt)

required

Returns:

Name Type Description
Semantics Semantics

The parsed semantics file.

rpad.partnet_mobility_utils.data.JointSemantic dataclass

Describes semantic attributes of a joint.

Attributes:

Name Type Description
name str

The name of the joint, as defined in URDF.

type JointType

The type of joint, one of: {"slider", "free", "hinge", "heavy", "static", "slider+"}

label str

The semantic label of the joint (i.e. button, door, etc.). Shared across objects.

rpad.partnet_mobility_utils.urdf.PMTree

The parsed URDF Tree.

children: Dict[str, List[str]] property

The child dictionary for the tree.

descendants: Dict[str, List[str]] property

Get all descendants for each node.

joints: List[Joint] property

All joints in the object.

All links in the object.

meshes: Set[str] property

Get all meshes for the object.

__init__(links, joints)

Initializer, based on a flattened representation of the tree. The best way to instantiate the object is from parse_urdf

get_chain(link_name)

Get the kinematic chain, starting from the base of the object, and ending with the desired link.

Parameters:

Name Type Description Default
link_name str

The child node in the chain.

required

Returns:

Type Description
List[Joint]

List[Joint]: All links in the kinematic chain.

get_joint(name)

Get joints by name.

Parameters:

Name Type Description Default
name str

The name of the joint.

required

Raises:

Type Description
ValueError

Joint not found.

Returns:

Name Type Description
Joint Joint

The desired joint.

get_joint_by_child(child_name)

Get a joint by its child name. Each child only has one parent.

Parameters:

Name Type Description Default
child_name str

The child name.

required

Raises:

Type Description
ValueError

Joint not found

Returns:

Name Type Description
Joint Joint

The joint connecting to the child.

Get link by name.

Parameters:

Name Type Description Default
name str

The name of the link.

required

Raises:

Type Description
ValueError

Link not found.

Returns:

Name Type Description
Link Link

The desired link.

parse_urdf(urdf_fn) staticmethod

Parses a given URDF string into a PMTree. This is necessary because many of the partnet-mobility objects are malformed, and violate the URDF schema. Otherwise I'd just have used a urdf parsing library.

Parameters:

Name Type Description Default
urdf_fn Union[str, Path]

URDF file to parse.

required

Raises:

Type Description
ValueError

URDF File not found.

Returns:

Name Type Description
PMTree PMTree

the parsed PMTree.

parse_urdf_from_string(urdf_string) staticmethod

Parses a given URDF string into a PMTree. This is necessary because many of the partnet-mobility objects are malformed, and violate the URDF schema. Otherwise I'd just have used a urdf parsing library.

Parameters:

Name Type Description Default
urdf_string str

A string of the URDF.

required

Returns:

Name Type Description
PMTree PMTree

A parsed URDF tree.

rpad.partnet_mobility_utils.urdf.Joint dataclass

A URDF Joint. See http://wiki.ros.org/urdf/XML/joint for descriptions of each field. Not all fields are supported.

A URDF Link. See http://wiki.ros.org/urdf/XML/link for more details. Not all fields are supported.