2022-Robot
Robot code for 2022 FRC Season by Argos, FRC team #1756
Loading...
Searching...
No Matches
argos_lib::InterpolationMap< T, size, V > Class Template Reference

Performs linear interpolation of a value based on a set of input->output mapping points. More...

#include <interpolation.h>

Public Member Functions

 InterpolationMap ()=delete
 
constexpr InterpolationMap (std::array< InterpMapPoint< T, V >, size > initArray)
 Constructs new interpolation map. More...
 
constexpr V Map (const T inVal) const
 Generate interpolated output based on input. More...
 
constexpr V operator() (const T inVal) const
 Generate interpolated output based on input. More...
 

Private Attributes

std::array< InterpMapPoint< T, V >, size > m_mapArray
 

Detailed Description

template<class T, int size, class V = T>
class argos_lib::InterpolationMap< T, size, V >

Performs linear interpolation of a value based on a set of input->output mapping points.

Template Parameters
TType of interpolated input
sizeNumber of elements in interpolation map
VType of interpolated output

Constructor & Destructor Documentation

◆ InterpolationMap() [1/2]

template<class T , int size, class V = T>
argos_lib::InterpolationMap< T, size, V >::InterpolationMap ( )
delete

◆ InterpolationMap() [2/2]

template<class T , int size, class V = T>
constexpr argos_lib::InterpolationMap< T, size, V >::InterpolationMap ( std::array< InterpMapPoint< T, V >, size >  initArray)
inlineconstexpr

Constructs new interpolation map.

Parameters
initArrayInterpolation points. Must be sorted by input value with smallest element first.

Member Function Documentation

◆ Map()

template<class T , int size, class V = T>
constexpr V argos_lib::InterpolationMap< T, size, V >::Map ( const T  inVal) const
inlineconstexpr

Generate interpolated output based on input.

Parameters
inValInput value to remap
Returns
Interpolated value

◆ operator()()

template<class T , int size, class V = T>
constexpr V argos_lib::InterpolationMap< T, size, V >::operator() ( const T  inVal) const
inlineconstexpr

Generate interpolated output based on input.

Parameters
inValInput value to remap
Returns
Interpolated value

Shorthand for InterpolationMap::Map()

Member Data Documentation

◆ m_mapArray

template<class T , int size, class V = T>
std::array<InterpMapPoint<T, V>, size> argos_lib::InterpolationMap< T, size, V >::m_mapArray
private

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