mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-21 11:54:15 +01:00
refactored pid_apply_scaled back into pid_apply (rename only)
This commit is contained in:
parent
ae1db5058e
commit
0724fca32a
@ -78,7 +78,7 @@ float pid_apply(struct pid *pid, const float err, float dT)
|
|||||||
* This version of apply uses setpoint weighting for the derivative component so the gain
|
* This version of apply uses setpoint weighting for the derivative component so the gain
|
||||||
* on the gyro derivative can be different than the gain on the setpoint derivative
|
* on the gyro derivative can be different than the gain on the setpoint derivative
|
||||||
*/
|
*/
|
||||||
float pid_apply_setpoint_scaled(struct pid *pid, const float factor, const float setpoint, const float measured, float dT)
|
float pid_apply_setpoint(struct pid *pid, const float factor, const float setpoint, const float measured, float dT)
|
||||||
{
|
{
|
||||||
float err = setpoint - measured;
|
float err = setpoint - measured;
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ struct pid {
|
|||||||
|
|
||||||
// ! Methods to use the pid structures
|
// ! Methods to use the pid structures
|
||||||
float pid_apply(struct pid *pid, const float err, float dT);
|
float pid_apply(struct pid *pid, const float err, float dT);
|
||||||
float pid_apply_setpoint_scaled(struct pid *pid, const float factor, const float setpoint, const float measured, float dT);
|
float pid_apply_setpoint(struct pid *pid, const float factor, const float setpoint, const float measured, float dT);
|
||||||
void pid_zero(struct pid *pid);
|
void pid_zero(struct pid *pid);
|
||||||
void pid_configure(struct pid *pid, float p, float i, float d, float iLim);
|
void pid_configure(struct pid *pid, float p, float i, float d, float iLim);
|
||||||
void pid_configure_derivative(float cutoff, float gamma);
|
void pid_configure_derivative(float cutoff, float gamma);
|
||||||
|
@ -290,7 +290,7 @@ static void stabilizationTask(__attribute__((unused)) void *parameters)
|
|||||||
rateDesiredAxis[i] = bound(attitudeDesiredAxis[i], settings.ManualRate[i]);
|
rateDesiredAxis[i] = bound(attitudeDesiredAxis[i], settings.ManualRate[i]);
|
||||||
|
|
||||||
// Compute the inner loop
|
// Compute the inner loop
|
||||||
actuatorDesiredAxis[i] = pid_apply_setpoint_scaled(&pids[PID_RATE_ROLL + i], speedScaleFactor, rateDesiredAxis[i], gyro_filtered[i], dT);
|
actuatorDesiredAxis[i] = pid_apply_setpoint(&pids[PID_RATE_ROLL + i], speedScaleFactor, rateDesiredAxis[i], gyro_filtered[i], dT);
|
||||||
actuatorDesiredAxis[i] = bound(actuatorDesiredAxis[i], 1.0f);
|
actuatorDesiredAxis[i] = bound(actuatorDesiredAxis[i], 1.0f);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -306,7 +306,7 @@ static void stabilizationTask(__attribute__((unused)) void *parameters)
|
|||||||
rateDesiredAxis[i] = bound(rateDesiredAxis[i], settings.MaximumRate[i]);
|
rateDesiredAxis[i] = bound(rateDesiredAxis[i], settings.MaximumRate[i]);
|
||||||
|
|
||||||
// Compute the inner loop
|
// Compute the inner loop
|
||||||
actuatorDesiredAxis[i] = pid_apply_setpoint_scaled(&pids[PID_RATE_ROLL + i], speedScaleFactor, rateDesiredAxis[i], gyro_filtered[i], dT);
|
actuatorDesiredAxis[i] = pid_apply_setpoint(&pids[PID_RATE_ROLL + i], speedScaleFactor, rateDesiredAxis[i], gyro_filtered[i], dT);
|
||||||
actuatorDesiredAxis[i] = bound(actuatorDesiredAxis[i], 1.0f);
|
actuatorDesiredAxis[i] = bound(actuatorDesiredAxis[i], 1.0f);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -332,7 +332,7 @@ static void stabilizationTask(__attribute__((unused)) void *parameters)
|
|||||||
|
|
||||||
// Compute desired rate as input biased towards leveling
|
// Compute desired rate as input biased towards leveling
|
||||||
rateDesiredAxis[i] = attitudeDesiredAxis[i] + weak_leveling;
|
rateDesiredAxis[i] = attitudeDesiredAxis[i] + weak_leveling;
|
||||||
actuatorDesiredAxis[i] = pid_apply_setpoint_scaled(&pids[PID_RATE_ROLL + i], speedScaleFactor, rateDesiredAxis[i], gyro_filtered[i], dT);
|
actuatorDesiredAxis[i] = pid_apply_setpoint(&pids[PID_RATE_ROLL + i], speedScaleFactor, rateDesiredAxis[i], gyro_filtered[i], dT);
|
||||||
actuatorDesiredAxis[i] = bound(actuatorDesiredAxis[i], 1.0f);
|
actuatorDesiredAxis[i] = bound(actuatorDesiredAxis[i], 1.0f);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -356,7 +356,7 @@ static void stabilizationTask(__attribute__((unused)) void *parameters)
|
|||||||
|
|
||||||
rateDesiredAxis[i] = bound(rateDesiredAxis[i], settings.ManualRate[i]);
|
rateDesiredAxis[i] = bound(rateDesiredAxis[i], settings.ManualRate[i]);
|
||||||
|
|
||||||
actuatorDesiredAxis[i] = pid_apply_setpoint_scaled(&pids[PID_RATE_ROLL + i], speedScaleFactor, rateDesiredAxis[i], gyro_filtered[i], dT);
|
actuatorDesiredAxis[i] = pid_apply_setpoint(&pids[PID_RATE_ROLL + i], speedScaleFactor, rateDesiredAxis[i], gyro_filtered[i], dT);
|
||||||
actuatorDesiredAxis[i] = bound(actuatorDesiredAxis[i], 1.0f);
|
actuatorDesiredAxis[i] = bound(actuatorDesiredAxis[i], 1.0f);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user