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 (
CaptureDeviceprotocol) - 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 metricsgpio_hardware_test.sh-- Hardware test for GPIO button, LED, and buzzermkv_viewer.py-- Playback tool for viewing recorded MKV files (RGB + depth streams)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bd05d89adfac7d4947b91c3a5282d5467bb069cd754a645c9f89afa95df8a58
|
|
| MD5 |
fd9a8343f7291bd8a963d98d81e24654
|
|
| BLAKE2b-256 |
7bc85cd796a5ca95bc2c6aecbd341f1b94c27be31cf64c07200cc9e65c6575a5
|
Provenance
The following attestation bundles were made for omgrab-0.1.2.tar.gz:
Publisher:
release.yml on OMGrab/omgrab-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
omgrab-0.1.2.tar.gz -
Subject digest:
6bd05d89adfac7d4947b91c3a5282d5467bb069cd754a645c9f89afa95df8a58 - Sigstore transparency entry: 1177187837
- Sigstore integration time:
-
Permalink:
OMGrab/omgrab-sdk@324e982f3742a1df8a0cff9d25877fb9b7c988c9 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/OMGrab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@324e982f3742a1df8a0cff9d25877fb9b7c988c9 -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9051d50e0d1d35e1516f8c0c397dd77b6d5f9c91f4ad224548999a9f4b767605
|
|
| MD5 |
9372bd781b9693148d5ca6f4ae5dfd6d
|
|
| BLAKE2b-256 |
36cc36dd1cb4b4d23a27a6636a238e3cbc6be2c857cec357bca01b93db325b42
|
Provenance
The following attestation bundles were made for omgrab-0.1.2-py3-none-any.whl:
Publisher:
release.yml on OMGrab/omgrab-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
omgrab-0.1.2-py3-none-any.whl -
Subject digest:
9051d50e0d1d35e1516f8c0c397dd77b6d5f9c91f4ad224548999a9f4b767605 - Sigstore transparency entry: 1177187934
- Sigstore integration time:
-
Permalink:
OMGrab/omgrab-sdk@324e982f3742a1df8a0cff9d25877fb9b7c988c9 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/OMGrab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@324e982f3742a1df8a0cff9d25877fb9b7c988c9 -
Trigger Event:
release
-
Statement type: