Skip to main content

Crate use_setpoint

Crate use_setpoint 

Source
Expand description

Setpoint helpers for simple control loops.

The crate keeps setpoints explicit by storing only a target and a tolerance.

§Examples

use use_setpoint::{within_tolerance, Setpoint};

let setpoint = Setpoint::new(10.0, 0.2).unwrap();
assert!(setpoint.is_reached(9.9));
assert!((setpoint.error(9.8) - 0.2).abs() < 1e-12);
assert!(within_tolerance(10.0, 10.1, 0.2).unwrap());

Structs§

Setpoint

Enums§

SetpointError

Functions§

within_tolerance