Skip to content

Calima94/my_arm_def

Repository files navigation

my_arm_def — ROS 2 arm controlled by Myo armband sEMG

Simulation of an upper-limb arm in ROS 2 + Gazebo, driven by hand/arm gestures classified from Myo armband surface-EMG (sEMG) signals. Pre-trained scikit-learn classifiers map the incoming sEMG to gestures, which command the simulated arm in real time.

Simulação de um braço (membro superior) em ROS 2 + Gazebo, controlada por gestos classificados a partir de sinais de sEMG do bracelete Myo. Classificadores do scikit-learn já treinados mapeiam o sEMG recebido em gestos, que comandam o braço simulado em tempo real.

This is the deployment stage of a three-part pipeline:

Capture_EMG_Data  ──►  Train_Myo_Signals  ──►  my_arm_def
  (record sEMG)         (train classifiers)     (control the ROS 2 / Gazebo arm)
  • Capture_EMG_Data — records the labeled sEMG data.
  • Train_Myo_Signals — trains and compares the classifiers.
  • my_arm_def (this repo) — runs the trained models against live Myo input to drive the arm.

⚠️ All modules are in alpha. Contributions and improvements are very welcome.


Suggested repository metadata

Set these on GitHub (the "About" gear, top-right):

  • Description: ROS 2 + Gazebo simulation of an upper-limb arm controlled by Myo armband sEMG gestures, using pre-trained scikit-learn classifiers.
  • Topics: ros2 gazebo myo-armband emg semg gesture-control robotics simulation scikit-learn python cpp foxy

Bundled classifiers

The repo ships pre-trained models (.joblib) built from the author's own EMG data:

File Model
gnb_teste.joblib Gaussian Naive Bayes
lda_teste.joblib Linear Discriminant Analysis
lin_svm_teste.joblib Linear SVM
neigh_teste.joblib k-Nearest Neighbors
tree_teste.joblib Decision Tree

To use your own data, capture it with Capture_EMG_Data and train new classifiers with Train_Myo_Signals.

Requirements

  • Linux (tested on Ubuntu 20.04)
  • ROS 2 Foxy
  • Gazebo 11
  • ROS 2 ↔ Gazebo integration libraries — see the Gazebo + ROS 2 tutorial
  • Python packages from requirements.txt and Conda packages from requirements.yml

Setup

Add the following to your ~/.bashrc:

source /opt/ros/foxy/setup.bash
source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash
source ~/my_arm_def/install/setup.bash
export GAZEBO_RESOURCE_PATH=/usr/share/gazebo-11:/usr/share/gazebo_models:${GAZEBO_RESOURCE_PATH}
export GAZEBO_PLUGIN_PATH=${GAZEBO_PLUGIN_PATH}:~/my_arm_def/install/my_arm_def_cpp_pkg/lib
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:~/my_arm_def/src/my_arm_def_cpp_pkg/models

If you use a Conda environment, also add the standard conda-initialize block to ~/.bashrc (replace "user" with your actual username):

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/"user"/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/home/"user"/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/home/"user"/anaconda3/etc/profile.d/conda.sh"
    else
        export PATH="/home/"user"/anaconda3/bin:$PATH"
    fi
fi
# <<< conda initialize <<<

Notes:

  • Install the my_arm_def folder in your home directory, otherwise adjust the paths in ~/.bashrc.
  • Replace "user" with your username everywhere it appears.

Build

Build the C++ package first:

colcon build --packages-select my_arm_def_cpp_pkg
source ~/.bashrc

Then build the remaining packages in this order:

colcon build --packages-select my_arm_def_interfaces
colcon build --packages-select my_arm_def_py_pkg --symlink-install
colcon build --packages-select my_arm_definitive_bringup --symlink-install
source ~/.bashrc

Run

python3 main.py

Repository layout

Path Purpose
src/ ROS 2 packages (my_arm_def_cpp_pkg, my_arm_def_interfaces, my_arm_def_py_pkg, my_arm_definitive_bringup)
main.py Application entry point
teste_gazebo_launcher.py, teste_gazebo_launcher.ui PyQt5 launcher for the Gazebo simulation
common.py Shared helpers
myo-raw/ Myo communication backend
*_teste.joblib Pre-trained classifiers
requirements.txt, requirements.yml pip and Conda dependencies
build/, install/, log/ colcon workspace artifacts

Related projects

Contributing

All modules are in an alpha phase — contributions and improvements are welcome. Open an issue or a pull request.

Author

Caio Lima — UFABC · clima@ufabc.edu.br GitHub · LinkedIn · ResearchGate · Lattes

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors