skrobot.assembly.Connection

class skrobot.assembly.Connection(module_a: str, port_a: str, module_b: str, port_b: str, x: float = 0.0, y: float = 0.0, z: float = 0.0, roll: float = 0.0, pitch: float = 0.0, yaw: float = 0.0, loop: bool = False, dependent: Tuple[str, ...] | None = None, joint_type: str = 'fixed', axis: Tuple[float, float, float] = (0.0, 0.0, 1.0), lower: float | None = None, upper: float | None = None, effort: float = 100.0, velocity: float = 1.0, attach: str = 'root')[source]

Represents a connection between two module ports.

This is an edge in the undirected connection graph.

Parameters:
  • module_a (str) – Instance ID of the first module.

  • port_a (str) – Port (link) name on module_a.

  • module_b (str) – Instance ID of the second module.

  • port_b (str) – Port (link) name on module_b.

  • x (float) – X position offset from port_a to port_b (in port_a’s frame).

  • y (float) – Y position offset from port_a to port_b.

  • z (float) – Z position offset from port_a to port_b.

  • roll (float) – Roll (rotation around X axis) offset in radians.

  • pitch (float) – Pitch (rotation around Y axis) offset in radians.

  • yaw (float) – Yaw (rotation around Z axis) offset in radians.

  • loop (bool) – True marks this connection as a loop closure: the edge that a kinematic tree cannot carry and that the assembly graph cuts. A loop connection never becomes a joint in the built URDF; instead it is exported as a runtime-IK closure constraint (the two port frames must stay coincident on their common hinge axis).

  • dependent (Tuple[str, ...], optional) – For a loop closure: the final (prefixed) joint names this closure SOLVES. The remaining movable joints on the loop ring stay independent (driven). None (default) picks the split automatically: the movable joint nearest the root drives, the rest are solved. A 1-DOF planar loop solves 2 joints; a 2-DOF loop (e.g. a five-bar) needs this made explicit.

  • joint_type (str) – Type of the joint the connection becomes in the built URDF: 'fixed' (default), 'revolute', 'continuous' or 'prismatic'. A movable connection turns the mated port pair itself into an articulation, so modules do not need an internal joint to move relative to each other.

  • axis (Tuple[float, float, float]) – Movable connections only: the joint axis, expressed in the child attachment link’s frame (= the URDF joint frame). Default Z.

  • lower (float, optional) – Joint limits; required for 'revolute' and 'prismatic'.

  • upper (float, optional) – Joint limits; required for 'revolute' and 'prismatic'.

  • effort (float) – Limit attributes the URDF requires alongside lower/upper.

  • velocity (float) – Limit attributes the URDF requires alongside lower/upper.

Methods

involves(module_instance_id: str) bool[source]

Check if this connection involves the given module instance.

__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

attach: str = 'root'
axis: Tuple[float, float, float] = (0.0, 0.0, 1.0)
dependent: Tuple[str, ...] | None = None
effort: float = 100.0
joint_type: str = 'fixed'
loop: bool = False
lower: float | None = None
pitch: float = 0.0
roll: float = 0.0
rpy

Return orientation offset as tuple.

upper: float | None = None
velocity: float = 1.0
x: float = 0.0
xyz

Return position offset as tuple.

y: float = 0.0
yaw: float = 0.0
z: float = 0.0
module_a: str
port_a: str
module_b: str
port_b: str