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.
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:
ros2gazebomyo-armbandemgsemggesture-controlroboticssimulationscikit-learnpythoncppfoxy
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.
- 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.txtand Conda packages fromrequirements.yml
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/modelsIf 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_deffolder in your home directory, otherwise adjust the paths in~/.bashrc. - Replace
"user"with your username everywhere it appears.
Build the C++ package first:
colcon build --packages-select my_arm_def_cpp_pkg
source ~/.bashrcThen 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 ~/.bashrcpython3 main.py| 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 |
- Capture_EMG_Data — sEMG data acquisition.
- Train_Myo_Signals — classifier training and comparison.
All modules are in an alpha phase — contributions and improvements are welcome. Open an issue or a pull request.
Caio Lima — UFABC · clima@ufabc.edu.br GitHub · LinkedIn · ResearchGate · Lattes