Skip to content

Commit

Permalink
Merge pull request #7 from rock-control/derivative_mode
Browse files Browse the repository at this point in the history
feat: make the PID controllers derivative mode configurable
  • Loading branch information
doudou authored Jan 28, 2025
2 parents 02e8111 + de8d4e1 commit 074e093
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions motor_controllerTypes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ namespace motor_controller {

/** Max allowed variation in input command in unit/s */
float ramp = base::infinity<float>();

/** How the derivative is computed */
DerivativeMode derivative_mode = Output;
};
}

Expand Down
2 changes: 2 additions & 0 deletions tasks/PIDTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ bool PIDTask::startHook()
for (size_t i = 0; i < mSettings.size(); ++i) {
mPIDs[i].reset();
mPIDs[i].setPIDSettings(mSettings[i].pid);
mPIDs[i].setDerivativeMode(mSettings[i].derivative_mode);
}
return true;
}
Expand All @@ -68,6 +69,7 @@ bool PIDTask::setSettings(std::vector< ::motor_controller::ActuatorSettings > co
mSettings = value;
for (size_t i = 0; i < mSettings.size(); ++i) {
mPIDs[i].setPIDSettings(mSettings[i].pid);
mPIDs[i].setDerivativeMode(mSettings[i].derivative_mode);
}
return motor_controller::PIDTaskBase::setSettings(value);
}
Expand Down

0 comments on commit 074e093

Please sign in to comment.