Metadata-Version: 2.5
Name: imuninn
Version: 0.1.0
Summary: PC-side client for iMuninn: turn an iPhone into a network sensor node (camera, IMU, ARKit pose, LiDAR depth)
Project-URL: Homepage, https://imuninn.projects.weijinqi.com
Project-URL: Documentation, https://imuninn.projects.weijinqi.com/python/
Project-URL: Repository, https://github.com/Bardreamaster/imuninn
Project-URL: Issues, https://github.com/Bardreamaster/imuninn/issues
Project-URL: Changelog, https://github.com/Bardreamaster/imuninn/releases
Author: Jinqi Wei
License-Expression: MIT OR Apache-2.0
License-File: LICENSE-APACHE
License-File: LICENSE-MIT
Keywords: arkit,camera,imu,iphone,lidar,mcap,protobuf,rerun,robotics,sensor
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Multimedia :: Video :: Capture
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: System :: Hardware
Requires-Python: >=3.10
Requires-Dist: lz4>=4
Requires-Dist: numpy
Requires-Dist: protobuf>=7.36
Requires-Dist: pyyaml>=6
Requires-Dist: websockets>=13
Requires-Dist: zeroconf>=0.130
Provides-Extra: all
Requires-Dist: av>=12; extra == 'all'
Requires-Dist: mcap-protobuf-support>=0.5; extra == 'all'
Requires-Dist: mcap>=1.2; extra == 'all'
Requires-Dist: mcp>=2; extra == 'all'
Requires-Dist: pillow; extra == 'all'
Requires-Dist: rerun-sdk>=0.20; extra == 'all'
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Provides-Extra: docs
Requires-Dist: griffe==2.4.1; extra == 'docs'
Provides-Extra: mcap
Requires-Dist: mcap-protobuf-support>=0.5; extra == 'mcap'
Requires-Dist: mcap>=1.2; extra == 'mcap'
Provides-Extra: mcp
Requires-Dist: mcp>=2; extra == 'mcp'
Requires-Dist: pillow; extra == 'mcp'
Provides-Extra: rerun
Requires-Dist: av>=12; extra == 'rerun'
Requires-Dist: rerun-sdk>=0.20; extra == 'rerun'
Provides-Extra: video
Requires-Dist: av>=12; extra == 'video'
Description-Content-Type: text/markdown

# imuninn

Python client for [iMuninn](https://imuninn.projects.weijinqi.com): an iPhone app that turns the phone into a network sensor node — camera (H.264), IMU, ARKit 6-DoF pose with per-frame intrinsics, LiDAR depth — served over the LAN with a Protobuf protocol. This package discovers phones, connects, configures them, receives and decodes the streams, records MCAP and visualises in Rerun.

- Documentation: [中文](https://imuninn.projects.weijinqi.com/python/) · [English](https://imuninn.projects.weijinqi.com/en/python/)
- Source: <https://github.com/Bardreamaster/imuninn> (`host/python`)

## Install

```bash
pip install imuninn              # discovery, connection, config, pose / IMU / depth decoding, CLI
pip install "imuninn[all]"       # + video decoding, MCAP, Rerun, MCP server
```

| extra | adds | brings in |
| --- | --- | --- |
| `video` | H.264 decoding to NumPy (`imuninn.video.H264Decoder`) | PyAV |
| `mcap` | `imuninn record / convert / info`, MCAP replay | mcap, mcap-protobuf-support |
| `rerun` | `imuninn rerun` live viewer and MCAP playback | rerun-sdk, PyAV |
| `mcp` | `imuninn-mcp`, an MCP server so agents can drive the phone | mcp, Pillow |

The browser viewer (`imuninn web`) is part of the core package: a static page served from localhost that connects straight to the phone.

Python 3.10+. The phone needs the iMuninn app (iOS; Android camera-only) on the same network, or a USB cable (iPhone shares a link-local network over USB).

## Quick start

```python
import imuninn

for phone in imuninn.discover():            # Bonjour: _imuninn._tcp
    print(phone.name, phone.address)

with imuninn.connect() as dev:              # first phone found; or a name / IP / "ip:port"
    dev.set("imu.rate_hz", 100)             # validated by the phone: applied / clamped / rejected
    dev.start()                             # capture session on
    for pose in dev.iter("ar_pose"):        # also "imu", "rgb", "depth", "health"
        t = dev.to_pc_time(pose.header.device_time_ns)
        print(t, pose.position, pose.intrinsics.fx)
```

Everything is synchronous; the asyncio client (`imuninn.client.PhoneClient`) is there if you want to drive it yourself. Parameters are self-describing (`dev.capabilities`), can be grouped into YAML profiles (`dev.apply_profile("calibration")`), and a config lease keeps several PCs from fighting over one phone.

## Command line

```bash
imuninn list                                 # phones on the LAN
imuninn watch --start                        # print samples as text
imuninn rerun --start --depth                # Rerun viewer: pose, trajectory, video, depth, IMU, health
imuninn record -o run1.mcap                  # record every stream to MCAP
imuninn rerun --mcap run1.mcap               # play it back
imuninn profile apply dataset                # built-in YAML preset
imuninn web                                  # browser viewer at http://localhost:7430 (video, depth, pose, IMU)
imuninn-mcp                                  # MCP server (stdio) for agents
```

All commands take an optional phone target (`iPhone`, `10.0.0.5`, `10.0.0.5:7420`).

## Data

Pose: ARKit convention (right-handed, Y up, camera looks down −Z), with camera intrinsics in every sample. Video: H.264 Annex-B, sensor orientation plus `rotation_deg`. Depth: uint16 millimetres + confidence, LZ4. Timestamps: device monotonic time plus a measured offset to the PC clock. The wire format is `imuninn/proto/imuninn.proto` inside the package.

## License

MIT or Apache-2.0, at your option.
