diff --git a/include/lemlib/odom/arc.hpp b/include/lemlib/odom/arc.hpp index 66cd7dbb..9c959d3e 100644 --- a/include/lemlib/odom/arc.hpp +++ b/include/lemlib/odom/arc.hpp @@ -21,7 +21,7 @@ class Arc : public Odom { * @brief Calibrate the sensors used for odom * */ - void calibrate(int timeout = 3000) override; + void calibrate() override; /** * @brief Update te position of odom * diff --git a/include/lemlib/odom/odom.hpp b/include/lemlib/odom/odom.hpp index c8cf6757..96b5d3ce 100644 --- a/include/lemlib/odom/odom.hpp +++ b/include/lemlib/odom/odom.hpp @@ -9,7 +9,7 @@ class Odom { * @brief Calibrate the sensors used for odom * */ - virtual void calibrate(int timeout = 3000) = 0; + virtual void calibrate() = 0; /** * @brief Update te position of odom * diff --git a/include/lemlib/util.hpp b/include/lemlib/util.hpp index b13d187f..de7f1789 100644 --- a/include/lemlib/util.hpp +++ b/include/lemlib/util.hpp @@ -61,6 +61,14 @@ float angleError(float angle1, float angle2, bool radians = true); */ int sgn(float x); +/** + * @brief Return the average of a vector of numbers + * + * @param values + * @return float + */ +float avg(std::vector values); + /** * @brief Exponential moving average * @@ -115,12 +123,4 @@ Waypoint closestWaypoint(const std::vector& waypoints, const Pose& tar * multiple intersections, the first one will be returned */ Pose circleLineIntersect(Pose p1, Pose p2, Pose center, float radius); - -/** - * @brief Check errno to see if a pros function has failed - * - * @return true errno indicates failure - * @return false errno does not indicate failure - */ -bool checkErrno(); } // namespace lemlib \ No newline at end of file diff --git a/src/lemlib/odom/arc.cpp b/src/lemlib/odom/arc.cpp index c0d04134..d8d19cfc 100644 --- a/src/lemlib/odom/arc.cpp +++ b/src/lemlib/odom/arc.cpp @@ -1,5 +1,3 @@ -#include -#include "lemlib/util.hpp" #include "lemlib/odom/arc.hpp" /** @@ -22,19 +20,8 @@ lemlib::Arc::Arc(std::vector& verticals, std::vector newImus; - while (true) { - for (auto it = imus.begin(); it < imus.end(); it++) { - if (!it->is_calibrating() && checkErrno()) { - newImus.push_back(*it); - it = imus.erase(it); - } - } - pros::delay(10); - } } diff --git a/src/lemlib/util.cpp b/src/lemlib/util.cpp index 7d3e35a9..eb71b788 100644 --- a/src/lemlib/util.cpp +++ b/src/lemlib/util.cpp @@ -8,7 +8,6 @@ * @copyright Copyright (c) 2023 * */ -#include #include #include #include @@ -208,8 +207,3 @@ lemlib::Pose lemlib::circleLineIntersect(Pose p1, Pose p2, Pose center, float ra // no intersection found return center; } - -/** - * Check errno to see if a device setup has failed - */ -bool checkErrno() { return errno == INT32_MAX || errno == ENODEV || errno == ENXIO; }