1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

LP-289 Clean up comments and uncrustify

This commit is contained in:
paul Jewell 2016-12-11 05:45:47 +01:00
parent 143b5e7ab6
commit ebc4b16d9a
4 changed files with 6 additions and 11 deletions

View File

@ -7,7 +7,7 @@
* *
* @file pid.c * @file pid.c
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2016. * @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 * @brief Methods to work with PID structure
* *
* @see The GNU Public License (GPL) Version 3 * @see The GNU Public License (GPL) Version 3

View File

@ -6,7 +6,6 @@
* @{ * @{
* *
* @file pid.h * @file pid.h
*
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2016. * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2016.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012. * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @brief Methods to work with PID structure * @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 // pid2 structure for a PID+setpoint weighting, anti-windup and filtered derivative control
struct pid2 { struct pid2 {
float u0; // Initial value of r & y - for bumpless transfer 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 vb;
float kp; // proportional gain float kp; // proportional gain
float bi; // Integral gain . dT float bi; // Integral gain . dT
@ -58,7 +57,7 @@ struct pid2 {
float br; // Time constant for integral calculation float br; // Time constant for integral calculation
float beta; // Scalar for proportional factor float beta; // Scalar for proportional factor
float yold; // t-1 y value for Integral calculation 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 I;
float D; float D;
uint8_t reconfigure; uint8_t reconfigure;

View File

@ -117,8 +117,7 @@ void PIDControlDown::UpdateParameters(float kp, float ki, float kd, float beta,
// Define Tf, according to controller type // Define Tf, according to controller type
if (kd < 1e-6f) { if (kd < 1e-6f) {
// PI Controller or P Controller // PI Controller or P Controller
Tf = 0; // Originally this: (Ti / N) - which creates a D term from Tf = 0;
// the integral time constant!
} else { } else {
Tf = Td / N; Tf = Td / N;
} }

View File

@ -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 Tf; // Low pass filter time constant for derivative filtering
float u0 = 0.0f; float u0 = 0.0f;
// Define Td, handling zero kp term (for I or ID controller) // Define Td, handling zero kp term (for I or ID controller)
if (kp < 1e-6f) { if (kp < 1e-6f) {
Td = 1e6f; Td = 1e6f;
@ -108,8 +108,7 @@ void PIDControlNE::UpdateParameters(float kp, float ki, float kd, float beta, fl
// Define Tf, according to controller type // Define Tf, according to controller type
if (kd < 1e-6f) { if (kd < 1e-6f) {
// PI Controller or P Controller // PI Controller or P Controller
Tf = 0; // Originally this: (Ti / N) - which creates a D term from Tf = 0;
// the integral time constant!
} else { } else {
Tf = Td / N; Tf = Td / N;
} }
@ -120,8 +119,6 @@ void PIDControlNE::UpdateParameters(float kp, float ki, float kd, float beta, fl
beta = 0.4f; beta = 0.4f;
} }
pid2_configure(&PIDvel[0], kp, ki, kd, Tf, kt, dT, beta, u0, 0.0f, 1.0f); 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); pid2_configure(&PIDvel[1], kp, ki, kd, Tf, kt, dT, beta, u0, 0.0f, 1.0f);
deltaTime = dT; deltaTime = dT;