Skip to content

Collect

SUMMARY

collect() drives the robot through every pose yielded by the sampler, captures a synchronized frame from every camera at each pose, and saves the result to disk. See DataCollector for the class this skill belongs to.

SUPPORTED TARGETS

Works with any target, ChessboardTarget, CharucoTarget, or ArucoTarget. The target is only used to check each frame has at least min_corners detectable corners before it is saved.

UNITS

Images are BGR ndarrays. robot_T_tcp_list holds (4, 4) SE(3) matrices with translation in meters. settle_time is in seconds.

0:00 / 0:00

A Universal Robots UR10e running collect(), sweeping a wrist-mounted Sensopart camera through a pose sequence.

The Skill

python
collector.collect(data_dir, wipe=False)

Returned dict keys:

KeyTypeDescription
okboolTrue once at least 4 frames were captured.
imageslist[list[ndarray]]images[cam_idx][frame_idx].
robot_T_tcp_listlist[ndarray]Per-frame (4, 4) SE(3) matrices.

ON-DISK LAYOUT

Data is always saved in the multi-camera layout, regardless of camera count:

data_dir/cam_00/image_NN.png
data_dir/cam_00/calibration_data.npz   # robot_T_tcp_list
data_dir/cam_01/...

The Code

python
from telekinesis.axon import DataCollector, PerturbationSampler

collector = DataCollector(
    robot,
    cameras,
    target,
    sampler,
    min_corners=12,
    require_all_cameras=True,
    settle_time=2.0,
)

result = collector.collect(data_dir, wipe=False)

result["ok"]                # True once at least 4 frames were captured
result["images"]            # images[cam_idx][frame_idx]
result["robot_T_tcp_list"]  # list of (4, 4) SE(3) matrices

How to Collect Good Datasets

A good sweep spreads the target across the frame and varies both distance and tilt from pose to pose, rather than repeating near-identical views.

Montage of nine calibration board views captured across a pose sweep