You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/lib.rs
+21-21Lines changed: 21 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
//! A proportional-integral-derivative (PID) controller library.
2
-
//!
2
+
//!
3
3
//! See [Pid] for the adjustable controller itself, as well as [ControlOutput] for the outputs and weights which you can use after setting up your controller. Follow the complete example below to setup your first controller!
4
-
//!
4
+
//!
5
5
//! # Example
6
-
//!
6
+
//!
7
7
//! ```rust
8
8
//! use pid::Pid;
9
9
//!
@@ -49,37 +49,37 @@ use num_traits::float::FloatCore;
/// This controller provides a builder pattern interface which allows you to pick-and-choose which PID inputs you'd like to use during operation. Here's what a basic proportional-only controller could look like:
56
-
///
56
+
///
57
57
/// ```rust
58
58
/// use pid::Pid;
59
-
///
59
+
///
60
60
/// // Create limited controller
61
61
/// let mut p_controller = Pid::new(15.0, 100.0);
62
62
/// p_controller.p(10.0, 100.0);
63
-
///
63
+
///
64
64
/// // Get first output
65
65
/// let p_output = p_controller.next_control_output(400.0);
66
66
/// ```
67
-
///
67
+
///
68
68
/// This controller would give you set a proportional controller to `10.0` with a target of `15.0` and an output limit of `100.0` per [output](Self::next_control_output) iteration. The same controller with a full PID system built in looks like:
69
-
///
69
+
///
70
70
/// ```rust
71
71
/// use pid::Pid;
72
-
///
72
+
///
73
73
/// // Create full PID controler
74
74
/// let mut full_controller = Pid::new(15.0, 100.0);
/// let full_output = full_controller.next_control_output(400.0);
79
79
/// ```
80
-
///
80
+
///
81
81
/// This [`next_control_output`](Self::next_control_output) method is what's used to input new values into the controller to tell it what the current state of the system is. In the examples above it's only being used once, but realistically this will be a hot method. Please see [ControlOutput] for examples of how to handle these outputs; it's quite straight forward and mirrors the values of this structure in some ways.
82
-
///
82
+
///
83
83
/// The last item of note is that these [`p`](Self::p()), [`i`](Self::i()), and [`d`](Self::d()) methods can be used *during* operation which lets you add and/or modify these controller values if need be.
0 commit comments