Visual Servoing Platform
version 3.6.1 under development (2024-11-15)
|
#include <visp3/core/vpStatisticalTestMeanAdjustedCUSUM.h>
Public Types | |
enum | vpMeanDriftType { MEAN_DRIFT_NONE = 0 , MEAN_DRIFT_DOWNWARD = 1 , MEAN_DRIFT_UPWARD = 2 , MEAN_DRIFT_BOTH = 3 , MEAN_DRIFT_COUNT = 4 , MEAN_DRIFT_UNKNOWN = MEAN_DRIFT_COUNT } |
typedef enum vpStatisticalTestAbstract::vpMeanDriftType | vpMeanDriftType |
Public Member Functions | |
vpStatisticalTestMeanAdjustedCUSUM (const float &h=4.f, const float &k=1.f, const unsigned int &nbPtsForStats=30) | |
float | getDelta () const |
float | getH () const |
float | getK () const |
float | getTestSignalMinus () const |
float | getTestSignalPlus () const |
void | init (const float &h, const float &k, const unsigned int &nbPtsForStats) |
void | init (const float &delta, const float &limitDown, const float &limitUp, const unsigned int &nbPtsForStats) |
void | init (const float &h, const float &k, const float &mean, const float &stdev) |
void | init (const float &delta, const float &limitDown, const float &limitUp, const float &mean, const float &stdev) |
void | setDelta (const float &delta) |
void | setLimits (const float &limitDown, const float &limitUp) |
void | getLimits (float &limitDown, float &limitUp) const |
float | getMean () const |
float | getStdev () const |
void | init () |
void | setMinStdev (const float &stdevmin) |
void | setNbSamplesForStat (const unsigned int &nbSamples) |
vpMeanDriftType | testDownUpwardMeanDrift (const float &signal) |
vpMeanDriftType | testDownwardMeanDrift (const float &signal) |
vpMeanDriftType | testUpwardMeanDrift (const float &signal) |
Static Public Member Functions | |
static std::string | vpMeanDriftTypeToString (const vpMeanDriftType &type) |
static vpMeanDriftType | vpMeanDriftTypeFromString (const std::string &name) |
static std::string | getAvailableMeanDriftType (const std::string &prefix="<", const std::string &sep=" , ", const std::string &suffix=">") |
static void | print (const vpMeanDriftType &type) |
Protected Member Functions | |
virtual void | computeDeltaAndLimits () |
virtual vpMeanDriftType | detectDownwardMeanDrift () override |
virtual vpMeanDriftType | detectUpwardMeanDrift () override |
virtual bool | updateStatistics (const float &signal) override |
virtual void | updateTestSignals (const float &signal) override |
Protected Attributes | |
float | m_delta |
float | m_h |
float | m_half_delta |
float | m_k |
float | m_sminus |
float | m_splus |
bool | m_areStatisticsComputed |
float | m_count |
float | m_limitDown |
float | m_limitUp |
float | m_mean |
unsigned int | m_nbSamplesForStatistics |
float * | m_s |
float | m_stdev |
float | m_stdevmin |
float | m_sumForMean |
Class that permits to perform a mean adjusted Cumulative Sum test.
The mean adjusted CUSUM test is designed to detect drift in the mean of an observed signal .
Be the amplitude of the mean drift we want to detect. Two test signals are computed at each iteration:
A downward alarm is raised if:
An upward alarm is raised if:
To ease the understanding of the detection threshold and the alarm threshold , ViSP implemented these two thresholds as a multiple of the standard deviation of the signal :
To have an Average Run Lenght of ~374 samples for a detection threshold of 1 standard deviation , set to 4.76 .
To detect only downward drifts of the input signal use testDownwardMeanDrift().To detect only upward drifts in use testUpwardMeanDrift(). To detect both, downward and upward drifts use testDownUpwardMeanDrift().
Definition at line 81 of file vpStatisticalTestMeanAdjustedCUSUM.h.
|
inherited |
Enum that indicates if a drift of the mean occurred.
|
inherited |
Enum that indicates if a drift of the mean occurred.
Definition at line 63 of file vpStatisticalTestAbstract.h.
vpStatisticalTestMeanAdjustedCUSUM::vpStatisticalTestMeanAdjustedCUSUM | ( | const float & | h = 4.f , |
const float & | k = 1.f , |
||
const unsigned int & | nbPtsForStats = 30 |
||
) |
Construct a new vpStatisticalTestMeanAdjustedCUSUM object.
[in] | h | The alarm factor that permits to determine when the process is out of control from the standard deviation of the signal. |
[in] | k | The detection factor that permits to determine the slack of the CUSUM test, i.e. the minimum value of the jumps we want to detect, from the standard deviation of the signal. |
[in] | nbPtsForStats | The number of samples to use to compute the mean and the standard deviation of the signal to monitor. |
Definition at line 92 of file vpStatisticalTestMeanAdjustedCUSUM.cpp.
References vpStatisticalTestAbstract::init().
|
protectedvirtual |
Compute the upper and lower limits of the test signal.
Definition at line 42 of file vpStatisticalTestMeanAdjustedCUSUM.cpp.
References m_h, m_k, vpStatisticalTestAbstract::m_stdev, setDelta(), and setLimits().
Referenced by init(), and updateStatistics().
|
overrideprotectedvirtual |
Detects if a downward mean drift occurred.
Implements vpStatisticalTestAbstract.
Definition at line 50 of file vpStatisticalTestMeanAdjustedCUSUM.cpp.
References vpStatisticalTestAbstract::m_limitDown, m_sminus, vpStatisticalTestAbstract::MEAN_DRIFT_DOWNWARD, and vpStatisticalTestAbstract::MEAN_DRIFT_NONE.
|
overrideprotectedvirtual |
Detects if a upward jump occurred on the mean.
Implements vpStatisticalTestAbstract.
Definition at line 60 of file vpStatisticalTestMeanAdjustedCUSUM.cpp.
References vpStatisticalTestAbstract::m_limitUp, m_splus, vpStatisticalTestAbstract::MEAN_DRIFT_NONE, and vpStatisticalTestAbstract::MEAN_DRIFT_UPWARD.
|
staticinherited |
Get the list of available vpMeanDriftType objects that are handled.
[in] | prefix | The prefix that should be placed before the list. |
[in] | sep | The separator between each element of the list. |
[in] | suffix | The suffix that should terminate the list. |
Definition at line 82 of file vpStatisticalTestAbstract.cpp.
References vpStatisticalTestAbstract::MEAN_DRIFT_COUNT, and vpStatisticalTestAbstract::vpMeanDriftTypeToString().
|
inline |
Get the slack of the CUSUM test, i.e. amplitude of mean shift we want to be able to detect.
Definition at line 162 of file vpStatisticalTestMeanAdjustedCUSUM.h.
|
inline |
Get the alarm factor.
Definition at line 172 of file vpStatisticalTestMeanAdjustedCUSUM.h.
|
inline |
Get the detection factor.
Definition at line 182 of file vpStatisticalTestMeanAdjustedCUSUM.h.
|
inlineinherited |
Get the upper and lower limits of the test signal.
[out] | limitDown | The lower limit. |
[out] | limitUp | The upper limit. |
Definition at line 175 of file vpStatisticalTestAbstract.h.
|
inlineinherited |
Get the mean used as reference.
Definition at line 186 of file vpStatisticalTestAbstract.h.
|
inlineinherited |
Get the standard deviation used as reference.
Definition at line 196 of file vpStatisticalTestAbstract.h.
|
inline |
Get the latest value of the test signal for downward jumps of the mean.
Definition at line 192 of file vpStatisticalTestMeanAdjustedCUSUM.h.
|
inline |
Get the latest value of the test signal for upward jumps of the mean.
Definition at line 202 of file vpStatisticalTestMeanAdjustedCUSUM.h.
|
inherited |
(Re)Initialize the algorithm.
Definition at line 154 of file vpStatisticalTestAbstract.cpp.
References vpStatisticalTestAbstract::m_areStatisticsComputed, vpStatisticalTestAbstract::m_count, vpStatisticalTestAbstract::m_limitDown, vpStatisticalTestAbstract::m_limitUp, vpStatisticalTestAbstract::m_mean, vpStatisticalTestAbstract::m_nbSamplesForStatistics, vpStatisticalTestAbstract::m_s, vpStatisticalTestAbstract::m_stdev, and vpStatisticalTestAbstract::m_sumForMean.
Referenced by vpStatisticalTestHinkley::init(), vpStatisticalTestShewhart::init(), vpStatisticalTestEWMA::init(), init(), vpStatisticalTestSigma::init(), vpStatisticalTestEWMA::setAlpha(), vpStatisticalTestEWMA::vpStatisticalTestEWMA(), vpStatisticalTestMeanAdjustedCUSUM(), vpStatisticalTestShewhart::vpStatisticalTestShewhart(), and vpStatisticalTestSigma::vpStatisticalTestSigma().
void vpStatisticalTestMeanAdjustedCUSUM::init | ( | const float & | delta, |
const float & | limitDown, | ||
const float & | limitUp, | ||
const float & | mean, | ||
const float & | stdev | ||
) |
Initialize the mean adjusted CUSUM test.
[in] | delta | The slack of the CUSUM test, i.e. the minimum value of the jumps we want to detect. |
[in] | limitDown | The lower limit of the CUSUM test, for the downward jumps. |
[in] | limitUp | The upper limit of the CUSUM test, for the upward jumps. |
[in] | mean | The expected mean of the signal to monitor. |
[in] | stdev | The expected standard deviation of the signal to monitor. |
Definition at line 144 of file vpStatisticalTestMeanAdjustedCUSUM.cpp.
References vpStatisticalTestAbstract::init(), vpStatisticalTestAbstract::m_areStatisticsComputed, vpStatisticalTestAbstract::m_mean, m_sminus, m_splus, vpStatisticalTestAbstract::m_stdev, vpStatisticalTestAbstract::m_sumForMean, setDelta(), and setLimits().
void vpStatisticalTestMeanAdjustedCUSUM::init | ( | const float & | delta, |
const float & | limitDown, | ||
const float & | limitUp, | ||
const unsigned int & | nbPtsForStats | ||
) |
Initialize the mean adjusted CUSUM test.
[in] | delta | The slack of the CUSUM test, i.e. the minimum value of the jumps we want to detect. |
[in] | limitDown | The lower limit of the CUSUM test, for the downward jumps. |
[in] | limitUp | The upper limit of the CUSUM test, for the upward jumps. |
[in] | nbPtsForStats | The number of points to use to compute the mean and the standard deviation of the signal to monitor. |
Definition at line 119 of file vpStatisticalTestMeanAdjustedCUSUM.cpp.
References vpStatisticalTestAbstract::init(), m_sminus, m_splus, setDelta(), setLimits(), and vpStatisticalTestAbstract::setNbSamplesForStat().
void vpStatisticalTestMeanAdjustedCUSUM::init | ( | const float & | h, |
const float & | k, | ||
const float & | mean, | ||
const float & | stdev | ||
) |
Initialize the mean adjusted CUSUM test.
[in] | h | The alarm factor that permits to determine when the process is out of control from the standard deviation of the signal. |
[in] | k | The detection factor that permits to determine the slack of the CUSUM test, i.e. the minimum value of the jumps we want to detect, from the standard deviation of the signal. |
[in] | mean | The expected mean of the signal to monitor. |
[in] | stdev | The expected standard deviation of the signal to monitor. |
Definition at line 129 of file vpStatisticalTestMeanAdjustedCUSUM.cpp.
References computeDeltaAndLimits(), vpStatisticalTestAbstract::init(), vpStatisticalTestAbstract::m_areStatisticsComputed, m_h, m_k, vpStatisticalTestAbstract::m_mean, m_sminus, m_splus, vpStatisticalTestAbstract::m_stdev, and setLimits().
void vpStatisticalTestMeanAdjustedCUSUM::init | ( | const float & | h, |
const float & | k, | ||
const unsigned int & | nbPtsForStats | ||
) |
(Re)Initialize the mean adjusted CUSUM test.
[in] | h | The alarm factor that permits to determine when the process is out of control from the standard deviation of the signal. |
[in] | k | The detection factor that permits to determine the slack of the CUSUM test, i.e. the minimum value of the jumps we want to detect, from the standard deviation of the signal. |
[in] | nbPtsForStats | The number of points to use to compute the mean and the standard deviation of the signal |
Definition at line 104 of file vpStatisticalTestMeanAdjustedCUSUM.cpp.
References vpStatisticalTestAbstract::init(), m_delta, m_h, m_half_delta, m_k, vpStatisticalTestAbstract::m_mean, m_sminus, m_splus, vpStatisticalTestAbstract::m_stdev, setLimits(), and vpStatisticalTestAbstract::setNbSamplesForStat().
|
staticinherited |
Print the message corresponding to the type of mean drift.
[in] | type | The type of mean drift. |
Definition at line 95 of file vpStatisticalTestAbstract.cpp.
References vpStatisticalTestAbstract::vpMeanDriftTypeToString().
|
inline |
Set the slack of the CUSUM test, i.e. the minimum value of the jumps we want to detect.
[in] | delta | The slack of the CUSUM test. |
Definition at line 257 of file vpStatisticalTestMeanAdjustedCUSUM.h.
Referenced by computeDeltaAndLimits(), and init().
|
inline |
Set the upward and downward jump limits.
[in] | limitDown | The limit for the downward jumps. |
[in] | limitUp | The limit for the upward jumps. |
Definition at line 269 of file vpStatisticalTestMeanAdjustedCUSUM.h.
Referenced by computeDeltaAndLimits(), and init().
|
inlineinherited |
Set the minimum value of the standard deviation that is expected. The computed standard deviation cannot be lower this value if set.
[in] | stdevmin | The minimum value of the standard deviation that is expected. |
Definition at line 220 of file vpStatisticalTestAbstract.h.
|
inherited |
Set the number of samples required to compute the mean and standard deviation of the signal and allocate the memory accordingly.
[in] | nbSamples | The number of samples we want to use. |
Definition at line 190 of file vpStatisticalTestAbstract.cpp.
References vpStatisticalTestAbstract::m_nbSamplesForStatistics, and vpStatisticalTestAbstract::m_s.
Referenced by vpStatisticalTestHinkley::init(), vpStatisticalTestEWMA::init(), init(), vpStatisticalTestSigma::init(), and vpStatisticalTestAbstract::operator=().
|
inherited |
Test if a downward or an upward mean drift occurred according to the new value of the signal.
[in] | signal | The new value of the signal. |
Definition at line 199 of file vpStatisticalTestAbstract.cpp.
References vpStatisticalTestAbstract::detectDownwardMeanDrift(), vpStatisticalTestAbstract::detectUpwardMeanDrift(), vpStatisticalTestAbstract::m_areStatisticsComputed, vpStatisticalTestAbstract::MEAN_DRIFT_BOTH, vpStatisticalTestAbstract::MEAN_DRIFT_NONE, vpStatisticalTestAbstract::updateStatistics(), and vpStatisticalTestAbstract::updateTestSignals().
|
inherited |
Test if a downward mean drift occurred according to the new value of the signal.
[in] | signal | The new value of the signal. |
Definition at line 224 of file vpStatisticalTestAbstract.cpp.
References vpStatisticalTestAbstract::detectDownwardMeanDrift(), vpStatisticalTestAbstract::m_areStatisticsComputed, vpStatisticalTestAbstract::MEAN_DRIFT_NONE, vpStatisticalTestAbstract::updateStatistics(), and vpStatisticalTestAbstract::updateTestSignals().
|
inherited |
Test if an upward mean drift occurred according to the new value of the signal.
[in] | signal | The new value of the signal. |
Definition at line 236 of file vpStatisticalTestAbstract.cpp.
References vpStatisticalTestAbstract::detectUpwardMeanDrift(), vpStatisticalTestAbstract::m_areStatisticsComputed, vpStatisticalTestAbstract::MEAN_DRIFT_NONE, vpStatisticalTestAbstract::updateStatistics(), and vpStatisticalTestAbstract::updateTestSignals().
|
overrideprotectedvirtual |
Update m_s and if enough values are available, compute the mean, the standard deviation and the limits.
[in] | signal | The new value of the signal to monitor. |
Reimplemented from vpStatisticalTestAbstract.
Definition at line 70 of file vpStatisticalTestMeanAdjustedCUSUM.cpp.
References computeDeltaAndLimits(), vpStatisticalTestAbstract::m_limitDown, vpStatisticalTestAbstract::m_limitUp, m_sminus, m_splus, and vpStatisticalTestAbstract::updateStatistics().
|
overrideprotectedvirtual |
Update the test signals.
[in] | signal | The new value of the signal to monitor. |
Implements vpStatisticalTestAbstract.
Definition at line 86 of file vpStatisticalTestMeanAdjustedCUSUM.cpp.
References m_half_delta, vpStatisticalTestAbstract::m_mean, m_sminus, and m_splus.
|
staticinherited |
Cast a string into a vpMeanDriftType.
[in] | name | The name of the mean drift. |
Definition at line 65 of file vpStatisticalTestAbstract.cpp.
References vpStatisticalTestAbstract::MEAN_DRIFT_COUNT, vpStatisticalTestAbstract::MEAN_DRIFT_UNKNOWN, and vpStatisticalTestAbstract::vpMeanDriftTypeToString().
|
staticinherited |
Cast a vpMeanDriftType into a string.
[in] | type | The type of mean drift. |
Definition at line 41 of file vpStatisticalTestAbstract.cpp.
References vpStatisticalTestAbstract::MEAN_DRIFT_BOTH, vpStatisticalTestAbstract::MEAN_DRIFT_DOWNWARD, vpStatisticalTestAbstract::MEAN_DRIFT_NONE, vpStatisticalTestAbstract::MEAN_DRIFT_UNKNOWN, and vpStatisticalTestAbstract::MEAN_DRIFT_UPWARD.
Referenced by vpStatisticalTestAbstract::getAvailableMeanDriftType(), vpStatisticalTestAbstract::print(), and vpStatisticalTestAbstract::vpMeanDriftTypeFromString().
|
protectedinherited |
Set to true once the mean and the standard deviation are available.
Definition at line 108 of file vpStatisticalTestAbstract.h.
Referenced by vpStatisticalTestAbstract::init(), vpStatisticalTestShewhart::init(), vpStatisticalTestHinkley::init(), vpStatisticalTestEWMA::init(), init(), vpStatisticalTestSigma::init(), vpStatisticalTestAbstract::operator=(), vpStatisticalTestAbstract::testDownUpwardMeanDrift(), vpStatisticalTestAbstract::testDownwardMeanDrift(), vpStatisticalTestAbstract::testUpwardMeanDrift(), vpStatisticalTestAbstract::updateStatistics(), and vpStatisticalTestHinkley::updateStatistics().
|
protectedinherited |
Current number of data used to compute the mean and the standard deviation.
Definition at line 109 of file vpStatisticalTestAbstract.h.
Referenced by vpStatisticalTestHinkley::computeMean(), vpStatisticalTestAbstract::init(), vpStatisticalTestAbstract::operator=(), vpStatisticalTestAbstract::updateStatistics(), and vpStatisticalTestHinkley::updateTestSignals().
|
protected |
Slack of the CUSUM test, i.e. amplitude of mean shift we want to be able to detect.
Definition at line 84 of file vpStatisticalTestMeanAdjustedCUSUM.h.
Referenced by init().
|
protected |
Alarm factor that permits to determine the limit telling when a mean shift occurs: . To have an Average Run Lenght of ~374 samples for a detection of 1 stdev, set it to 4.76f
Definition at line 85 of file vpStatisticalTestMeanAdjustedCUSUM.h.
Referenced by computeDeltaAndLimits(), and init().
|
protected |
Half of the amplitude we want to detect.
Definition at line 87 of file vpStatisticalTestMeanAdjustedCUSUM.h.
Referenced by init(), and updateTestSignals().
|
protected |
Detection factor that permits to determine the slack: .
Definition at line 88 of file vpStatisticalTestMeanAdjustedCUSUM.h.
Referenced by computeDeltaAndLimits(), and init().
|
protectedinherited |
Upper limit for the test signal m_wt.
Definition at line 110 of file vpStatisticalTestAbstract.h.
Referenced by vpStatisticalTestEWMA::computeDeltaAndLimits(), vpStatisticalTestSigma::computeLimits(), vpStatisticalTestShewhart::computeLimits(), vpStatisticalTestEWMA::detectDownwardMeanDrift(), detectDownwardMeanDrift(), vpStatisticalTestShewhart::detectDownwardMeanDrift(), vpStatisticalTestSigma::detectDownwardMeanDrift(), vpStatisticalTestAbstract::init(), vpStatisticalTestAbstract::operator=(), vpStatisticalTestHinkley::setAlpha(), and updateStatistics().
|
protectedinherited |
Lower limit for the test signal m_wt
Definition at line 111 of file vpStatisticalTestAbstract.h.
Referenced by vpStatisticalTestEWMA::computeDeltaAndLimits(), vpStatisticalTestSigma::computeLimits(), vpStatisticalTestShewhart::computeLimits(), vpStatisticalTestEWMA::detectUpwardMeanDrift(), detectUpwardMeanDrift(), vpStatisticalTestShewhart::detectUpwardMeanDrift(), vpStatisticalTestSigma::detectUpwardMeanDrift(), vpStatisticalTestAbstract::init(), vpStatisticalTestAbstract::operator=(), vpStatisticalTestHinkley::setAlpha(), and updateStatistics().
|
protectedinherited |
Mean of the monitored signal.
Definition at line 112 of file vpStatisticalTestAbstract.h.
Referenced by vpStatisticalTestEWMA::computeDeltaAndLimits(), vpStatisticalTestSigma::computeLimits(), vpStatisticalTestShewhart::computeLimits(), vpStatisticalTestHinkley::computeMean(), vpStatisticalTestHinkley::computeSk(), vpStatisticalTestHinkley::computeTk(), vpStatisticalTestShewhart::detectDownwardMeanDrift(), vpStatisticalTestShewhart::detectUpwardMeanDrift(), vpStatisticalTestAbstract::init(), vpStatisticalTestShewhart::init(), vpStatisticalTestHinkley::init(), vpStatisticalTestEWMA::init(), init(), vpStatisticalTestSigma::init(), vpStatisticalTestAbstract::operator=(), vpStatisticalTestAbstract::updateStatistics(), vpStatisticalTestEWMA::updateStatistics(), and updateTestSignals().
|
protectedinherited |
Number of samples to use to compute the mean and the standard deviation.
Definition at line 113 of file vpStatisticalTestAbstract.h.
Referenced by vpStatisticalTestAbstract::init(), vpStatisticalTestAbstract::operator=(), vpStatisticalTestAbstract::setNbSamplesForStat(), and vpStatisticalTestAbstract::updateStatistics().
|
protectedinherited |
Array that keeps the samples used to compute the mean and standard deviation.
Definition at line 114 of file vpStatisticalTestAbstract.h.
Referenced by vpStatisticalTestSigma::getSignal(), vpStatisticalTestAbstract::init(), vpStatisticalTestAbstract::operator=(), vpStatisticalTestAbstract::setNbSamplesForStat(), vpStatisticalTestAbstract::updateStatistics(), and vpStatisticalTestAbstract::~vpStatisticalTestAbstract().
|
protected |
Test signal for downward mean shift: .
Definition at line 89 of file vpStatisticalTestMeanAdjustedCUSUM.h.
Referenced by detectDownwardMeanDrift(), init(), updateStatistics(), and updateTestSignals().
|
protected |
Test signal for upward mean shift: .
Definition at line 90 of file vpStatisticalTestMeanAdjustedCUSUM.h.
Referenced by detectUpwardMeanDrift(), init(), updateStatistics(), and updateTestSignals().
|
protectedinherited |
Standard deviation of the monitored signal.
Definition at line 115 of file vpStatisticalTestAbstract.h.
Referenced by vpStatisticalTestHinkley::computeAlphaDelta(), vpStatisticalTestEWMA::computeDeltaAndLimits(), computeDeltaAndLimits(), vpStatisticalTestSigma::computeLimits(), vpStatisticalTestShewhart::computeLimits(), vpStatisticalTestAbstract::init(), vpStatisticalTestShewhart::init(), vpStatisticalTestEWMA::init(), vpStatisticalTestHinkley::init(), init(), vpStatisticalTestSigma::init(), vpStatisticalTestAbstract::operator=(), and vpStatisticalTestAbstract::updateStatistics().
|
protectedinherited |
Minimum allowed standard deviation of the monitored signal.
Definition at line 116 of file vpStatisticalTestAbstract.h.
Referenced by vpStatisticalTestAbstract::updateStatistics().
|
protectedinherited |
Sum of the samples used to compute the mean and standard deviation.
Definition at line 117 of file vpStatisticalTestAbstract.h.
Referenced by vpStatisticalTestAbstract::init(), init(), vpStatisticalTestAbstract::operator=(), and vpStatisticalTestAbstract::updateStatistics().