Implement PIDController to Wheelbot (#1023)

This commit is contained in:
avinashc99 2020-07-09 16:31:37 -05:00 committed by GitHub
parent eaeb8118b1
commit 07030127f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 9 deletions

View File

@ -45,20 +45,20 @@ double PIDController::getOutput(double setpoint_value, double measured_value) {
// Sign Check
bool same_sign;
if ((error * output) > 0.0) {
same_sign = 1;
same_sign = true;
} else {
same_sign = 0;
same_sign = false;
}
//Saturation Check
bool output_limited;
bool output_limited = false;
if (output > out_max) {
output = out_max;
output_limited = 1;
output_limited = true;
}
if (output < out_min) {
output = out_min;
output_limited = 1;
output_limited = true;
}
//AND Gate Check

View File

@ -27,10 +27,10 @@ DifferentialDriveController::
desiredHeadingRate(0.0),
// PID Controller Initialization
headingctrl(PIDController(1.0, 0.08, 0.5, headingRateLimit,
-headingRateLimit, 0.1, 0.1)),
wheelspeedctrl(PIDController(1.0, 0.082, 0.5, wheelSpeedLimit,
-wheelSpeedLimit, 0.1, 0.1))
headingctrl(1.0, 0.08, 0.5, headingRateLimit,
-headingRateLimit, 0.1, 0.1),
wheelspeedctrl(1.0, 0.082, 0.5, wheelSpeedLimit,
-wheelSpeedLimit, 0.1, 0.1)
{ }
void DifferentialDriveController::stop() {