Interface to connect to touch sensors
Project description
OpenTouch Interface
The OpenTouch Interface is 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.
Features
We currently offer a unified API along with a simple web interface for the following touch sensors:
Key features include:
- Unified API: Interact with multiple types of touch sensors using a single, consistent API.
- Web Dashboard: Manage sensors, record and replay data, and annotate data directly through a web interface.
- Easy Configuration: Use YAML config files to quickly set up and manage sensors.
Installation
OpenTouch Interface requires Python 3.8 or higher and has been tested on Ubuntu 20.04.
You can install it in one of two ways: either via pip
or by cloning the repository.
Method 1: Install via pip
pip install opentouch-interface
Method 2: Install via Cloning the Repository
git clone https://github.com/lasr-lab/opentouch-interface
cd opentouch-interface
pip install .
Example of Setting Up a Virtual Environment with Python 3.8
If you are using a system with multiple Python versions, you can create a virtual environment with Python 3.8 like this:
python3.8 -m venv venv
source venv/bin/activate
Then, proceed with the installation using one of the methods above.
Additional Sensor-Specific Dependencies
Depending on the specific sensors you are using, make sure you have all their necessary libraries installed by checking the installation guides of the respective sensors or by following this quick installation guide:
pip install digit-interface
Supported by default
Connecting Sensors
You can connect touch sensors to the OpenTouch Interface in two main ways:
1. Dashboard (Web Interface)
The dashboard provides an intuitive web-based interface with the following features:
- Group multiple sensors
- Record and replay data
- Annotate data with user input
To start the dashboard, run:
opentouch-dashboard
If you encounter any errors, try reconnecting your sensors and restarting the dashboard.
Adding Sensors to the Dashboard
You can add sensors to the dashboard by:
- Manual Entry: Enter sensor details directly in the dashboard.
- YAML Configuration: Use a YAML config file to define sensor groups and settings.
When using the dashboard, sensors are assigned to one group exactly.
Therefore, sensor names must be unique inside a group.
An example config file is provided as group.yaml
.
It is structured as follows:
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
Currently, the following sensors with their respective config files are supported:
- Digit
# Mandatory
sensor_type: "DIGIT" # Use "DIGIT".
sensor_name: "First Gripper" # Sensor name (unique inside a group).
serial_id: "D20804" # Sensor's serial ID.
# Optional
intensity: 15 # LED brightness (0-15). Default: 15.
resolution: "QVGA" # Image resolution (VGA/QVGA). Default: QVGA.
fps: 60 # Frame rate (30/60). Default: 60.
sampling_frequency: 30 # Data request rate (Hz). Default: 30.
recording_frequency: 30 # Recording rate (Hz). Default: sampling_frequency.
- GelSight Mini
# Mandatory
sensor_type: "GELSIGHT_MINI" # Use "GELSIGHT_MINI".
sensor_name: "Second Gripper" # Sensor name (arbitrary).
# Optional
sampling_frequency: 30 # Data request rate (Hz). Default: 30.
recording_frequency: 30 # Recording rate (Hz). Default: sampling_frequency.
You can use the following elements for user input:
type: slider # Use 'slider'.
label: "Difficulty" # Label that will be displayed to the user.
min_value: -10 # Minimum value (int). Default: 0.
max_value: 20 # Maximum value (int). Default: 10.
default: 8 # Default value (int). Default: 0.
type: text_input # Use 'text_input'.
label: "Grasped object" # Label that will be displayed to the user.
default: "apple" # Default value (str). Default: "".
2. Using Code
For users who prefer a programmatic approach, the OpenTouch Interface also allows direct interaction through code.
You can instantiate sensors and configure them using a config file. Here’s how to run an example script that produces a continuous video stream from a touch sensor:
python examples/simple/demo.py
By default, this script uses the digit.yaml
config file. You can modify this in the config.yaml
or specify a different config file via the terminal:
python examples/simple/demo.py sensor=<your-yaml-config>
As the interface internally uses Hydra, all attributes in the config file can be modified via the terminal. For instance, to update the serial ID of your Digit sensor, run:
python examples/simple/demo.py sensor=digit sensor.serial_id=<your-serial-id>
Features
For a complete overview of features, refer to the methods defined in the TouchInterface
class. To understand the underlying implementation, check out the specific sensor classes, such as the Digit
.
Limitations
Currently, the code interface does not support grouping of multiple sensors, data annotations or the replay of recorded data. For that, please use the dashboard.
Limitations
- No Grouping in Code Interface: The code interface currently does not support the grouping of multiple sensors.
- Limited Data Annotation and Replay: Data annotations and replay of recorded data are only available through the dashboard.
Contribution
If you want to contribute to OpenTouch Interface, you can find an explanation on how to do so here.
License
This project is licensed under the MIT License. See the LICENSE file for more details.
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
File details
Details for the file opentouch_interface-0.1.1.tar.gz
.
File metadata
- Download URL: opentouch_interface-0.1.1.tar.gz
- Upload date:
- Size: 26.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a6acc92a7ce23f0369c4f2d26ebba1c75163cdcc75f42b457a854c7a00299fb |
|
MD5 | 0ab6dc8649ded57798ae67c37f296c37 |
|
BLAKE2b-256 | 0400375964192a61da3b6746f827c143656e95c1efae1298bd32c6e54787f28f |
File details
Details for the file opentouch_interface-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: opentouch_interface-0.1.1-py3-none-any.whl
- Upload date:
- Size: 39.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f04e45feacde347ffa16905c007cccae4e360c90d7f3cc5d7b7281b5a01cebf |
|
MD5 | d6170b89476f3042782006d7b7c11637 |
|
BLAKE2b-256 | bc3a9737606c5a4278d384a1397131c43c4ce8bec57a9dacb0ca8a2a798986ab |