Skip to content

James-buzz/Wiremod-PID-Controller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Wiremod PID Controller


PID Crawling Car

This script was created in Wiremod E2 to implement a PID controller into Garrysmod.

Garrysmod Wiremod

Table of Contents

Introduction

You can construct feedback control for processes within Garry's Mod using an expression 2 chip and this code.

A classic example of a PID controller is cruise control for a road vehicle, in which external factors such as elevation cause the vehicle to slow down, requiring more power from the engine to keep at a steady speed. The PID controller adjusts the motor output to maintain the desired set speed. This is demonstrated in the clip above within Garysmod.

Features

  • P, PI & PID Controller
  • Derivative Kick Elimination
  • Reset Windup Mitigation
  • Enabled/Disabled states (Automatic / Manual)
  • Intergral Continuous Tuning
  • Output Limit Ranges

Future Features

  • Graphical output of PID (Input vs Output)
  • Automatic PID tuning (Process Response Analysis)
  • Different Methods of Tuning
  • Implement alternative PID controller types

How to start

It's simple to setup:-

  1. Place an E2 chip in the world using the "Expression 2" wiremod tool.
  2. Upload the contents of the "CODE.lua" to the E2 chip and save.
  3. Wire the correct inputs and outputs to the CHIP using the wire tool. The I/O for the controller is explained within the CODE
  4. Set the enable input to 1 i.e. wiremod button

Acknowledgements

  • Thanks to 2CloseShave for PID example video
  • Thanks to br3ttb for explaining PID code in Arduino

License

This project is licensed under the MIT license - see the LICENSE.md file for details.

Releases

No releases published

Packages

No packages published

Languages