Skip to content
Snippets Groups Projects
Commit ad0f9f5a authored by Mirko Wächter's avatar Mirko Wächter
Browse files

pid controller: added missing allocation of vectors

parent 22c22370
No related branches found
No related tags found
No related merge requests found
...@@ -71,6 +71,12 @@ namespace armarx ...@@ -71,6 +71,12 @@ namespace armarx
void update(const double deltaSec, const PIDVectorX& measuredValue, const PIDVectorX& targetValue) void update(const double deltaSec, const PIDVectorX& measuredValue, const PIDVectorX& targetValue)
{ {
ScopedRecursiveLockPtr lock = getLock(); ScopedRecursiveLockPtr lock = getLock();
if (stackAllocations.zeroVec.rows() == 0)
{
preallocate(measuredValue.rows());
}
ARMARX_CHECK_EQUAL(measuredValue.rows(), targetValue.rows());
ARMARX_CHECK_EQUAL(measuredValue.rows(), stackAllocations.zeroVec.rows());
processValue = measuredValue; processValue = measuredValue;
target = targetValue; target = targetValue;
...@@ -96,7 +102,7 @@ namespace armarx ...@@ -96,7 +102,7 @@ namespace armarx
if (!firstRun) if (!firstRun)
{ {
integral += error * deltaSec; integral += error * deltaSec;
integral = std::min(integral,maxIntegral); integral = std::min(integral, maxIntegral);
if (deltaSec > 0.0) if (deltaSec > 0.0)
{ {
derivative = (error - previousError) / deltaSec; derivative = (error - previousError) / deltaSec;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment