CTRE Phoenix C++ 5.33.1
ctre::phoenix::Utilities Class Reference

Class with basic utility methods. More...

#include <ctre/phoenix/Utilities.h>

Static Public Member Functions

static float abs (float f)
 Calculates absolute value of f. More...
 
static float bound (float value, float capValue=1)
 Caps the value. More...
 
static float cap (float value, float peak)
 Caps the value. More...
 
static void Deadband (float &value, float deadband=-.10f)
 Deadbands the value. More...
 
static bool IsWithin (float value, float compareTo, float allowDelta)
 Calculates if value is within a delta. More...
 
static int SmallerOf (int value_1, int value_2)
 Gets the minimum of the two values. More...
 
static void Split_1 (float forward, float turn, float *left, float *right)
 Converts forward and turn to left and right speeds. More...
 
static void Split_2 (float left, float right, float *forward, float *turn)
 Converts left and right to forward and turn speeds. More...
 

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: