This script was created in Wiremod E2 to implement a PID controller into Garrysmod.
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.
- P, PI & PID Controller
- Derivative Kick Elimination
- Reset Windup Mitigation
- Enabled/Disabled states (Automatic / Manual)
- Intergral Continuous Tuning
- Output Limit Ranges
- Graphical output of PID (Input vs Output)
- Automatic PID tuning (Process Response Analysis)
- Different Methods of Tuning
- Implement alternative PID controller types
It's simple to setup:-
- Place an E2 chip in the world using the "Expression 2" wiremod tool.
- Upload the contents of the "CODE.lua" to the E2 chip and save.
- Wire the correct inputs and outputs to the CHIP using the wire tool. The I/O for the controller is explained within the CODE
- Set the enable input to 1 i.e. wiremod button
- Thanks to 2CloseShave for PID example video
- Thanks to br3ttb for explaining PID code in Arduino
This project is licensed under the MIT license - see the LICENSE.md file for details.