This repository contains code and exercises for the hands-on session with HEBI motors.
You will implement and test a virtual spring–mass–damper (SMD) system on a real motor.
- Python 3.9+
- HEBI Python API (
hebi-py) matplotlib(for plotting)scipy(for simulations)numpy(pinned to 1.26.0 for compatibility)
-
Clone this repository and move into the folder:
git clone https://github.com/smartrobotsdesignlab/tmej_smd_hebi.git cd tmej_smd_hebi -
Create a virtual environment (recommended):
python3 -m venv venv
source venv/bin/activate # (Linux/Mac)
venv\Scripts\activate # (Windows)- Install dependencies:
pip install -r requirements.txtThis will ensure numpy==1.26.0 is used.
⚠️ NumPy Compatibility Note If you see an error like:
A module that was compiled using NumPy 1.x cannot be run in NumPy 2.xIt means your environment upgraded to NumPy 2.x. Fix it by forcing NumPy 1.26.0:
pip install numpy==1.26.0- Open one of the example scripts (e.g. SMDStepSim.py).
- Adjust parameters (k, c, m)
- Run the script and observe behaviour:
python SMDStepSim.py- The motor initializes with its current position as the zero reference.
- Safety limits (max torque, max displacement) are included to protect hardware.
- 🎉 Have fun experimenting with the virtual spring–mass–damper system and comparing theory vs. practice!