1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-30 15:52:12 +01:00

LP-289 added comments and fixed one typo

This commit is contained in:
paul Jewell 2016-12-10 14:06:13 +01:00
parent edd3b8689b
commit c723a06e93
2 changed files with 16 additions and 13 deletions

View File

@ -6,7 +6,8 @@
* @{
*
* @file pid.c
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2016.
* The OpenPilot Team, http://www.openpilot.org Copyright (C) 2015.
* @brief Methods to work with PID structure
*
* @see The GNU Public License (GPL) Version 3
@ -159,7 +160,7 @@ void pid_configure(struct pid *pid, float p, float i, float d, float iLim)
* @param[in] kp proportional gain
* @param[in] ki integral gain. Time constant Ti = kp/ki
* @param[in] kd derivative gain. Time constant Td = kd/kp
* @param[in] Tf filtering time = (kd/k)/N, N is in the range of 2 to 20
* @param[in] Tf filtering time = (kd/kp)/N, N is in the range of 2 to 20
* @param[in] kt tracking gain for anti-windup. Tt = TiTd and Tt = (Ti + Td)/2
* @param[in] dt delta time increment
* @param[in] beta setpoint weight on setpoint in P component. beta=1 error feedback. beta=0 smoothes out response to changes in setpoint

View File

@ -6,7 +6,9 @@
* @{
*
* @file pid.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
*
* @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
*
* @see The GNU Public License (GPL) Version 3
@ -46,17 +48,17 @@ struct pid {
// pid2 structure for a PID+setpoint weighting, anti-windup and filtered derivative control
struct pid2 {
float u0;
float va;
float u0; // Initial value of r & y - for bumpless transfer
float va; // Actuator
float vb;
float kp;
float bi;
float ad;
float bd;
float br;
float beta;
float yold;
float P;
float kp; // proportional gain
float bi; // Integral gain . dT
float ad; // Filtered factor for derivative calculation
float bd; // Constant for derivative calculation
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 I;
float D;
uint8_t reconfigure;