FlexiForce simulates a personalized fitness and rehabilitation system where a redundant robotic arm (Franka Emika FP3) dynamically adjusts resistance based on real-time EMG data. Using MuJoCo for robotic simulation and OpenSim for muscle modeling, it implements a hybrid force-position controller that modulates end-effector resistance to keep user exertion aligned with a target % of max voluntary contraction.
Key Highlights:
- GUI for user-defined effort
- Real-time EMG feedback
- Redundant robot arm simulation
- Modular controllers for benchmarking
- Closed-loop EMG feedback control
- Real-time GUI-based effort input
- Force-position hybrid control architecture
- Support for both OpenSim and custom muscle models
- Performance-optimized simulation in MuJoCo
[ GUI Input (Target Effort) ]
↓
[ Controller: Hybrid Force-Position ]
↓
[ MuJoCo Robot Arm ] ←→ [ OpenSim / EMG Model ]
↑ ↓
[ Force Output ] ←── Feedback Loop ──→ [ EMG Activation ]
git clone --recurse-submodules https://github.com/aaronjohnsabu1999/flexiforce.git
cd flexiforceIf you forgot --recurse-submodules:
git submodule update --init --recursivepython -m venv venvActivate it:
- macOS/Linux:
source venv/bin/activate - Windows:
venv\Scripts\activate
pip install -r requirements.txtsudo apt update && sudo apt install -y python3-tkTkinter is bundled with Python. To check:
python -m tkintersudo apt update
sudo apt install -y python3-tk libgl1-mesa-glx libglu1-mesa mesa-utilsInstall and start VcXsrv:
- ✅ Multiple windows
- ✅ Start no client
- ✅ Disable access control
- 🔁 Try both with/without Native OpenGL
In ~/.bashrc or before running:
export DISPLAY=:0
export LIBGL_ALWAYS_INDIRECT=0Reload with:
source ~/.bashrcglxgearsIf gears spin, OpenGL is working.
python3 main.py- ✅ GUI will open via Tkinter
- ✅ MuJoCo viewer will render (if OpenGL works)
- 🔁 Headless fallback if viewer fails
- No MuJoCo viewer? Ensure VcXsrv is running and
DISPLAYis set. - OpenGL errors? Try
export LIBGL_ALWAYS_INDIRECT=1 - Still broken? Run in native Windows with Python + MuJoCo setup.
MIT License. See LICENSE.md.
- Ben Forbes
- Samantha Herman
- Aaron John Sabu
Course project for MAE 263C – University of California, Los Angeles
MIT License. See LICENSE.md for details.
- Dr. Veronica Santos – MAE 263C
- OpenSim and MuJoCo dev teams
- Everyone who tolerates noisy EMG data and still finds signal in the chaos
