Bin
Represents a bin container with a unique identifier, 6-DOF pose, and an optional list of Part instances. This datatype is used for bin-based workflows within the Telekinesis ecosystem.
Field
Required
| Field | Type | Description |
|---|---|---|
id | int | Unique identifier for the bin (int). |
pose | ArrayLike | 6-element pose vector [x, y, z, rx, ry, rz] in degrees; shape (6,), dtype float32. |
Optional
| Field | Type | Description |
|---|---|---|
parts | list[Part] | List of Part instances in the bin. Default []. |
Example
python
from datatypes import datatypes
from datatypes.datatypes import PartState
from loguru import logger
# ------------------------------------------------
# 1. Create Bin instance
# ------------------------------------------------
parts = [
datatypes.Part(
id=1,
pose=[10, 20, 30, 45, 0, 0],
x_dim=8.0,
y_dim=8.0,
z_dim=3.0,
state=PartState.VISIBLE,
),
datatypes.Part(id=2, pose=[40, 50, 60, 0, 30, 0]),
datatypes.Part(
id=3,
pose=[70, 80, 90, 0, 0, 60],
state=PartState.FAILED_GRASP,
),
]
bin_obj = datatypes.Bin(
id=20,
pose=[1000.0, 500.0, 0.0, 0.0, 0.0, 0.0],
parts=parts,
)
# ------------------------------------------------
# 2. Access data via to_dict
# ------------------------------------------------
bin_dict = bin_obj.to_dict()
logger.info("Bin to_dict id={}", bin_dict["id"])
logger.info("Bin to_dict pose={}", bin_dict["pose"])
logger.info("Bin to_dict num_parts={}", len(bin_dict["parts"]))
# ------------------------------------------------
# 3. Empty Bin (no parts)
# ------------------------------------------------
empty_bin = datatypes.Bin(id=21, pose=[0, 0, 0, 0, 0, 0])
empty_dict = empty_bin.to_dict()
logger.info("Empty Bin to_dict id={}", empty_dict["id"])
logger.info("Empty Bin to_dict num_parts={}", len(empty_dict["parts"]))
