pid_with_limits/
pid_with_limits.rs

1use advanced_pid::{prelude::*, Pid, PidConfig};
2
3fn main() {
4    let config = PidConfig::new(1.0, 0.1, 0.1).with_limits(-1.0, 1.0);
5    let mut pid = Pid::new(config);
6
7    println!("{:5.2}", pid.update(1.0, 0.0, 1.0));
8    println!("{:5.2}", pid.update(1.0, 0.1, 1.0));
9    println!("{:5.2}", pid.update(1.0, 0.3, 1.0));
10    println!("{:5.2}", pid.update(1.0, 0.6, 1.0));
11    println!("{:5.2}", pid.update(1.0, 0.9, 1.0));
12    println!("{:5.2}", pid.update(1.0, 1.2, 1.0));
13}