Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
vpStatisticalTestAbstract.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_ABSTRACT_H
37#define VP_STATISTICAL_TEST_ABSTRACT_H
38
39#include <algorithm>
40#include <cmath>
41#include <iostream>
42#include <string>
43
44#include <visp3/core/vpConfig.h>
45
64{
65public:
78
85 static std::string vpMeanDriftTypeToString(const vpMeanDriftType &type);
86
93 static vpMeanDriftType vpMeanDriftTypeFromString(const std::string &name);
94
103 static std::string getAvailableMeanDriftType(const std::string &prefix = "<", const std::string &sep = " , ",
104 const std::string &suffix = ">");
105
111 static void print(const vpMeanDriftType &type);
112
113protected:
115 float m_count;
117 float m_limitUp;
118 float m_mean;
120 float *m_s;
121 float m_stdev;
124
133
142
151 virtual bool updateStatistics(const float &signal);
152
158 virtual void updateTestSignals(const float &signal) = 0;
159public:
164
169
174
181 inline void getLimits(float &limitDown, float &limitUp) const
182 {
183 limitDown = m_limitDown;
184 limitUp = m_limitUp;
185 }
186
192 inline float getMean() const
193 {
194 return m_mean;
195 }
196
202 inline float getStdev() const
203 {
204 return m_stdev;
205 }
206
210 void init();
211
219
226 void setMinStdev(const float &stdevmin)
227 {
228 m_stdevmin = stdevmin;
229 }
230
237 void setNbSamplesForStat(const unsigned int &nbSamples);
238
248 vpMeanDriftType testDownUpwardMeanDrift(const float &signal);
249
259 vpMeanDriftType testDownwardMeanDrift(const float &signal);
260
270 vpMeanDriftType testUpwardMeanDrift(const float &signal);
271};
272END_VISP_NAMESPACE
273#endif
Base class for methods detecting the drift of the mean of a process.
vpMeanDriftType
Enum that indicates if a drift of the mean occurred.
void getLimits(float &limitDown, float &limitUp) const
Get the upper and lower limits of the test signal.
virtual vpMeanDriftType detectUpwardMeanDrift()=0
Detects if a upward mean drift occurred.
void setMinStdev(const float &stdevmin)
Set the minimum value of the standard deviation that is expected. The computed standard deviation can...
vpStatisticalTestAbstract()
Construct a new vpStatisticalTestAbstract object.
virtual bool updateStatistics(const float &signal)
Update m_s and if enough values are available, compute the mean, the standard deviation and the limit...
virtual void updateTestSignals(const float &signal)=0
Update the test signals.
float getMean() const
Get the mean used as reference.
float getStdev() const
Get the standard deviation used as reference.
virtual vpMeanDriftType detectDownwardMeanDrift()=0
Detects if a downward mean drift occurred.