A research project developing Sim-to-Real adaptive control frameworks using Physics-Informed Neural Networks (PINNs) to compensate for nonlinear friction dynamics in low-cost actuators.
This research addresses the challenge of precise motion control in cost-constrained robotic systems where traditional PID controllers fail to capture complex friction phenomena (Stribeck effect, stiction, Coulomb friction). The core innovation is learning the residual dynamics β the "rust" between ideal models and real hardware β rather than full system identification.
- Physics-Informed Learning: PINN architecture constrained by Stribeck and LuGre friction models
- Sim-to-Real Transfer: Pre-training in differentiable physics simulators before hardware deployment
- Edge Deployment: Sub-10ms inference latency on embedded targets (Teensy 4.1)
- Hybrid Control: Combines classical PID with learned residual compensation
| Constraint | Requirement | Rationale |
|---|---|---|
| Latency | < 10ms control loop | Real-time performance for stable control |
| Compute | Edge-only inference | No PC-in-the-loop; standalone operation |
| Dynamics | Single-joint focus | Proof-of-concept before multi-DOF extension |
| Learning | Sim-to-Real pre-training | Safety; no unsafe exploration on hardware |
PIRL_Adaptive_Control/
βββ sim/ # Differentiable physics simulators & training
β βββ controllers.py # Baseline controllers (PID, PPO, etc.)
β βββ pirl_network.py # Physics-Informed Neural Network
β βββ sim_env.py # Gym-like simulation environment
β βββ train_* # Training scripts
βββ firmware/ # Embedded C++ code for Teensy 4.1
β βββ src/main.cpp # Main control loop
β βββ lib/ # Hardware abstractions
β βββ test/ # Unit tests and validation
βββ notebooks/ # Exploratory analysis & visualization
β βββ 01_Deriving_Stribeck.ipynb
β βββ 02_Differentiable_Physics.ipynb
β βββ 03_Stribeck_PINN.ipynb
βββ models/ # Trained model checkpoints
βββ scripts/ # Export and deployment scripts
βββ docs/ # Theory derivations and manuscripts
βββ data/ # Training and validation datasets
# Clone repository
git clone https://github.com/basyirin-dev/PIRL_Adaptive_Control.git
cd PIRL_Adaptive_Control
# Install Python dependencies
pip install -r requirements.txt
# Run basic simulation test
python -m sim.test_sim# Install PlatformIO for embedded development
pip install platformio
# Build and test firmware
cd firmware
pio run -e native_test
pio test -e native_test# Train baseline PID controller
python scripts/train_and_export.py --controller pid --epochs 100
# Train PIRL hybrid controller
python scripts/train_and_export.py --controller hybrid --epochs 200
# Export to ONNX for deployment
python scripts/export_onnx.py --model models/pirl_model.pth# Basic simulation test
python -m sim.test_sim
# Generate convergence figures
python sim/generate_figure_1.py
# Run ablation studies
python sim/run_asymmetric_ablation.py# Build for Teensy 4.1
pio run -e teensy41
# Upload to hardware
pio run -e teensy41 --target upload
# Monitor serial output
pio device monitor -b 2000000- Stribeck Curve Fitting: RMSE < 0.05 Nm
- Velocity Tracking: < 2% error at 10 Hz
- Convergence: Stable within 500 training episodes
- Control Frequency: 100 Hz (10 ms period)
- Inference Latency: < 100 ΞΌs
- Total Loop Time: < 1 ms (including sensor I/O)
If you use this work in your research, please cite:
@misc{pirl_adaptive_control,
author = {Basyirin Amsyar bin Basri},
title = {Physics-Informed Residual Learning for Adaptive Friction Compensation},
year = {2024},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/basyirin-dev/PIRL_Adaptive_Control}}
}See CITATION.cff for additional citation formats.
Contributions are welcome! Please follow these guidelines:
- Fork the repository
- Create a feature branch (
git checkout -b feature/your-feature) - Commit changes (
git commit -m 'Add your feature') - Push to the branch (
git push origin feature/your-feature) - Open a Pull Request
# Install development dependencies
pip install -r requirements-dev.txt
# Run tests
pytest sim/test_sim.py -v
# Check code formatting
black --check sim/ firmware/- β Phase 1: Simulation & Theory (Complete)
- π§ Phase 2: Hardware Validation (In Progress)
- π Phase 3: Multi-DOF Extension (Planned)
This project is licensed under the MIT License - see the LICENSE file for details.
For questions or collaboration opportunities, please contact:
- Principal Investigator: Basyirin Amsyar bin Basri
- Repository: https://github.com/basyirin-dev/PIRL_Adaptive_Control
Note: This is an active research project. APIs and implementations may change as the project evolves.