Skip to main content

SDK for egocentric data collection with OMGrab hardware

Project description

OMGrab SDK

SDK for egocentric data collection on the OMGrab streaming device. Captures time-synced RGB + depth video streams from OAK-D cameras, with IMU data, and writes merged MKV files to local storage.

Installation

pip install omgrab

Overview

The OMGrab SDK provides the core runtime for egocentric data collection on the OMGrab streaming device. The SDK is used to build the core runtime application, which supports:

  • User activated recording start/stop on physical button press
  • Minute-chunked clip recording of various stream types to disk for crash safety
  • Automatic recording chunk merging into a standardized MKV container on stop
  • OLED status display with camera preview mode
  • WiFi hotspot for authentication
  • Automatic network and device health monitoring
  • Network file share of completed recordings using Samba

Key components

  • devices -- hardware capture device abstraction (CaptureDevice protocol)
  • cameras -- frame sources for RGB, depth, and USB cameras
  • sensors -- non-video data sources (e.g., IMU)
  • recording -- chunked MKV writing with multi-stream support
  • runtime -- recording lifecycle, network monitoring, device status
  • workflows -- state machine coordinating the full device lifecycle
  • gpio -- LED, buzzer, and button control
  • display -- OLED status dashboard and live camera preview

Quick start

This example initializes an OAK-D camera, captures 10 seconds of synchronized RGB + depth video, and writes the result to a single MKV file on disk.

import pathlib

from omgrab.cameras import CameraConfig
from omgrab.devices import OakDCaptureDevice
from omgrab.recording import ChunkedWriter, VideoStreamConfig

# 1. Configure cameras and streams
rgb_config = CameraConfig(fps=25, width=1280, height=800)
depth_config = CameraConfig(fps=25, width=640, height=400)

output_dir = pathlib.Path('./my_recording')
output_dir.mkdir(exist_ok=True)

video_streams = {
    'rgb': VideoStreamConfig(
        width=rgb_config.width,
        height=rgb_config.height,
        fps=rgb_config.fps,
        codec='libx264',
        bitrate=4_000_000,
        input_pixel_format='rgb24',
        output_pixel_format='yuv420p',
        metadata={'type': 'rgb'},
    ),
    'depth': VideoStreamConfig(
        width=depth_config.width,
        height=depth_config.height,
        fps=depth_config.fps,
        codec='ffv1',
        input_pixel_format='gray16le',
        output_pixel_format='gray16le',
        metadata={'type': 'depth'},
    ),
}

# 2. Initialize the capture device
device = OakDCaptureDevice(rgb_config, depth_config)

# 3. Initialize the writer and get encoder queues
writer = ChunkedWriter(
    name='my_recording',
    output_directory=output_dir,
    stream_configs=video_streams,
    chunk_length_s=60.0,
)
rgb_queue = writer.get_encoder_queue('rgb')
depth_queue = writer.get_encoder_queue('depth')

# 4. Record frames from the capture device to disk
with device:
    device.wait_until_ready(timeout=10.0)
    rgb_camera = device.get_rgb_camera()
    depth_camera = device.get_depth_camera()

    with writer:
        for _ in range(25 * 10):  # 10 seconds at 25 fps
            rgb_frame, rgb_ts = rgb_camera.get_next_frame(timeout_s=1.0)
            depth_frame, depth_ts = depth_camera.get_next_frame(timeout_s=1.0)

            rgb_queue.put((rgb_frame, rgb_ts), block=False)
            depth_queue.put((depth_frame, depth_ts), block=False)

Device runtime

The app/ directory contains the runtime application that deploys the SDK as a Docker container on the OMGrab device.

Prerequisites

  • OMGrab streaming device (ARM64)
  • OAK-D Wide or OAK-D Pro Wide camera

Installation on device

sudo ./setup/install.sh --device-id my-device-001

The installer provisions a Raspberry Pi from scratch: installs Docker, builds the container image, sets up systemd services, configures Samba, and enables I2C.

Usage

  • Short press: Start/stop recording
  • Double press (idle): Camera preview on OLED
  • Long press (5+ seconds): WiFi reconfiguration portal

Recordings are saved as merged MKV files in /opt/omgrab/data/spool/output/ and shared over the network via Samba at smb://<hostname>.local/omgrab.

Managing the service

sudo systemctl start omgrab       # Start
sudo systemctl stop omgrab        # Stop
sudo systemctl status omgrab      # Check status
sudo journalctl -u omgrab -f      # Follow logs

Uninstallation

sudo ./setup/uninstall.sh

Scripts

Utility scripts in scripts/:

  • dashboard.py -- Live terminal dashboard showing device status, recording state, and system metrics
  • gpio_hardware_test.sh -- Hardware test for GPIO button, LED, and buzzer
  • mkv_viewer.py -- Playback tool for viewing recorded MKV files (RGB + depth streams)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

omgrab-0.1.2.tar.gz (402.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

omgrab-0.1.2-py3-none-any.whl (158.9 kB view details)

Uploaded Python 3

File details

Details for the file omgrab-0.1.2.tar.gz.

File metadata

  • Download URL: omgrab-0.1.2.tar.gz
  • Upload date:
  • Size: 402.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for omgrab-0.1.2.tar.gz
Algorithm Hash digest
SHA256 6bd05d89adfac7d4947b91c3a5282d5467bb069cd754a645c9f89afa95df8a58
MD5 fd9a8343f7291bd8a963d98d81e24654
BLAKE2b-256 7bc85cd796a5ca95bc2c6aecbd341f1b94c27be31cf64c07200cc9e65c6575a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for omgrab-0.1.2.tar.gz:

Publisher: release.yml on OMGrab/omgrab-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file omgrab-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: omgrab-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 158.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for omgrab-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9051d50e0d1d35e1516f8c0c397dd77b6d5f9c91f4ad224548999a9f4b767605
MD5 9372bd781b9693148d5ca6f4ae5dfd6d
BLAKE2b-256 36cc36dd1cb4b4d23a27a6636a238e3cbc6be2c857cec357bca01b93db325b42

See more details on using hashes here.

Provenance

The following attestation bundles were made for omgrab-0.1.2-py3-none-any.whl:

Publisher: release.yml on OMGrab/omgrab-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page