{"id":50957301,"url":"https://github.com/rishitv26/spid","last_synced_at":"2026-06-18T09:02:06.882Z","repository":{"id":359887095,"uuid":"1193724539","full_name":"rishitv26/SPID","owner":"rishitv26","description":"SPID is a motion control algorithm designed as a modification of PID that uses stochastic gradient decent to self-tune and adapt to motion during planning phase.","archived":false,"fork":false,"pushed_at":"2026-05-23T23:08:11.000Z","size":34,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-24T01:12:15.411Z","etag":null,"topics":["adaptive-control","backpropagation","control-systems","embedded-systems","gradient-descent","motion-control","neural-network","pid","pid-controller","python","reinforcement-learning","robotics","self-tuning","simulation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rishitv26.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-27T14:14:09.000Z","updated_at":"2026-05-23T23:08:14.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/rishitv26/SPID","commit_stats":null,"previous_names":["rishitv26/spid"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/rishitv26/SPID","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rishitv26%2FSPID","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rishitv26%2FSPID/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rishitv26%2FSPID/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rishitv26%2FSPID/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rishitv26","download_url":"https://codeload.github.com/rishitv26/SPID/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rishitv26%2FSPID/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34483284,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-18T02:00:06.871Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adaptive-control","backpropagation","control-systems","embedded-systems","gradient-descent","motion-control","neural-network","pid","pid-controller","python","reinforcement-learning","robotics","self-tuning","simulation"],"created_at":"2026-06-18T09:02:05.508Z","updated_at":"2026-06-18T09:02:06.877Z","avatar_url":"https://github.com/rishitv26.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SPID\n\nSPID (Self-tuning PID) is a motion control algorithm that treats PID as a single-layer neural network and uses gradient descent to adapt its gains online during operation. It is designed to outperform generic PID in environments where system dynamics are variable or unknown ahead of time, especially in non-linear environments where PID tends to perform poorly.\n\nA pre-print documenting the design, benchmarks, and analysis is awaiting publication by May, 2026.\n\n## Motivation\n\nStandard PID requires manual gain tuning, which is environment-specific and does not adapt at runtime. Fully AI-based controllers (e.g., reinforcement learning) are very energy consuming and thus require much more energy than what can be available in some applications. SPID tries to act as the solution in the middle by retaining the structure and interpretability of PID while using backpropagation to update P, I, and D gains simultaneuosly.\n\n## How It Works\n\nPID can be interpreted as a linear neural network with no activation function, where the three gains (kP, kI, kD) are the learnable weights. In SPID, a cost function is defined relative to error, which is then using in conjuction with backpropogation to converge to the 'best' P, I, and D gains within the plant's environment. Rigourous notation and testing results shall be released with the pre-print\n\n## Files\n\n| File | Description |\n|---|---|\n| `spid.py` | Core implementation: `SmartPID` and baseline `PID` classes |\n| `simulation.py` | Simulation environment for benchmarking |\n| `descend.py` | Gradient descent and gain update logic |\n| `pid_simulation_log.txt` | Sample simulation output |\n| `requirements.txt` | Python dependencies |\n\n## Usage\n\n```python\nfrom spid import SmartPID\n\ncontroller = SmartPID(\n    correction_constant=1.0,\n    windup=0.2,\n    learning_constant=0.001,\n    max_value=127.0\n)\n\n# In your control loop:\noutput = controller.compute(error, dt)\n```\n\nThe controller requires no pre-tuning. Gains initialize to a placeholder value and adapt from the first timestep.\n\n## Parameters\n\n| Parameter | Description | Default |\n|---|---|---|\n| `correction_constant` | Scales the target curve shape | `1.0` |\n| `windup` | Integral anti-windup threshold | `0.2` |\n| `learning_constant` | Base learning rate | `0.001` |\n| `max_value` | Maximum control output | `127.0` |\n\n## Benchmarks (Planned)\n\nSPID will be evaluated against:\n- PID tuned via Ziegler-Nichols\n- PID tuned via Particle Swarm Optimization (PSO)\n- Model Reference Adaptive Control (MRAC)\n\nMetrics: RMSE, settling time, overshoot percentage across small and large setpoint ranges.\n\n## Installation\n\n```bash\npip install -r requirements.txt\n```\n\nRequires Python 3.8+.\n\n## Progress thus far\n\nSPID works well within an ideal environment with no external forces. A processing simulation was written to demonstrate this. More testing and iterating has to be done for unideal environments.\n\nhttps://github.com/user-attachments/assets/7d376503-ee4c-4a0f-9093-4ee74eeaa01e\n\n\u003e Note that because of an ideal environment, kP, kI, and kD may not reflect what a real system might exhibit. Learning rate was slowed down intentionally to enhance proof-of-concept\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frishitv26%2Fspid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frishitv26%2Fspid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frishitv26%2Fspid/lists"}