From ebc4b16d9a613ad48037a567554dccbbdc327a43 Mon Sep 17 00:00:00 2001 From: paul Jewell Date: Sun, 11 Dec 2016 05:45:47 +0100 Subject: [PATCH] LP-289 Clean up comments and uncrustify --- flight/libraries/math/pid.c | 2 +- flight/libraries/math/pid.h | 5 ++--- flight/libraries/pid/pidcontroldown.cpp | 3 +-- flight/modules/PathFollower/pidcontrolne.cpp | 7 ++----- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/flight/libraries/math/pid.c b/flight/libraries/math/pid.c index dafff7b15..4fba36984 100644 --- a/flight/libraries/math/pid.c +++ b/flight/libraries/math/pid.c @@ -7,7 +7,7 @@ * * @file pid.c * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2016. - * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2015. + * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012. * @brief Methods to work with PID structure * * @see The GNU Public License (GPL) Version 3 diff --git a/flight/libraries/math/pid.h b/flight/libraries/math/pid.h index 8533afbf5..321b198c7 100644 --- a/flight/libraries/math/pid.h +++ b/flight/libraries/math/pid.h @@ -6,7 +6,6 @@ * @{ * * @file pid.h - * * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2016. * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012. * @brief Methods to work with PID structure @@ -49,7 +48,7 @@ struct pid { // pid2 structure for a PID+setpoint weighting, anti-windup and filtered derivative control struct pid2 { float u0; // Initial value of r & y - for bumpless transfer - float va; // Actuator settings for scaling + float va; // Actuator settings for scaling float vb; float kp; // proportional gain float bi; // Integral gain . dT @@ -58,7 +57,7 @@ struct pid2 { float br; // Time constant for integral calculation float beta; // Scalar for proportional factor float yold; // t-1 y value for Integral calculation - float P; // Latest calculated P, I & D values + float P; // Latest calculated P, I & D values float I; float D; uint8_t reconfigure; diff --git a/flight/libraries/pid/pidcontroldown.cpp b/flight/libraries/pid/pidcontroldown.cpp index 253eaa682..a7eb4a501 100644 --- a/flight/libraries/pid/pidcontroldown.cpp +++ b/flight/libraries/pid/pidcontroldown.cpp @@ -117,8 +117,7 @@ void PIDControlDown::UpdateParameters(float kp, float ki, float kd, float beta, // Define Tf, according to controller type if (kd < 1e-6f) { // PI Controller or P Controller - Tf = 0; // Originally this: (Ti / N) - which creates a D term from - // the integral time constant! + Tf = 0; } else { Tf = Td / N; } diff --git a/flight/modules/PathFollower/pidcontrolne.cpp b/flight/modules/PathFollower/pidcontrolne.cpp index 5b4a61f11..5e208298f 100644 --- a/flight/modules/PathFollower/pidcontrolne.cpp +++ b/flight/modules/PathFollower/pidcontrolne.cpp @@ -89,7 +89,7 @@ void PIDControlNE::UpdateParameters(float kp, float ki, float kd, float beta, fl float Tf; // Low pass filter time constant for derivative filtering float u0 = 0.0f; - + // Define Td, handling zero kp term (for I or ID controller) if (kp < 1e-6f) { Td = 1e6f; @@ -108,8 +108,7 @@ void PIDControlNE::UpdateParameters(float kp, float ki, float kd, float beta, fl // Define Tf, according to controller type if (kd < 1e-6f) { // PI Controller or P Controller - Tf = 0; // Originally this: (Ti / N) - which creates a D term from - // the integral time constant! + Tf = 0; } else { Tf = Td / N; } @@ -120,8 +119,6 @@ void PIDControlNE::UpdateParameters(float kp, float ki, float kd, float beta, fl beta = 0.4f; } - - pid2_configure(&PIDvel[0], kp, ki, kd, Tf, kt, dT, beta, u0, 0.0f, 1.0f); pid2_configure(&PIDvel[1], kp, ki, kd, Tf, kt, dT, beta, u0, 0.0f, 1.0f); deltaTime = dT;