Utility Functions
package com.arcrobotics.ftclib.util;
FTCLib comes with many different Utility Functions:
What is a Look Up Table?
A look up table or LUT for short is used to store values and be able to quickly recall them.
The FTCLib provides 2 different variations of look up tables. In this year's game they can be used to store different set and tested velocities or angles. You can either retrieve the closest reference or you can interpolate through them.
LUT (Look Up Table)
Provides a way to store values in a table to quickly retrieve them. For example, this might be used to store different speeds or angles based on certain distances. This class allows you to find the closest entry to the input.
For example if you enter:
When you request 1.1, it will return 1.
Example Usage:
InterpLUT (Interpolated Look Up Table)
Provides a way to fill in the gaps in the data. Similarly to the LUT above, this allows you to add data points and retrieve a data point given an output. The difference between a normal LUT and InterpLUT is that the interpolated LUT uses math to fill in all the gaps. Effectively generating filler data based on the data around it.
Example Usage:
Timing Functions
FTCLib Comes with multiple timers and Timing Functions. They let you set the length, unit, can act as a stopwatch or even return the loop time.
Timer
A timer can be created with a length or length and Time Unit. The various functions nested within the Timer object are:
Math Utilities
FTCLib currently adds 1 math utility, clamp. It lets you restrict a value to a certain max and min and is usable in double and int.
Example Usage:
Double Method:
Int Method:
Directional Enums
FTCLib comes with multiple directional enums for all your directional needs! You can use these for any autonomous or TeleOP States or anything you want!
You can find some examples in the sample folder.
Last updated