CTRE Phoenix C++ 5.33.1
ctre::phoenix::signals::MovingAverage Class Reference

Class to calculate the rolling average of a signal. More...

#include <ctre/phoenix/signals/MovingAverage.h>

Public Member Functions

 MovingAverage (int capacity)
 Constructor for a MovingAverage Object. More...
 
float Process (float input)
 Add input & calculate average. More...
 
void Clear ()
 Clears all data points. More...
 
void Push (float d)
 Add new item. More...
 
void Pop ()
 Pull out oldest item. More...
 
float GetSum ()
 
int GetCount ()
 

Detailed Description

Class to calculate the rolling average of a signal.

Constructor & Destructor Documentation

◆ MovingAverage()

ctre::phoenix::signals::MovingAverage::MovingAverage ( int  capacity)
inline

Constructor for a MovingAverage Object.

Parameters
capacitymaximum number of items this will hold

Member Function Documentation

◆ Clear()

void ctre::phoenix::signals::MovingAverage::Clear ( )
inline

Clears all data points.

◆ GetCount()

int ctre::phoenix::signals::MovingAverage::GetCount ( )
inline
Returns
the count of the items

◆ GetSum()

float ctre::phoenix::signals::MovingAverage::GetSum ( )
inline
Returns
the sum of the items

◆ Pop()

void ctre::phoenix::signals::MovingAverage::Pop ( )
inline

Pull out oldest item.

◆ Process()

float ctre::phoenix::signals::MovingAverage::Process ( float  input)
inline

Add input & calculate average.

Parameters
inputValue to add
Returns
new average

◆ Push()

void ctre::phoenix::signals::MovingAverage::Push ( float  d)
inline

Add new item.

Parameters
ditem to add

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