skrobot.assembly.RobotModule

class skrobot.assembly.RobotModule(module_id: str, urdf_path: Path, ports: List[Port] = <factory>, root_link: str = 'base_link')[source]

Represents an individual URDF part (module) in the robot catalog.

This class does NOT hold parent-child relationships. It simply stores metadata about a single URDF file and its available connection ports.

Parameters:
  • module_id (str) – Unique identifier for this module type (e.g., “hinge_module”, “branch_module”).

  • urdf_path (Path) – Path to the URDF file for this module.

  • ports (List[Port]) – List of available connection ports (links that can connect to other modules).

  • root_link (str) – The root link name in the original URDF (usually “base_link”).

Examples

>>> hinge = RobotModule(
...     module_id="hinge",
...     urdf_path=Path("/path/to/screw_hinge_module.urdf"),
...     ports=[Port("base_link"), Port("dummy_link1")],
...     root_link="base_link"
... )

Methods

classmethod from_urdf(module_id: str, urdf_path: str) RobotModule[source]

Create a RobotModule by parsing a URDF file.

This factory method automatically extracts: - The root link name - Available ports (dummy_link* patterns) - Z-axis direction for each port (for auto-alignment)

Parameters:
  • module_id (str) – Unique identifier for this module.

  • urdf_path (str) – Path to the URDF file.

Returns:

A new RobotModule instance with extracted port information.

Return type:

RobotModule

classmethod from_urdf_string(module_id: str, urdf_content: str, urdf_path: str = '') RobotModule[source]

Create a RobotModule by parsing URDF content from a string.

This method is useful when loading URDF from cloud storage where the content is already loaded into memory.

Parameters:
  • module_id (str) – Unique identifier for this module.

  • urdf_content (str) – The URDF XML content as a string.

  • urdf_path (str, optional) – Original path of the URDF file (for reference).

Returns:

A new RobotModule instance with extracted port information.

Return type:

RobotModule

get_port_names() List[str][source]

Return list of all available port names.

__eq__(other)

Return self==value.

__ne__(value, /)

Return self!=value.

__lt__(value, /)

Return self<value.

__le__(value, /)

Return self<=value.

__gt__(value, /)

Return self>value.

__ge__(value, /)

Return self>=value.

Attributes

module_id: str
urdf_path: Path
ports: List[Port]