Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
vpStatisticalTestMeanAdjustedCUSUM.h
1/*
2 * ViSP, open source Visual Servoing Platform software.
3 * Copyright (C) 2005 - 2025 by Inria. All rights reserved.
4 *
5 * This software is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 * See the file LICENSE.txt at the root directory of this source
10 * distribution for additional information about the GNU GPL.
11 *
12 * For using ViSP with software that can not be combined with the GNU
13 * GPL, please contact Inria about acquiring a ViSP Professional
14 * Edition License.
15 *
16 * See https://visp.inria.fr for more information.
17 *
18 * This software was developed at:
19 * Inria Rennes - Bretagne Atlantique
20 * Campus Universitaire de Beaulieu
21 * 35042 Rennes Cedex
22 * France
23 *
24 * If you have questions regarding the use of this file, please contact
25 * Inria at visp@inria.fr
26 *
27 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29 */
30
35
36#ifndef VP_STATISTICAL_TEST_MEAN_ADJUSTED_CUSUM_H
37#define VP_STATISTICAL_TEST_MEAN_ADJUSTED_CUSUM_H
38
39#include <visp3/core/vpConfig.h>
40
41#include <visp3/core/vpStatisticalTestAbstract.h>
42
88{
89protected:
90 float m_delta;
91 float m_h;
94 float m_k;
95 float m_sminus;
96 float m_splus;
97
101 virtual void computeDeltaAndLimits();
102
110 virtual vpMeanDriftType detectDownwardMeanDrift() VP_OVERRIDE;
111
117 virtual vpMeanDriftType detectUpwardMeanDrift() VP_OVERRIDE;
118
125 virtual bool updateStatistics(const float &signal) VP_OVERRIDE;
126
132 virtual void updateTestSignals(const float &signal) VP_OVERRIDE;
133
134public:
145 vpStatisticalTestMeanAdjustedCUSUM(const float &h = 4.f, const float &k = 1.f, const unsigned int &nbPtsForStats = 30);
146
153 inline float getDelta() const
154 {
155 return m_delta;
156 }
157
163 inline float getH() const
164 {
165 return m_h;
166 }
167
173 inline float getK() const
174 {
175 return m_k;
176 }
177
183 inline float getTestSignalMinus() const
184 {
185 return m_sminus;
186 }
187
193 inline float getTestSignalPlus() const
194 {
195 return m_splus;
196 }
197
207 void init(const float &h, const float &k, const unsigned int &nbPtsForStats);
208
218 void init(const float &delta, const float &limitDown, const float &limitUp, const unsigned int &nbPtsForStats);
219
230 void init(const float &h, const float &k, const float &mean, const float &stdev);
231
241 void init(const float &delta, const float &limitDown, const float &limitUp, const float &mean, const float &stdev);
242
248 inline void setDelta(const float &delta)
249 {
250 m_delta = delta;
251 m_half_delta = 0.5f * delta;
252 }
253
260 inline void setLimits(const float &limitDown, const float &limitUp)
261 {
262 m_limitDown = limitDown;
263 m_limitUp = limitUp;
264 }
265};
266END_VISP_NAMESPACE
267#endif
vpMeanDriftType
Enum that indicates if a drift of the mean occurred.
void init()
(Re)Initialize the algorithm.
vpStatisticalTestAbstract()
Construct a new vpStatisticalTestAbstract object.
virtual vpMeanDriftType detectDownwardMeanDrift()=0
Detects if a downward mean drift occurred.
float getTestSignalMinus() const
Get the latest value of the test signal for downward jumps of the mean.
float getTestSignalPlus() const
Get the latest value of the test signal for upward jumps of the mean.
virtual vpMeanDriftType detectUpwardMeanDrift() VP_OVERRIDE
Detects if a upward jump occurred on the mean.
vpStatisticalTestMeanAdjustedCUSUM(const float &h=4.f, const float &k=1.f, const unsigned int &nbPtsForStats=30)
Construct a new vpStatisticalTestMeanAdjustedCUSUM object.
virtual bool updateStatistics(const float &signal) VP_OVERRIDE
Update m_s and if enough values are available, compute the mean, the standard deviation and the limit...
virtual void computeDeltaAndLimits()
Compute the upper and lower limits of the test signal.
void setDelta(const float &delta)
Set the slack of the CUSUM test, i.e. the minimum value of the jumps we want to detect.
void setLimits(const float &limitDown, const float &limitUp)
Set the upward and downward jump limits.
float getDelta() const
Get the slack of the CUSUM test, i.e. amplitude of mean shift we want to be able to detect.
float getK() const
Get the detection factor.
virtual void updateTestSignals(const float &signal) VP_OVERRIDE
Update the test signals.