Vision¶
Vision provides dependency-light camera geometry helpers for RGB-D observations, Cartesian/pixel alignment-error helpers for caller-owned correction loops, and appliance-side fiducial tag detection (ArUco, AprilTag, QR).
Tag detection is topic-driven: the appliance subscribes to the camera inside
ROS and streams back compact TagFrame results, so image
bytes never cross the SDK boundary. A rigid TagLayout or a
CharucoBoard can be solved as one pose per frame, and the
Calibration solvers turn those poses into a hand-eye
mounting or camera intrinsics. Supplying a CameraInfo topic and the
printed tag size adds a per-tag pose in the camera optical frame. Corners are
ordered top-left, top-right, bottom-right, bottom-left in the tag’s own
orientation; the tag frame is centred on the tag with +x right, +y up
and +z toward the camera.
Camera geometry and position/pixel alignment-error helpers.
Types
- class olo.vision.Pixel[source]¶
Bases:
objectPixel coordinate, zero-based from the top-left of the image.
- class olo.vision.BoundingBox[source]¶
Bases:
objectHalf-open image bounding box with XYXY pixel coordinates.
- classmethod from_xywh(x, y, width, height)[source]¶
Create a half-open bounding box from
x, y, width, height.- Return type:
- Parameters:
- classmethod from_xyxy(x_min, y_min, x_max, y_max)[source]¶
Create a half-open bounding box from
x_min, y_min, x_max, y_max.- Return type:
- Parameters:
- class olo.vision.CameraIntrinsics[source]¶
Bases:
objectPinhole camera calibration parsed from sensor_msgs/CameraInfo.
- class olo.vision.PointObservation[source]¶
Bases:
objectStamped 3D point observation in the camera optical frame.
Camera geometry helpers
- olo.vision.camera_info_to_intrinsics(message)[source]¶
Parse a sensor_msgs/CameraInfo message into pinhole intrinsics.
- Return type:
- Parameters:
- olo.vision.sample_depth(image, pixel, *, window_size=1, min_depth_metres=None, max_depth_metres=None)[source]¶
Sample a depth image at a pixel, optionally using a median window.
- olo.vision.sample_depth_region(image, region, *, aggregation='median', min_valid_pixels=1, min_depth_metres=None, max_depth_metres=None)[source]¶
Sample a depth image region and aggregate valid depths in metres.
- olo.vision.sample_depth_point(depth_image, pixel, intrinsics, *, window_size=1, min_depth_metres=None, max_depth_metres=None)[source]¶
Sample and deproject a depth point, preserving the depth image observation stamp.
- Return type:
- Parameters:
- olo.vision.deproject_pixel(pixel, depth_metres, intrinsics)[source]¶
Deproject a pixel and depth into the ROS optical camera frame.
- Return type:
- Parameters:
pixel (Pixel)
depth_metres (float)
intrinsics (CameraIntrinsics)
- olo.vision.deproject_point(pixel, depth_metres, intrinsics)[source]¶
Deproject a pixel and scalar depth into the ROS optical camera frame.
- Return type:
- Parameters:
pixel (Pixel)
depth_metres (float)
intrinsics (CameraIntrinsics)
- olo.vision.deproject(depth_image, pixel, intrinsics, *, window_size=1, min_depth_metres=None, max_depth_metres=None)[source]¶
Sample and deproject a depth point, preserving frame metadata.
- Return type:
- Parameters:
- olo.vision.deproject_region(depth_image, region, intrinsics, *, aggregation='median', min_valid_pixels=1, min_depth_metres=None, max_depth_metres=None)[source]¶
Deproject a depth region into an aggregated camera-frame observation.
- Return type:
- Parameters:
depth_image (Image)
region (BoundingBox | ndarray)
intrinsics (CameraIntrinsics)
aggregation (Literal['median', 'trimmed_mean'])
min_valid_pixels (int)
min_depth_metres (float | None)
max_depth_metres (float | None)
- olo.vision.deproject_to_frame(observation, *, frames, target_frame, timeout=5.0)[source]¶
Transform a stamped point observation into a target frame.
- Return type:
- Parameters:
observation (PointObservation)
frames (FrameLookup)
target_frame (str)
timeout (float)
- olo.vision.project_point(point, intrinsics)[source]¶
Project a camera-frame point into pixel coordinates.
- Return type:
- Parameters:
point (Point)
intrinsics (CameraIntrinsics)
- olo.vision.project(point, intrinsics)[source]¶
Project a camera-frame point into pixel coordinates.
- Return type:
- Parameters:
point (Point)
intrinsics (CameraIntrinsics)
Control helpers
- olo.vision.pixel_alignment_error(current, target, *, tolerance_px)[source]¶
Return signed pixel error and convergence against a tolerance.
- Return type:
- Parameters:
- olo.vision.position_error(current, target, *, tolerance_m)[source]¶
Return Cartesian
target - currenterror and convergence.- Return type:
- Parameters:
current (Point | PointObservation)
target (Point | PointObservation)
tolerance_m (float)
Tag detection service
- class olo.vision.Vision[source]¶
Bases:
VisionHandleSync wrapper for the Vision gRPC service (topics are taken as fully qualified).
- property calibration: Calibration¶
Return the calibration solvers (hand-eye, intrinsics).
- charuco(board, *, params=None)¶
Return a detector that solves a ChArUco board pose and reports its chessboard corners.
- Return type:
- Parameters:
board (CharucoBoard)
params (DetectorParams | None)
- detect_tags(image, family, *, intrinsics=None, size_m=None, sizes=None, params=None, timeout=30.0)¶
Detect tags of one family in an image.
- Return type:
- Parameters:
image (Image)
family (str)
intrinsics (CameraIntrinsics | None)
size_m (float | None)
params (DetectorParams | None)
timeout (float)
- handle(namespace=None)[source]¶
Return a namespace-scoped handle;
Noneresolves the appliance default robot.- Return type:
- Parameters:
namespace (str | None)
- subscribe_tags(image_topic, family, *, camera_info_topic=None, size_m=None, sizes=None, params=None, timeout=None)¶
Stream detections of one family from a camera topic on this robot.
- tags(family, *, size_m=None, sizes=None, params=None, target=None)¶
Return a detector for one tag family whose topics resolve against this robot.
- Return type:
- Parameters:
family (str)
size_m (float | None)
params (DetectorParams | None)
target (TagLayout | CharucoBoard | None)
- class olo.vision.VisionHandle[source]¶
Bases:
objectNamespace-scoped Vision handle; relative topic names resolve against the robot.
- charuco(board, *, params=None)[source]¶
Return a detector that solves a ChArUco board pose and reports its chessboard corners.
- Return type:
- Parameters:
board (CharucoBoard)
params (DetectorParams | None)
- detect_tags(image, family, *, intrinsics=None, size_m=None, sizes=None, params=None, timeout=30.0)[source]¶
Detect tags of one family in an image.
- Return type:
- Parameters:
image (Image)
family (str)
intrinsics (CameraIntrinsics | None)
size_m (float | None)
params (DetectorParams | None)
timeout (float)
- subscribe_tags(image_topic, family, *, camera_info_topic=None, size_m=None, sizes=None, params=None, timeout=None)[source]¶
Stream detections of one family from a camera topic on this robot.
- tags(family, *, size_m=None, sizes=None, params=None, target=None)[source]¶
Return a detector for one tag family whose topics resolve against this robot.
- Return type:
- Parameters:
family (str)
size_m (float | None)
params (DetectorParams | None)
target (TagLayout | CharucoBoard | None)
- class olo.vision.TagDetector[source]¶
Bases:
objectA tag family plus physical sizes, bound to the appliance detector.
Holds configuration only; detection runs on the appliance.
size_mis the default edge length andsizesoverrides it per marker id. Without a size, tags are reported with corners but no pose. Atarget(aTagLayoutorCharucoBoard) is additionally solved as one pose per frame, reported onTagFrame.target_transform.- __init__(vision, family, *, size_m=None, sizes=None, params=None, target=None, namespace=None)[source]¶
Validate the family and capture sizes; nothing is sent until a call is made.
- Parameters:
vision (Vision)
family (str)
size_m (float | None)
params (DetectorParams | None)
target (TagLayout | CharucoBoard | None)
namespace (str | None)
- Return type:
None
- detect(image, *, intrinsics=None, timeout=30.0)[source]¶
Detect tags in an image the caller already holds.
- Return type:
- Parameters:
image (Image)
intrinsics (CameraIntrinsics | None)
timeout (float)
- class olo.vision.TagStream[source]¶
Bases:
objectContext-managed sync iterator over a Vision.SubscribeTags server stream.
Tag detection types
- olo.vision.TagFamily¶
alias of
Literal[‘aruco_4x4_50’, ‘aruco_4x4_100’, ‘aruco_4x4_250’, ‘aruco_4x4_1000’, ‘aruco_5x5_50’, ‘aruco_5x5_100’, ‘aruco_5x5_250’, ‘aruco_5x5_1000’, ‘aruco_6x6_50’, ‘aruco_6x6_100’, ‘aruco_6x6_250’, ‘aruco_6x6_1000’, ‘aruco_7x7_50’, ‘aruco_7x7_100’, ‘aruco_7x7_250’, ‘aruco_7x7_1000’, ‘aruco_original’, ‘apriltag_16h5’, ‘apriltag_25h9’, ‘apriltag_36h10’, ‘apriltag_36h11’, ‘qr_code’]
- olo.vision.TAG_FAMILIES = ('aruco_4x4_50', 'aruco_4x4_100', 'aruco_4x4_250', 'aruco_4x4_1000', 'aruco_5x5_50', 'aruco_5x5_100', 'aruco_5x5_250', 'aruco_5x5_1000', 'aruco_6x6_50', 'aruco_6x6_100', 'aruco_6x6_250', 'aruco_6x6_1000', 'aruco_7x7_50', 'aruco_7x7_100', 'aruco_7x7_250', 'aruco_7x7_1000', 'aruco_original', 'apriltag_16h5', 'apriltag_25h9', 'apriltag_36h10', 'apriltag_36h11', 'qr_code')¶
Built-in immutable sequence.
If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.
If the argument is a tuple, the return value is the same object.
- class olo.vision.TagFrame[source]¶
Bases:
objectDetections from one source image, stamped with that image’s header.
- __init__(frame_id, stamp, width, height, tags=(), qr_codes=(), target_transform=None, target_reprojection_error_px=0.0, charuco_corners=())¶
- Parameters:
frame_id (str)
stamp (datetime | None)
width (int)
height (int)
tags (tuple[TagDetection, ...])
qr_codes (tuple[QrCodeDetection, ...])
target_transform (Transform | None)
target_reprojection_error_px (float)
charuco_corners (tuple[CharucoCorner, ...])
- Return type:
None
- charuco_corners: tuple[CharucoCorner, ...]¶
Interpolated chessboard corners; only for ChArUco targets.
- property detections: tuple[TagDetection | QrCodeDetection, ...]¶
Return every detection regardless of kind.
- class olo.vision.TagDetection[source]¶
Bases:
_DetectionOne decoded ArUco or AprilTag marker.
- __init__(*, corners, transform=None, reprojection_error_px=0.0, family, id)¶
- property box: BoundingBox¶
Return the axis-aligned box around the corners, ready for the depth helpers.
- class olo.vision.QrCodeDetection[source]¶
Bases:
_DetectionOne decoded QR code.
- __init__(*, corners, transform=None, reprojection_error_px=0.0, data)¶
- property box: BoundingBox¶
Return the axis-aligned box around the corners, ready for the depth helpers.
- class olo.vision.DetectorParams[source]¶
Bases:
objectOptional detector tuning;
Nonekeeps the appliance default.- __init__(min_marker_perimeter_rate=None, max_marker_perimeter_rate=None, error_correction_rate=None)¶
Targets (layouts and boards)
- class olo.vision.TagLayout[source]¶
Bases:
objectRigid arrangement of markers solved as one pose.
markersmaps a marker id to its four corners (TL, TR, BR, BL) in the layout’s body frame, in metres. A grid board, a cube or a docking jig are all layouts; usegrid_layout()for the common planar grid.- __init__(markers, frame_name='tag_layout')¶
- olo.vision.grid_layout(columns, rows, marker_m, gap_m, ids, *, frame_name='tag_layout')[source]¶
Planar grid of markers, row-major from the top-left, centred on the board.
The layout frame has X right, Y up and Z toward the viewer, matching the per-tag convention, so a single-marker grid coincides with that tag’s frame.
- class olo.vision.CharucoBoard[source]¶
Bases:
objectChessboard with markers in the white squares; its interpolated corners give precise poses.
- __init__(squares, square_m, marker_m, family, frame_name='charuco_board')¶
- class olo.vision.CharucoCorner[source]¶
Bases:
objectOne interpolated chessboard corner of a ChArUco board.
Calibration
- class olo.vision.Calibration[source]¶
Bases:
objectThin wrappers over the Vision calibration RPCs.
- calibrate_intrinsics(frames, board, *, timeout=30.0)[source]¶
Calibrate pinhole intrinsics from ChArUco frames captured across varied views.
- Return type:
- Parameters:
board (CharucoBoard)
timeout (float)
- solve_hand_eye(samples, *, mounting='eye_in_hand', timeout=30.0)[source]¶
Solve the camera mounting with Tsai-Lenz from at least three varied samples.
Eye-in-hand (camera on the arm, target fixed) returns link -> camera; eye-to-hand (camera fixed, target on the arm) returns base -> camera. Both are ready for
frames.publish_staticonce given frame ids.- Return type:
- Parameters:
samples (Sequence[HandEyeSample])
mounting (Literal['eye_in_hand', 'eye_to_hand'])
timeout (float)
- class olo.vision.HandEyeSample[source]¶
Bases:
objectOne synchronised observation: the arm link pose and the target pose at the image stamp.
- __init__(base_to_link, camera_to_target)¶
- classmethod from_frame(frame, frames, base_frame, link, *, timeout=5.0)[source]¶
Pair a frame’s target pose with the link pose looked up at that frame’s stamp.
Looking TF up at the image stamp, not at call time, is what makes the pair valid; dwell before capturing so both are still.
- Return type:
- Parameters:
- class olo.vision.HandEyeResult[source]¶
Bases:
objectSolved camera mounting plus per-sample consistency residuals.
- __init__(transform, residual_translation_m, residual_rotation_rad)¶
Import from olo/vision:
Types
Pixel Zero-based image pixel coordinate.
BoundingBox Half-open image bounding box with XYXY pixel coordinates.
CameraIntrinsics Pinhole camera calibration parsed from
sensor_msgs/CameraInfo.PointObservation Stamped 3D point observation in an image-derived frame.
AlignmentError Image-space alignment error.
PositionError Cartesian position error.
Options
Camera geometry helpers
Control helpers
Tag detection service
Vision Async wrapper for the Vision gRPC service.
VisionHandle Namespace-scoped handle; relative topics resolve against the robot.
TagDetector One tag family plus physical sizes, bound to the appliance detector.
TagStream Async iterator over streamed tag frames.
Tag detection types
Tag helpers
Targets (layouts and boards)
Calibration
Calibration Tsai-Lenz hand-eye and ChArUco intrinsics solvers.