mirror of
https://github.com/nasa/trick.git
synced 2025-02-22 01:46:41 +00:00
Implement PIDController to Wheelbot (#1023)
This commit is contained in:
parent
eaeb8118b1
commit
07030127f9
@ -45,20 +45,20 @@ double PIDController::getOutput(double setpoint_value, double measured_value) {
|
|||||||
// Sign Check
|
// Sign Check
|
||||||
bool same_sign;
|
bool same_sign;
|
||||||
if ((error * output) > 0.0) {
|
if ((error * output) > 0.0) {
|
||||||
same_sign = 1;
|
same_sign = true;
|
||||||
} else {
|
} else {
|
||||||
same_sign = 0;
|
same_sign = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Saturation Check
|
//Saturation Check
|
||||||
bool output_limited;
|
bool output_limited = false;
|
||||||
if (output > out_max) {
|
if (output > out_max) {
|
||||||
output = out_max;
|
output = out_max;
|
||||||
output_limited = 1;
|
output_limited = true;
|
||||||
}
|
}
|
||||||
if (output < out_min) {
|
if (output < out_min) {
|
||||||
output = out_min;
|
output = out_min;
|
||||||
output_limited = 1;
|
output_limited = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//AND Gate Check
|
//AND Gate Check
|
||||||
|
@ -27,10 +27,10 @@ DifferentialDriveController::
|
|||||||
desiredHeadingRate(0.0),
|
desiredHeadingRate(0.0),
|
||||||
|
|
||||||
// PID Controller Initialization
|
// PID Controller Initialization
|
||||||
headingctrl(PIDController(1.0, 0.08, 0.5, headingRateLimit,
|
headingctrl(1.0, 0.08, 0.5, headingRateLimit,
|
||||||
-headingRateLimit, 0.1, 0.1)),
|
-headingRateLimit, 0.1, 0.1),
|
||||||
wheelspeedctrl(PIDController(1.0, 0.082, 0.5, wheelSpeedLimit,
|
wheelspeedctrl(1.0, 0.082, 0.5, wheelSpeedLimit,
|
||||||
-wheelSpeedLimit, 0.1, 0.1))
|
-wheelSpeedLimit, 0.1, 0.1)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
void DifferentialDriveController::stop() {
|
void DifferentialDriveController::stop() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user