<h1 align="center">pid-lite</h1>
<div align="center">
  <strong>
    A small PID controller library
  </strong>
</div>

<br />

<div align="center">
  <!-- Crates version -->
  <a href="https://crates.io/crates/pid-lite">
    <img src="https://img.shields.io/crates/v/pid-lite.svg?style=flat-square"
    alt="Crates.io version" />
  </a>
  <!-- Downloads -->
  <a href="https://crates.io/crates/pid-lite">
    <img src="https://img.shields.io/crates/d/pid-lite.svg?style=flat-square"
      alt="Download" />
  </a>
  <!-- docs.rs docs -->
  <a href="https://docs.rs/pid-lite">
    <img src="https://img.shields.io/badge/docs-latest-blue.svg?style=flat-square"
      alt="docs.rs docs" />
  </a>
</div>

<div align="center">
  <h3>
    <a href="https://docs.rs/pid-lite">
      API Docs
    </a>
    <span> | </span>
    <a href="https://github.com/yoshuawuyts/pid-lite/releases">
      Releases
    </a>
    <span> | </span>
    <a href="https://github.com/yoshuawuyts/pid-lite/blob/master.github/CONTRIBUTING.md">
      Contributing
    </a>
  </h3>
</div>

## Installation
```sh
$ cargo add pid-lite
```

## Example

```rust
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][contributing] and take a
look at some of these issues:

- [Issues labeled "good first issue"][good-first-issue]
- [Issues labeled "help wanted"][help-wanted]

[contributing]: https://github.com/yoshuawuyts/pid-lite/blob/master.github/CONTRIBUTING.md
[good-first-issue]: https://github.com/yoshuawuyts/pid-lite/labels/good%20first%20issue
[help-wanted]: https://github.com/yoshuawuyts/pid-lite/labels/help%20wanted

## License

<sup>
Licensed under either of <a href="LICENSE-APACHE">Apache License, Version
2.0</a> or <a href="LICENSE-MIT">MIT license</a> at your option.
</sup>

<br/>

<sub>
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.
</sub>
