5 stable releases

1.2.0 Feb 5, 2024
1.1.2 Apr 25, 2023
1.1.0 Dec 25, 2020
1.0.0 Dec 24, 2020

#211 in Robotics

21 downloads per month

MIT/Apache

14KB
119 lines

pid-lite

A small PID controller library

Installation

$ cargo add pid-lite

Example

use pid_lite::Controller;
use std::thread;
use std::time::Duration;

let target = 80.0;
let mut controller = Controller::new(target, 0.25, 0.01, 0.01);

loop {
    let correction = controller.update(measure());
    apply_correction(correction);
    thread::sleep(Duration::from_secs(1));
}

Safety

This crate uses #![deny(unsafe_code)] to ensure everything is implemented in 100% Safe Rust.

Contributing

Want to join us? Check out our "Contributing" guide and take a look at some of these issues:

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~0–255KB