From 3ae1fe5fa1cc3d5ccd9aaf7515f44d1d17940409 Mon Sep 17 00:00:00 2001 From: Ruben Nitsche Date: Thu, 26 Oct 2023 10:19:15 +0200 Subject: [PATCH] Added Functionality to manually set the integral term. This might be important to set controller to previous state after an interruption or crash. --- src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index db2f5c5..fdc9b25 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -263,6 +263,13 @@ where pub fn reset_integral_term(&mut self) { 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 + pub fn set_integral_term(&mut self, integral_term: impl Into) -> &mut Self { + self.integral_term = integral_term.into(); + self + } } /// Saturating the input `value` according the absolute `limit` (`-abs(limit) <= output <= abs(limit)`).