LemLib  0.4.7
An easy to use and feature-rich PROS template
Loading...
Searching...
No Matches
util.hpp
Go to the documentation of this file.
1
12#pragma once
13
14#include <vector>
15
16namespace lemlib {
26float slew(float target, float current, float maxChange);
27
34float radToDeg(float rad);
35
42float degToRad(float deg);
43
52float angleError(float angle1, float angle2, bool radians = false);
53
60float sgn(float x);
61
68float avg(std::vector<float> values);
69
76double avg(std::vector<double> values);
77} // namespace lemlib
float avg(std::vector< float > values)
Return the average of a vector of numbers.
float sgn(float x)
Return the sign of a number.
float radToDeg(float rad)
Convert radians to degrees.
float degToRad(float deg)
Convert degrees to radians.
float slew(float target, float current, float maxChange)
Slew rate limiter.
float angleError(float angle1, float angle2, bool radians=false)
Calculate the error between 2 angles. Useful when calculating the error between 2 headings.