API#
Python API#
RobotAssembler is a class to assemble robots from a base robot and an attachment robot. |
|
A wrapper class providing convenient access to assembled robot body information. |
|
Class representing two assembled rigid bodies connected by a fixed joint. |
- class RobotAssembler#
Bases:
objectRobotAssembler is a class to assemble robots from a base robot and an attachment robot. It will create a new USD stage with the assembly and configure a variant selection to enable the attachment robot to be selected. If the variant set already exists in the source asset, it creates a new entry to it, otherwise it creates a new variant set.
Initialize the RobotAssembler
- Parameters:
None
- Returns:
None
- assemble()#
Composes the attachment robot onto the base robot, so that the attachment robot is a child of the base robot, and ready to simulate.
- assemble_rigid_bodies(
- base_path: str,
- attach_path: str,
- base_mount_frame: str,
- attach_mount_frame: str,
- mask_all_collisions: bool = True,
- refresh_asset_paths: bool = False,
Assemble two rigid bodies into one physical structure
- Parameters:
base_path – Path to base robot.
attach_path – Path to attach robot. The attach robot will be unrooted from the stage and attached only to the base robot.
base_mount_frame – Relative path to frame in base robot where there is the desired attach point.
attach_mount_frame – Relative path to frame in the attach robot where there is the desired attach point.
mask_all_collisions – Mask all collisions between attach robot and base robot. This is necessary when setting single_robot=False to prevent Physics constraint violations from the new fixed joint. Advanced users may set this flag to False and use the mask_collisions() function separately for more customizable behavior.
refresh_asset_paths – Whether to refresh asset paths after assembly.
- Returns:
An object representing the assembled bodies. This object can detach the composed robots and edit the fixed joint transform.
- begin_assembly(
- stage,
- base_prim_path,
- base_mount_path,
- attachment_prim_path,
- attachment_mount_path,
- variant_set,
- variant_name,
Start the robot assembly process.
Places the attachment robot relative to the base robot but does not compose them yet.
- Parameters:
stage – USD stage for assembly
base_prim_path – Path to base robot prim
base_mount_path – Path to mount frame on base robot
attachment_prim_path – Path to attachment robot prim
attachment_mount_path – Path to mount frame on attachment robot
variant_set – Name of variant set to create/modify
variant_name – Name of variant to create
- cancel_assembly()#
Cancel the current assembly operation and reset state.
- create_fixed_joint(
- prim_path: str,
- target0: str = None,
- target1: str = None,
Create a fixed joint between two bodies
- Parameters:
prim_path – Prim path at which to place new fixed joint.
target0 – Prim path of frame at which to attach fixed joint.
target1 – Prim path of frame at which to attach fixed joint.
- Returns:
A USD fixed joint
- finish_assemble()#
Finalize the assembly process by configuring variant sets and saving the assembly to a USD file.
- get_articulation_root_api_path(prim_path: str) str#
Get the prim path that has the Articulation Root API applied.
- Parameters:
prim_path – Path to a prim
- Returns:
Path to the prim that has the Articulation Root API applied
- is_root_joint(prim) bool#
Check if a prim is a root joint (has no body0 or body1 target).
- Parameters:
prim – Prim to check
- Returns:
True if prim is a root joint, False otherwise
- mask_collisions(
- prim_path_a: str,
- prim_path_b: str,
Mask collisions between two prims. All nested prims will also be included.
- Parameters:
prim_path_a – Path to a prim
prim_path_b – Path to a prim
- Returns:
A relationship filtering collisions between prim_path_a and prim_path_b
- reset()#
Reset the assembler to its initial state and cancel any active assembly operations.
- class AssembledRobot(
- assembled_robots: AssembledBodies,
Bases:
objectA wrapper class providing convenient access to assembled robot body information.
This class serves as a high-level interface for interacting with assembled robots, encapsulating the underlying AssembledBodies instance and exposing its key properties through a simplified API. It provides direct access to robot paths, joint information, and collision masking relationships for assembled robot configurations.
The class acts as a facade over AssembledBodies, making it easier to work with assembled robot data without needing to interact directly with the lower-level assembly implementation.
- Parameters:
assembled_robots – The AssembledBodies instance containing the robot assembly data.
- property attach_path: str#
Prim path of the floating (attach) body
- Returns:
Prim path of the floating (attach) body.
- property base_path: str#
Prim path of the base body
- Returns:
Prim path of the base body.
- property collision_mask: pxr.Usd.Relationship#
A Usd Relationship masking collisions between the two assembled robots
- Returns:
A Usd Relationship masking collisions between the two assembled robots.
- property fixed_joint: pxr.UsdPhysics.FixedJoint#
USD fixed joint linking base and floating body together
- Returns:
USD fixed joint linking base and floating body together.
- property root_joints: List[pxr.UsdPhysics.Joint]#
Root joints that tie the floating body to the USD stage. These are disabled in an assembled body, and will be re-enabled by the disassemble() function.
- Returns:
Root joints that tie the floating body to the USD stage.
- class AssembledBodies(
- base_path: str,
- attach_path: str,
- fixed_joint: pxr.UsdPhysics.FixedJoint,
- root_joints: List[pxr.UsdPhysics.Joint],
- attach_body_articulation_root: pxr.Usd.Prim,
- collision_mask=None,
Bases:
objectClass representing two assembled rigid bodies connected by a fixed joint.
This class maintains references to the base and attach bodies, the fixed joint connecting them, and provides methods to manipulate their relative transform.
- Parameters:
base_path – Prim path of the base body.
attach_path – Prim path of the attach body.
fixed_joint – Fixed joint connecting the bodies.
root_joints – Root joints of the attach body.
attach_body_articulation_root – Articulation root of attach body.
collision_mask – Collision mask between bodies.
Initialize an AssembledBodies instance.
- Parameters:
base_path (str) – Prim path of the base body
attach_path (str) – Prim path of the attach body
fixed_joint (UsdPhysics.FixedJoint) – Fixed joint connecting the bodies
root_joints (List[UsdPhysics.Joint]) – Root joints of the attach body
attach_body_articulation_root (Usd.Prim) – Articulation root of attach body
collision_mask (Optional[Usd.Relationship]) – Collision mask between bodies
- property attach_body_articulation_root: pxr.Usd.Prim#
USD articulation root of the floating body.
- Returns:
USD articulation root of the floating body.
- property attach_path: str#
Prim path of the floating (attach) body.
- Returns:
Prim path of the floating (attach) body.
- property base_path: str#
Prim path of the base body.
- Returns:
Prim path of the base body.
- property collision_mask: pxr.Usd.Relationship#
A Usd Relationship masking collisions between the two assembled bodies.
- Returns:
A Usd Relationship masking collisions between the two assembled bodies.
- property fixed_joint: pxr.UsdPhysics.FixedJoint#
USD fixed joint linking base and floating body together.
- Returns:
USD fixed joint linking base and floating body together.
- property root_joints: List[pxr.UsdPhysics.Joint]#
- Root joints that tie the floating body to the USD stage. These are disabled in an assembled body,
and will be re-enabled by the disassemble() function.
- Returns:
Root joints that tie the floating body to the USD stage.