#include <SwerveUtils.h>
Definition at line 4 of file SwerveUtils.h.
◆ AngleDifference()
static double subzero::SwerveUtils::AngleDifference |
( |
double | angleA, |
|
|
double | angleB ) |
|
static |
Finds the (unsigned) minimum difference between two angles including calculating across 0.
- Parameters
-
angleA | An angle (in radians). |
angleB | An angle (in radians). |
- Returns
- The (unsigned) minimum difference between the two angles (in radians).
◆ StepTowards()
static double subzero::SwerveUtils::StepTowards |
( |
double | current, |
|
|
double | target, |
|
|
double | stepsize ) |
|
static |
Steps a value towards a target with a specified step size.
- Parameters
-
current | The current or starting value. Can be positive or negative. |
target | The target value the algorithm will step towards. Can be positive or negative. |
stepsize | The maximum step size that can be taken. |
- Returns
- The new value for
_current
after performing the specified step towards the specified target.
◆ StepTowardsCircular()
static double subzero::SwerveUtils::StepTowardsCircular |
( |
double | current, |
|
|
double | target, |
|
|
double | stepsize ) |
|
static |
Steps a value (angle) towards a target (angle) taking the shortest path with a specified step size.
- Parameters
-
current | The current or starting angle (in radians). Can lie outside the 0 to 2*PI range. |
target | The target angle (in radians) the algorithm will step towards. Can lie outside the 0 to 2*PI range. |
stepsize | The maximum step size that can be taken (in radians). |
- Returns
- The new angle (in radians) for
_current
after performing the specified step towards the specified target. This value will always lie in the range 0 to 2*PI (exclusive).
◆ WrapAngle()
static double subzero::SwerveUtils::WrapAngle |
( |
double | angle | ) |
|
|
static |
Wraps an angle until it lies within the range from 0 to 2*PI (exclusive).
- Parameters
-
angle | The angle (in radians) to wrap. Can be positive or negative and can lie multiple wraps outside the output range. |
- Returns
- An angle (in radians) from 0 and 2*PI (exclusive).
The documentation for this class was generated from the following file: