Skip to main content

Myo EMG-based KT system for ROS

Project description

MyoKTROS

Build Status Python Versions PyPI Version License

Myo EMG-based KT system for ROS.

Installation

PIP

pip install -U myoktros

Poetry

git clone https://github.com/Interactions-HSG/MyoKTROS.git && cd MyoKTROS
poetry install
poetry run myoktros

Usage

% myoktros -h
usage: myoktros [-h] [--mode {keras,legacy}] [-a ADDRESS] [-d] [-m MAC] [--legacy_n_samples LEGACY_N_SAMPLES] [--legacy_n_periods LEGACY_N_PERIODS] [-p PORT]

Myo EMG-based KT system for ROS

options:
  -h, --help            show this help message and exit
  --mode {keras,legacy}
                        mode to select (default: keras)
  -a ADDRESS, --address ADDRESS
                        the IP address for the ROS server (default: 127.0.0.1)
  -d, --debug           sets the log level to debug (default: False)
  -m MAC, --mac MAC     specify the Myo's mac address (default: None)
  --legacy_n_samples LEGACY_N_SAMPLES
                        number of samples for the legacy classifier (default: 3)
  --legacy_n_periods LEGACY_N_PERIODS
                        number of sampling periods for the legacy classifier (default: 10)
  -p PORT, --port PORT  the port for the ROS server (default: 8765)

Legacy Mode

Use with the legacy k-NN classifier with sampling normalization.

First generate the classifier

poetry run scripts/train_legacy_classifier.py

then run with --mode legacy

poetry run myoktros --mode legacy

Train the gesture classifier model

  1. scripts/record_myo_data.py records the EMG stream to a CSV file in /assets.
% poetry run scripts/record_myo_data.py -h
usage: record_myo_data.py [-h] [--emg_mode {1,2,3}] [--mac MAC] [--seconds SECONDS] N

Record train data from Myo's data stream

positional arguments:
  N                   the gesture to record (the enum value of myoktros.Gesture)

options:
  -h, --help          show this help message and exit
  --emg_mode {1,2,3}  set the myo.EMGMode (1: filtered/rectified, 2: filtered/unrectified, 3: unfiltered/unrectified) (default: 1)
  --mac MAC           the Myo's mac address (default: None)
  --seconds SECONDS   the duration to record in seconds (default: 30)

for example,

❯ poetry run scripts/record_myo_data.py 3
2023-06-14 21:08:42,227 __main__ INFO: scanning for a Myo device...
2023-06-14 21:08:45,104 myoktros.myo_client INFO: connected to Myonnaise
2023-06-14 21:08:45,104 __main__ INFO: connected to a Myo
2023-06-14 21:08:45,108 myoktros.myo_client INFO: setting up the myo: Myonnaise
2023-06-14 21:08:45,133 myoktros.myo_client INFO: remaining battery: 91 %
2023-06-14 21:08:45,343 __main__ INFO: start recording BEND_WRIST data with SEND_FILT for 30 seconds
2023-06-14 21:08:47,345 myoktros.myo_client INFO: start notifying from Myonnaise
2023-06-14 21:09:17,545 myoktros.myo_client INFO: stopped notification from Myonnaise
2023-06-14 21:09:17,546 myoktros.myo_client INFO: sleep Myonnaise
2023-06-14 21:09:18,115 __main__ INFO: saved the recorded data to /Users/iomz/ghq/github.com/Interactions-HSG/MyoKTROS/data/SEND_FILT-BEND_WRIST-20230614210845.csv
  1. scripts/ builds a Keras.Sequential model based on the CSV files from 1.

Authors

  • Iori Mizutani (@iomz)
  • Felix Wohlgemuth

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

myoktros-0.0.2.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

myoktros-0.0.2-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file myoktros-0.0.2.tar.gz.

File metadata

  • Download URL: myoktros-0.0.2.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for myoktros-0.0.2.tar.gz
Algorithm Hash digest
SHA256 c9ce9d0e8ecf06a6ef6b197772db1111e0e389efdd826aa9938c6415414649cd
MD5 4ed4c748d765a311192036be0d4531f0
BLAKE2b-256 138d8ae66080290f9916743dea275ac3992f0fd0dd96e9e2b27a5296bbe247f2

See more details on using hashes here.

File details

Details for the file myoktros-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: myoktros-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for myoktros-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 15f62afd450875d1c385c15521966620eb369c77dd8d25dddb33d3dc75df7ae3
MD5 8610db9e4538abb26f58e0aaec5e31f1
BLAKE2b-256 3e7173f1bf3de37ae7644f2a9e489869be431709df6be982256790877e3e06eb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page