diff --git a/RELENTLESS/include/ary-lib/PID.hpp b/RELENTLESS/include/ary-lib/PID.hpp index 3f2e664..3d5bb91 100644 --- a/RELENTLESS/include/ary-lib/PID.hpp +++ b/RELENTLESS/include/ary-lib/PID.hpp @@ -98,7 +98,7 @@ class PID { * \param current * Current sensor library. */ - double compute(double current); + double calculate(double current); /** * Returns target value. diff --git a/RELENTLESS/src/ary-lib/PID.cpp b/RELENTLESS/src/ary-lib/PID.cpp index a58e0f9..10fd0bc 100644 --- a/RELENTLESS/src/ary-lib/PID.cpp +++ b/RELENTLESS/src/ary-lib/PID.cpp @@ -48,7 +48,7 @@ void PID::set_exit_condition(int p_small_exit_time, double p_small_error, int p_ void PID::set_target(double input) { target = input; } double PID::get_target() { return target; } -double PID::compute(double dist) { +double PID::calculate(double dist) { error = target - dist; // Calculate the error derivative = error - lastError; // Calculate the derivative term @@ -63,9 +63,9 @@ double PID::compute(double dist) { integral = 0; } - output = (error * constants.kp) + (integral * constants.ki) + (derivative * constants.kd); + output = (error * constants.kp) + (integral * constants.ki) + (derivative * constants.kd); // Combine all of the terms to get an output speed - lastError = error; + lastError = error; // Set the last error to the previously calculated error. return output; } diff --git a/RELENTLESS/src/ary-lib/drive/pid_tasks.cpp b/RELENTLESS/src/ary-lib/drive/pid_tasks.cpp index 3fba4a8..8322aa4 100644 --- a/RELENTLESS/src/ary-lib/drive/pid_tasks.cpp +++ b/RELENTLESS/src/ary-lib/drive/pid_tasks.cpp @@ -31,9 +31,9 @@ void Drive::ez_auto_task() { // Drive PID task void Drive::drive_pid_task() { // Compute PID - leftPID.compute(left_sensor()); - rightPID.compute(right_sensor()); - headingPID.compute(get_gyro()); + leftPID.calculate(left_sensor()); + rightPID.calculate(right_sensor()); + headingPID.calculate(get_gyro()); // Compute slew double l_slew_out = slew_calculate(left_slew, left_sensor()); @@ -58,7 +58,7 @@ void Drive::drive_pid_task() { // Turn PID task void Drive::turn_pid_task() { // Compute PID - turnPID.compute(get_gyro()); + turnPID.calculate(get_gyro()); // Clip gyroPID to max speed double gyro_out = util::clip_num(turnPID.output, max_speed, -max_speed); @@ -77,7 +77,7 @@ void Drive::turn_pid_task() { // Swing PID task void Drive::swing_pid_task() { // Compute PID - swingPID.compute(get_gyro()); + swingPID.calculate(get_gyro()); // Clip swingPID to max speed double swing_out = util::clip_num(swingPID.output, max_speed, -max_speed);