From 281b41011ca812f1c3a512c11c9d89efc77d6f27 Mon Sep 17 00:00:00 2001 From: Albin Hedman Date: Wed, 19 Jun 2024 14:45:09 +0200 Subject: [PATCH] Add method for reading the integral term; Update comment on setter --- src/lib.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 54583ae..e1af45f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -264,12 +264,18 @@ where self.integral_term = T::zero(); } - /// Set integral term to custom value. This might be important to set pid - /// controller to previous state after an interruption or crash + /// Set integral term to custom value. + /// This may drastically change the control output. + /// Use this to return the PID controller to a previous state after an interruption or crash. pub fn set_integral_term(&mut self, integral_term: impl Into) -> &mut Self { self.integral_term = integral_term.into(); self } + + /// Get the integral term. + pub fn get_integral_term(&self) -> T { + self.integral_term + } } /// Saturating the input `value` according the absolute `limit` (`-abs(limit) <= output <= abs(limit)`).