SubZero Common
Common library components for an FRC CommandRobot
Loading...
Searching...
No Matches
subzero::SwerveUtils Class Reference

#include <SwerveUtils.h>

Static Public Member Functions

static double StepTowards (double current, double target, double stepsize)
 
static double StepTowardsCircular (double current, double target, double stepsize)
 
static double AngleDifference (double angleA, double angleB)
 
static double WrapAngle (double angle)
 

Detailed Description

Definition at line 4 of file SwerveUtils.h.

Member Function Documentation

◆ AngleDifference()

static double subzero::SwerveUtils::AngleDifference ( double angleA,
double angleB )
static

Finds the (unsigned) minimum difference between two angles including calculating across 0.

Parameters
angleAAn angle (in radians).
angleBAn 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
currentThe current or starting value. Can be positive or negative.
targetThe target value the algorithm will step towards. Can be positive or negative.
stepsizeThe 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
currentThe current or starting angle (in radians). Can lie outside the 0 to 2*PI range.
targetThe target angle (in radians) the algorithm will step towards. Can lie outside the 0 to 2*PI range.
stepsizeThe 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
angleThe 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: