Skip to content

CyberOrigin2077/open_cyber_glove

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenCyberGlove SDK

Discord Notion Website
GitHub stars License

An open-source Python SDK for interfacing with data gloves, supporting real-time sensor data acquisition, calibration, and extensible inference. Designed for robotics, VR/AR, and HCI applications.

OpenCyberGlove Banner

Features

  • Connect to one or two data gloves via serial port (1Mbps baudrate)
  • Real-time sensor data acquisition at 120Hz
  • Comprehensive sensor data including:
    • 19 tensile sensors
    • Temperature sensor
    • Timestamp
  • Extensible inference interface for custom models

For more product info, refer to here.

Installation

From Source

git clone https://github.com/CyberOrigin2077/open_cyber_glove.git
cd open_cyber_glove
conda create --name ocg python=3.9
conda activate ocg
pip install -e .

Dependencies

The package requires:

  • Python 3.7+
  • pyserial
  • numpy
  • matplotlib
  • tqdm
  • open3d

Usage

Here are a few examples of how to use the OpenCyberGlove SDK.

Basic Usage: Single Glove

This example shows how to connect to a single glove, calibrate it, and read raw sensor data.

from open_cyber_glove.sdk import OpenCyberGlove

# Initialize SDK for a single left glove.
# Replace '/dev/ttyUSB0' with your glove's serial port.
sdk = OpenCyberGlove(left_port='/dev/ttyUSB0')

# Start the background data reader.
sdk.start()

# Calibrate the glove. This is an interactive process.
print("Starting calibration...")
sdk.calibrate()
print("Calibration finished.")

# Get the latest sensor data packet.
sensor_data = sdk.get_data('left')
print(f"Timestamp: {sensor_data.timestamp}")
print(f"Tensile data: {sensor_data.tensile_data}")
print(f"Accelerometer: {sensor_data.acc_data}")

# Stop the data reader.
sdk.stop()

Real-Time 3D Hand Visualization

The examples/hello_world.py script provides a complete demonstration of the SDK's capabilities, including real-time hand pose inference and 3D visualization. It reads data from one or two gloves, feeds it into a pre-trained ONNX model to infer joint angles, and then visualizes the hand's movement in a 3D environment using Open3D.

To run the example, use the following command structure, providing the serial ports for your gloves and paths to the model files. For model files, you need to download from here and put them under model directory.

Example command for dual gloves:

python3 -m examples.hello_world --right_port ${RIGHT_PORT} --left_port ${LEFT_PORT} --calib_path ${HAND_MODEL} --model_path ${MODEL_PATH}

You can also run it with a single glove:

python3 -m examples.hello_world --right_port ${RIGHT_PORT} --calib_path ${HAND_MODEL} --model_path ${MODEL_PATH}

The script will first guide you through the interactive calibration process for each connected glove. After calibration, a 3D visualization window will appear, showing the real-time movement of the hand(s).

Note: The quality of the visualization significantly depends on the model and proper calibration.

ROS2 Wrapper

For ROS2 integration, we provide a dedicated wrapper package that enables seamless integration with the Robot Operating System 2 (ROS2) ecosystem. This wrapper allows you to publish glove data as ROS2 messages and integrate with other ROS2 nodes.

For detailed installation instructions, usage examples, and available ROS2 message types, please visit our ROS2 wrapper repository: OpenCyberGlove ROS2 Wrapper

We also offer a dedicated wrapper for retargeting glove motions to specific robotic hands: OpenCyberGlove Retarget ROS2

Data Structure

The GloveSensorData class provides structured access to all sensor data:

  • tensile_data: Tuple of 19 integers (0-16384)
  • acc_data: Tuple of 3 floats (To be added)
  • gyro_data: Tuple of 3 floats (To be added)
  • mag_data: Tuple of 3 floats (To be added)
  • temperature: Float
  • timestamp: Integer

Roadmap

  • Core functionality
  • ROS2 wrapper
  • Glove in simulation
  • Model finetune pipeline

License

BSD 3-Clause License