Metadata-Version: 2.4
Name: opentouch-interface
Version: 0.2.0
Summary: Interface to connect to touch sensors
Home-page: https://github.com/lasr-lab/opentouch-interface
Author: Roberto Calandra
Author-email: rcalandra@lasr.org
Classifier: Programming Language :: Python :: 3.8
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: streamlit
Requires-Dist: numpy
Requires-Dist: h5py
Requires-Dist: PyYAML
Requires-Dist: hydra-core
Requires-Dist: omegaconf
Requires-Dist: matplotlib
Requires-Dist: packaging
Requires-Dist: decorator
Requires-Dist: pydantic
Requires-Dist: opencv-python
Requires-Dist: streamlit_code_editor
Requires-Dist: onnxruntime
Requires-Dist: cobs
Requires-Dist: torch
Requires-Dist: pyudev
Requires-Dist: betterproto
Requires-Dist: pyserial
Requires-Dist: sounddevice
Requires-Dist: pandas
Requires-Dist: altair
Requires-Dist: onnx
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary


# OpenTouch Interface

A Python package designed to provide a unified interface for various touch sensors. It simplifies the process of interacting with touch sensors by providing a consistent API regardless of the specific sensor being used.

We also provide an easy-to-use web interface that lets you connect to the sensors and show their data stream without the need to code.

---

## Overview
- **Unified API**: Interact with multiple types of touch sensors using a single, consistent API.
- **Web Dashboard**: Manage sensors, record/replay data, and annotate data directly through a web interface.
- **Easy Configuration**: Use YAML config files to quickly set up and manage sensors.

**Supported sensors**:
- [Digit](https://digit.ml/)
- [Digit360](https://digit.ml/digit360.html)
- [GelSight Mini](https://www.gelsight.com/gelsightmini/)

## Installation

OpenTouch Interface requires Python 3.10+ (tested on Ubuntu 24.04).

#### Method 1: Install via `pip`

```bash
pip install opentouch-interface
```

#### Method 2: From source

```bash
git clone https://github.com/lasr-lab/opentouch-interface
cd opentouch-interface
pip install .
```

## Getting started

You can connect touch sensors to the OpenTouch Interface in two main ways:

### 1. Using the Dashboard (Web Interface)

<p align="center">
<img src="./docs/dashboard.gif" alt="dashboard" />
</p>

Start the dashboard. If you run into issues, try reconnecting your sensors and restarting the dashboard.
```bash
opentouch-dashboard
```

#### Adding Sensors to the Dashboard
Add sensors either by manually entering details or by providing a YAML config file. For example, your YAML might look like:
```yaml
group_name: Robotic hand  # Group name.
path: test.touch          # File path where data should be saved (optional).

sensors:      # List of sensors belonging to that group
  - ...       # Sensor 1
  - ...       # Sensor 2

payload:      # List of input elements used for data annotations (optional).
  - ...       # e.g., text input
  - ...       # e.g., slider
```
Sensors are bundled in groups. Within a group **sensor names must be unique**.
An example config file is provided as [`group.yaml`](examples/config/group.yaml). There, you also find example configs of all supported sensors.

The payload can be used for data annotations. You can find an overview of supported widgets at [`payload.md`](docs/payload.md).

### 2. Using Code

For programmatic control, please refer to the [`demo.py`](examples/record_data.py) example.
- Run with the default config ([`digit.yaml`](examples/config/digit.yaml))
    ```bash
    python examples/simple/demo.py
    ```

- Or specify a config file:
    ```bash
    python examples/simple/demo.py --config-name gelsight.yaml
    ```
---

## Contribution
We welcome contributions! Pleaes check out our [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

---

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.
