Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make the PID controllers derivative mode configurable #7

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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