Skip to content

Commit 9500286

Browse files
author
camilo
committed
some needed changes
1 parent 3f07791 commit 9500286

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/include/pid.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ namespace qlibs {
188188
public:
189189
pidAutoTuning() = default;
190190
pidGains getEstimates( void ) const noexcept;
191+
bool enableOrder2Estimates( const bool en ) noexcept;
191192
};
192193

193194
/**

src/pid.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,10 +470,22 @@ bool pidAutoTuning::step( const real_t u,
470470
return ready;
471471
}
472472
/*============================================================================*/
473+
bool pidAutoTuning::enable2ndOrderEstimates( const bool en ) noexcept
474+
{
475+
if ( en ) {
476+
estimationStep = estimationStepN2;
477+
computeParameters = computeParamsN2;
478+
}
479+
else {
480+
estimationStep = estimationStepN1;
481+
computeParameters = computeParamsN1;
482+
}
483+
}
484+
/*============================================================================*/
473485
pidGains pidAutoTuning::getEstimates( void ) const noexcept
474486
{
475487
pidGains gains = { 0.0_re, 0.0_re, 0.0_re };
476-
const real_t tau = sysParams.tau1;
488+
const real_t tau = sysParams.tau1 + sysParams.tau2;
477489
const real_t k = sysParams.gain;
478490
const real_t td = tau*0.1_re;
479491

0 commit comments

Comments
 (0)