PythonSystemID: System Identification & Control

PythonSystemID is an open-source Python library for system identification, model validation, and closed-loop control of dynamical systems. It provides a modular framework to experiment with identification methods, validate models through both prediction accuracy and control performance, and generate publication-quality animations.

The project is built around a core insight: model quality should be evaluated using prediction performance + control performance, not just parameter accuracy. A model with biased parameters may still achieve excellent closed-loop tracking if the bias is consistent across the operating region.

Supported Systems

Mass-Spring-Damper (MSD) — A continuous-time second-order system identified using least-squares regression and ARX models, with PID control for closed-loop tracking.

Kinematic Unicycle — A nonlinear mobile robot model identified using linear, grey-box (parametric), and black-box (feature-based ridge regression) methods, with Lyapunov-based path tracking control.

Mass-Spring-Damper: Open-Loop Simulation

Mass-spring-damper open-loop simulation showing position response under PRBS excitation

Open-loop response of the MSD system under pseudo-random binary sequence (PRBS) excitation.

Model Validation: Rollout Comparison

Rollout comparison between true and identified MSD models

Free-run rollout comparing the true system against the identified model. Near-perfect tracking validates the identification.

Closed-Loop PID Tracking

Closed-loop PID tracking comparison between true and identified MSD models

PID controller tracking a step reference on both the true plant and the identified model.

Unicycle Path Tracking: Circle

Unicycle robot tracking a circular reference path

Lyapunov-based controller tracking a circular reference path.

Unicycle Path Tracking: Lemniscate

Unicycle robot tracking a figure-eight lemniscate path

Lyapunov-based controller tracking a figure-eight (lemniscate) reference path.

Key Features

The full source code and more details are available here.