CTRE_Phoenix 5.20.2
ctre::phoenix::Utilities Class Reference

#include <Utilities.h>

Static Public Member Functions

static float abs (float f)
 
static float bound (float value, float capValue=1)
 
static float cap (float value, float peak)
 
static void Deadband (float &value, float deadband=-.10f)
 
static bool IsWithin (float value, float compareTo, float allowDelta)
 
static int SmallerOf (int value_1, int value_2)
 
static void Split_1 (float forward, float turn, float *left, float *right)
 
static void Split_2 (float left, float right, float *forward, float *turn)
 

Detailed Description

Class with basic utility methods

Member Function Documentation

◆ abs()

static float ctre::phoenix::Utilities::abs ( float  f)
static

Calculates absolute value of f

Parameters
fvalue to calculate absolute value of
Returns
absolute value of f

◆ bound()

static float ctre::phoenix::Utilities::bound ( float  value,
float  capValue = 1 
)
static

Caps the value

Parameters
valueValue to cap
capValueMaximum/-Minimum value can be
Returns
Capped value

◆ cap()

static float ctre::phoenix::Utilities::cap ( float  value,
float  peak 
)
static

Caps the value

Parameters
valueValue to cap
peakMaximum/-Minimum value can be
Returns
Capped value

◆ Deadband()

static void ctre::phoenix::Utilities::Deadband ( float &  value,
float  deadband = -.10f 
)
static

Deadbands the value

Parameters
valuereference of value to deadband
deadbandIf abs of value is under this, it will be brought to 0

◆ IsWithin()

static bool ctre::phoenix::Utilities::IsWithin ( float  value,
float  compareTo,
float  allowDelta 
)
static

Calculates if value is within a delta

Parameters
valueinitial value to compare
compareTovalue to compare against first value
allowDeltathe range value can be away from compareTo
Returns
true if value is within allowDelta range of compareTo

◆ SmallerOf()

static int ctre::phoenix::Utilities::SmallerOf ( int  value_1,
int  value_2 
)
static

Gets the minimum of the two values

Parameters
value_1first value
value_2second value
Returns
minimum value

◆ Split_1()

static void ctre::phoenix::Utilities::Split_1 ( float  forward,
float  turn,
float *  left,
float *  right 
)
static

Converts forward and turn to left and right speeds

Parameters
forwardforward value of robot
turnturn value of robot
leftPointer to the left speed of robot, this will be filled
rightPointer to the right speed of robot, this will be filled

◆ Split_2()

static void ctre::phoenix::Utilities::Split_2 ( float  left,
float  right,
float *  forward,
float *  turn 
)
static

Converts left and right to forward and turn speeds

Parameters
leftleft speed of robot
rightright speed of robot
forwardPointer to the forward speed of the robot, this will be filled
turnPointer to the turn speed of the robot, this will be filled

The documentation for this class was generated from the following file: