Skip to content

hylo.manip.datatypes

Package: hylo-manip · Core contracts

datatypes

Data types of the toolkit (re-exported by hylo.manip.tools). Frames: world, metres, radians, +z up; poses are 4x4 homogeneous matrices; the TCP follows hylo.core.robot (+x approach, +y closing axis, origin between the pads).

Verb module-attribute

Verb = Literal['grasp', 'place', 'reach', 'lift', 'push', 'press', 'retreat', 'home']

CameraView dataclass

CameraView(rgb: ndarray, depth: ndarray | None, K: ndarray | None, T_world_cam: ndarray | None, seg: ndarray | None = None)

One camera: rgb (H, W, 3) uint8; depth (H, W) metres or None; K (3, 3); T_world_cam (4, 4) in the OpenCV optical frame; seg (H, W) int32 instance ids when the environment gives segmentation.

rgb instance-attribute

rgb: ndarray

depth instance-attribute

depth: ndarray | None

K instance-attribute

K: ndarray | None

T_world_cam instance-attribute

T_world_cam: ndarray | None

seg class-attribute instance-attribute

seg: ndarray | None = None

View dataclass

View(cams: dict[str, CameraView], points: ndarray, segments: dict[int, str] = dict(), step: int = 0)

One observation: cams {name: CameraView}; points (N, 3) world points fused from every depth camera (voxel-downsampled, robot included); segments {instance id: label} when given; step at which it was taken.

cams instance-attribute

cams: dict[str, CameraView]

points instance-attribute

points: ndarray

segments class-attribute instance-attribute

segments: dict[int, str] = field(default_factory=dict)

step class-attribute instance-attribute

step: int = 0

Mask dataclass

Mask(label: str, camera: str, mask: ndarray, score: float = 1.0, instance: int | None = None)

An instance mask in one camera: label (the text label it answers), camera, mask (H, W) bool, score in [0, 1] (1: exact label match), instance (the environment's instance id, when known; label: view.segments[instance]).

label instance-attribute

label: str

camera instance-attribute

camera: str

mask instance-attribute

mask: ndarray

score class-attribute instance-attribute

score: float = 1.0

instance class-attribute instance-attribute

instance: int | None = None

Table dataclass

Table(height: float, normal: ndarray, extent: ndarray | None = None)

The support plane: height (z), normal (3,) (+z for a level table), extent [[xmin, xmax], [ymin, ymax]].

height instance-attribute

height: float

normal instance-attribute

normal: ndarray

extent class-attribute instance-attribute

extent: ndarray | None = None

Detection dataclass

Detection(label: str, score: float, points: ndarray)

One object: label, score, points (N, 3) world points fused across cameras (table and outliers removed).

label instance-attribute

label: str

score instance-attribute

score: float

points instance-attribute

points: ndarray

Box dataclass

Box(center: ndarray, size: ndarray, yaw: float, bottom: float)

Oriented box: center (3,), size (3,) = length along yaw >= width, height; yaw in (-pi/2, pi/2] about +z; bottom z. box.pose is the 4x4 object frame (origin at center, x along length, z up).

center instance-attribute

center: ndarray

size instance-attribute

size: ndarray

yaw instance-attribute

yaw: float

bottom instance-attribute

bottom: float

pose property

pose: ndarray

Fit dataclass

Fit(T: ndarray, rmse: float, inliers: float)

Rigid registration: T (4, 4) maps model points onto observed ones; rmse (m) over inliers; inliers: fraction of observed points within the tolerance of the moved model.

T instance-attribute

T: ndarray

rmse instance-attribute

rmse: float

inliers instance-attribute

inliers: float

Goal dataclass

Goal(verb: Verb, arm: str | None = None, tcp: ndarray | None = None, pre: ndarray | None = None, hand_before: Sequence[float] | None = None, hand: Sequence[float] | None = None, joints: ndarray | None = None, rank: float = 0.0, free: Literal['x', 'z'] | None = None, attached: ndarray | None = None)

One motion the planner may choose. verb: grasp, place, reach, lift, push, press, retreat, home. arm: arm name (None: the robot's only arm). tcp: (4, 4) TCP pose to end at. pre: (4, 4) approach pose: the planner reaches pre around obstacles, then moves in a straight line to tcp (that line is checked against the table and the robot only, not observed points, so it may touch the object). Without pre, verbs lift, retreat, push and press move in a straight line from the current TCP; other verbs plan a collision-free joint path to tcp. joints: a joint-space goal instead of tcp (e.g. home). hand_before: hand command while moving (None: keep the current one). hand: hand command at the end, held until the hand settles (None: no change). rank: lower is tried first among goals passed together. free: "x" or "z" lets the planner rotate freely about that TCP axis (e.g. "x" for a top-down approach to a round object). attached: (N, 3) points of a held object in the TCP frame: they move with the hand and are checked against the table and observed points like the hand itself (place_at fills it); observed points of the object where it is now are ignored.

verb instance-attribute

verb: Verb

arm class-attribute instance-attribute

arm: str | None = None

tcp class-attribute instance-attribute

tcp: ndarray | None = None

pre class-attribute instance-attribute

pre: ndarray | None = None

hand_before class-attribute instance-attribute

hand_before: Sequence[float] | None = None

hand class-attribute instance-attribute

hand: Sequence[float] | None = None

joints class-attribute instance-attribute

joints: ndarray | None = None

rank class-attribute instance-attribute

rank: float = 0.0

free class-attribute instance-attribute

free: Literal['x', 'z'] | None = None

attached class-attribute instance-attribute

attached: ndarray | None = None

Plan dataclass

Plan(goal: Goal, actions: ndarray, start_q: dict[str, ndarray], info: dict[str, Any] = dict(), path: dict[str, list] = dict())

A timed motion: goal (the one chosen; several arms: the first, all in info["goals"]), actions (T, action_dim) joint targets at control rate, start_q {arm: q} it was planned from (run refuses if the robot moved away), info (ik residual, path length, duration, method), path {arm: joint waypoints} before timing.

goal instance-attribute

goal: Goal

actions instance-attribute

actions: ndarray

start_q instance-attribute

start_q: dict[str, ndarray]

info class-attribute instance-attribute

info: dict[str, Any] = field(default_factory=dict)

path class-attribute instance-attribute

path: dict[str, list] = field(default_factory=dict)