From-scratch implementations of core robotics algorithms in Python and C++17
Derived, implemented, and validated, one algorithm at a time.
Progress: 1/11 completed
This repository is a structured study of the algorithms behind robot state estimation, mapping, planning, and control. Each algorithm lives in its own folder and is built twice:
| Role | |
|---|---|
| 🐍 Python | Reference implementation, used to work out the math and iterate quickly |
| ⚙️ C++17 + Eigen | Engineering implementation, built with CMake |
Both implementations run on the same scenario data file and are checked against each other, so the C++ version is verified rather than assumed correct.
Legend: ✅ Done · 🚧 In progress · ⬜ Planned
| Algorithm | Python | C++ | Docs |
|---|---|---|---|
| Extended Kalman Filter | ✅ | ✅ | ✅ |
| Unscented Kalman Filter | 🚧 | ✅ | ⬜ |
| Particle Filter | ⬜ | ⬜ | ⬜ |
| Algorithm | Python | C++ | Docs |
|---|---|---|---|
| Graph-Based SLAM | ⬜ | ⬜ | ⬜ |
| Algorithm | Python | C++ | Docs |
|---|---|---|---|
| A* | ⬜ | ⬜ | ⬜ |
| Hybrid A* | ⬜ | ⬜ | ⬜ |
| RRT / RRT* | ⬜ | ⬜ | ⬜ |
| Algorithm | Python | C++ | Docs |
|---|---|---|---|
| Pure Pursuit / Stanley | ⬜ | ⬜ | ⬜ |
| LQR | ⬜ | ⬜ | ⬜ |
| Model Predictive Control | ⬜ | ⬜ | ⬜ |
| Algorithm | Python | C++ | Docs |
|---|---|---|---|
| Numerical IK (Damped Least Squares) | ⬜ | ⬜ | ⬜ |
flowchart LR
EKF[EKF] --> UKF[UKF]
UKF --> PF[Particle Filter]
EKF --> GS[Graph SLAM]
AS[A*] --> HA[Hybrid A*]
AS --> RRT[RRT / RRT*]
PP[Pure Pursuit / Stanley] --> LQR[LQR]
LQR --> MPC[MPC]
IK[Numerical IK]
Right now, an algorithm is marked ✅ when it meets:
- Python reference runs on the shared scenario data.
- C++ implementation matches the Python output within tolerance on the same data.
- Documentation covers the derivation, assumptions, and measured results.
Formal automated tests (finite-difference Jacobian checks, NEES/NIS consistency, etc.) are planned as a later phase across the whole repo, once the conceptual implementations are further along it is not required per-algorithm for now.
Design rules applied throughout:
- Shared data files, not shared seeds. NumPy and C++ random generators produce different streams, so each scenario is generated once and saved as CSV for both languages to read.
- Algorithm code stays pure. Filters, planners, and controllers contain no plotting or file I/O. Demos handle that separately.
- Measured results only. Every number reported comes from a run I can reproduce.
Each algorithm is a self-contained study, organized by area:
Click to expand
robotics-algorithms/
├── README.md
├── requirements.txt
├── CMakeLists.txt # builds every algorithm for CI
├── .github/workflows/ci.yml
└── localization/
└── ekf/
├── README.md # derivation, assumptions, results
├── data/ # shared scenario CSVs
├── img/ # result plots
├── python/
│ ├── ekf.py # algorithm only
│ ├── demo.py # load data, run, plot
│ └── gen_data.py # generates scenario data
└── cpp/
├── CMakeLists.txt # standalone project
├── ekf.hpp / ekf.cpp
└── demo.cpp
- Thrun, Burgard & Fox, Probabilistic Robotics: localization and SLAM
- Lynch & Park, Modern Robotics: kinematics, inverse kinematics, and control
- LaValle, Planning Algorithms: search and sampling-based planning
The choice of algorithms and the simulation scenarios are inspired by PythonRobotics by Atsushi Sakai (MIT License). The implementations here are written independently.
MIT © P Pranav