From 4db0295f42742fa5f5eb572439826db1c73beec1 Mon Sep 17 00:00:00 2001 From: ary Date: Sat, 14 Oct 2023 16:32:32 -0400 Subject: [PATCH] do some stuff and stuff --- RELENTLESS/include/ary-lib/util.hpp | 2 +- RELENTLESS/src/ary-lib/PID.cpp | 3 ++- RELENTLESS/src/ary-lib/util.cpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/RELENTLESS/include/ary-lib/util.hpp b/RELENTLESS/include/ary-lib/util.hpp index e932e4e..741ea28 100644 --- a/RELENTLESS/include/ary-lib/util.hpp +++ b/RELENTLESS/include/ary-lib/util.hpp @@ -89,7 +89,7 @@ extern bool AUTON_RAN; /** * Returns 1 if input is positive and -1 if input is negative */ -int sgn(double input); +int signum(double input); /** * Returns true if the input is < 0 diff --git a/RELENTLESS/src/ary-lib/PID.cpp b/RELENTLESS/src/ary-lib/PID.cpp index 10fd0bc..6fff97d 100644 --- a/RELENTLESS/src/ary-lib/PID.cpp +++ b/RELENTLESS/src/ary-lib/PID.cpp @@ -2,6 +2,7 @@ #include "util.hpp" using namespace ary; +using namespace util; void PID::reset_variables() { output = 0; @@ -59,7 +60,7 @@ double PID::calculate(double dist) { if (constants.ki != 0) { integral += error; - if (util::sgn(error) != util::sgn(lastError)) + if (signum(error) != signum(lastError)) integral = 0; } diff --git a/RELENTLESS/src/ary-lib/util.cpp b/RELENTLESS/src/ary-lib/util.cpp index 68f74e4..62a9060 100644 --- a/RELENTLESS/src/ary-lib/util.cpp +++ b/RELENTLESS/src/ary-lib/util.cpp @@ -131,7 +131,7 @@ bool is_reversed(double input) { return false; } -int sgn(double input) { +int signum(double input) { if (input > 0) return 1; else if (input < 0)