Visual Servoing Platform
version 3.7.0
Toggle main menu visibility
Loading...
Searching...
No Matches
vpStatisticalTestShewhart.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_SHEWHART_H
37
#define VP_STATISTICAL_TEST_SHEWHART_H
38
39
#include <vector>
40
41
#include <visp3/core/vpConfig.h>
42
#include <visp3/core/vpStatisticalTestSigma.h>
43
44
BEGIN_VISP_NAMESPACE
79
80
class
VISP_EXPORT
vpStatisticalTestShewhart
:
public
vpStatisticalTestSigma
81
{
82
public
:
83
typedef
enum
vpWecoRulesAlarm
84
{
85
THREE_SIGMA_WECO
= 0,
86
TWO_SIGMA_WECO
= 1,
87
ONE_SIGMA_WECO
= 2,
88
SAME_SIDE_WECO
= 3,
89
NONE_WECO
= 4,
90
COUNT_WECO
= 5
91
} vpWecoRulesAlarm;
92
93
static
std::string vpWecoRulesAlarmToString(
const
vpWecoRulesAlarm &alarm);
94
95
#if ((__cplusplus >= 201703L) || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201703L)))
// Check if cxx17 or higher
96
VP_ATTRIBUTE_NO_DESTROY
static
inline
const
std::vector<bool>
CONST_ALL_WECO_ACTIVATED
= std::vector<bool>(
COUNT_WECO
-1,
true
);
97
#else
98
VP_ATTRIBUTE_NO_DESTROY
static
const
std::vector<bool>
CONST_ALL_WECO_ACTIVATED
;
99
#endif
100
static
const
unsigned
int
NB_DATA_SIGNAL
= 8;
101
102
protected
:
103
unsigned
int
m_nbDataInBuffer
;
104
float
m_signal_vec
[
NB_DATA_SIGNAL
];
105
bool
m_activateWECOrules
;
107
std::vector<bool>
m_activatedWECOrules
;
110
unsigned
int
m_idCurrentData
;
111
vpWecoRulesAlarm
m_alarm
;
112
float
m_oneSigmaNegLim
;
113
float
m_oneSigmaPosLim
;
114
float
m_twoSigmaNegLim
;
115
float
m_twoSigmaPosLim
;
116
120
virtual
void
computeLimits
() VP_OVERRIDE;
121
129
virtual
vpMeanDriftType
detectDownwardMeanDrift
() VP_OVERRIDE;
137
virtual
vpMeanDriftType
detectUpwardMeanDrift
() VP_OVERRIDE;
138
145
virtual
bool
updateStatistics
(const
float
&signal) VP_OVERRIDE;
146
152
virtual
void
updateTestSignals
(const
float
&signal) VP_OVERRIDE;
153
public:
163
vpStatisticalTestShewhart
(const
bool
&activateWECOrules = true, const std::vector<
bool
> &activatedRules =
CONST_ALL_WECO_ACTIVATED
, const
unsigned
int
&nbSamplesForStats = 30);
164
175
vpStatisticalTestShewhart
(const
bool
&activateWECOrules, const std::vector<
bool
> &activatedRules, const
float
&mean, const
float
&stdev);
176
182
vpWecoRulesAlarm
getAlarm
()
const
183
{
184
return
m_alarm
;
185
}
186
192
#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
193
inline
virtual
float
getSignal
() const override
194
#else
195
inline
virtual
float
getSignal
() const
196
#endif
197
{
198
return
m_signal_vec
[
m_idCurrentData
];
199
}
200
206
std::vector<float> getSignals()
const
;
207
217
void
init
(
const
bool
&activateWECOrules,
const
std::vector<bool> &activatedRules = CONST_ALL_WECO_ACTIVATED,
const
unsigned
int
&nbSamplesForStats = 30);
218
229
void
init
(
const
bool
&activateWECOrules,
const
std::vector<bool> &activatedRules,
const
float
&mean,
const
float
&stdev);
230
};
231
END_VISP_NAMESPACE
232
#endif
vpStatisticalTestAbstract::vpMeanDriftType
vpMeanDriftType
Enum that indicates if a drift of the mean occurred.
Definition
vpStatisticalTestAbstract.h:70
vpStatisticalTestAbstract::init
void init()
(Re)Initialize the algorithm.
Definition
vpStatisticalTestAbstract.cpp:157
vpStatisticalTestShewhart::vpStatisticalTestShewhart
vpStatisticalTestShewhart(const bool &activateWECOrules=true, const std::vector< bool > &activatedRules=CONST_ALL_WECO_ACTIVATED, const unsigned int &nbSamplesForStats=30)
Construct a new vpStatisticalTestShewhart object.
Definition
vpStatisticalTestShewhart.cpp:254
vpStatisticalTestShewhart::updateStatistics
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...
Definition
vpStatisticalTestShewhart.cpp:235
vpStatisticalTestShewhart::NB_DATA_SIGNAL
static const unsigned int NB_DATA_SIGNAL
Definition
vpStatisticalTestShewhart.h:100
vpStatisticalTestShewhart::detectUpwardMeanDrift
virtual vpMeanDriftType detectUpwardMeanDrift() VP_OVERRIDE
Detects if an upward mean drift occurred on the mean.
Definition
vpStatisticalTestShewhart.cpp:163
vpStatisticalTestShewhart::CONST_ALL_WECO_ACTIVATED
static VP_ATTRIBUTE_NO_DESTROY const std::vector< bool > CONST_ALL_WECO_ACTIVATED
Definition
vpStatisticalTestShewhart.h:96
vpStatisticalTestShewhart::detectDownwardMeanDrift
virtual vpMeanDriftType detectDownwardMeanDrift() VP_OVERRIDE
Detects if a downward mean drift occurred.
Definition
vpStatisticalTestShewhart.cpp:91
vpStatisticalTestShewhart::vpWecoRulesAlarm
vpWecoRulesAlarm
Definition
vpStatisticalTestShewhart.h:84
vpStatisticalTestShewhart::COUNT_WECO
@ COUNT_WECO
Definition
vpStatisticalTestShewhart.h:90
vpStatisticalTestShewhart::SAME_SIDE_WECO
@ SAME_SIDE_WECO
Definition
vpStatisticalTestShewhart.h:88
vpStatisticalTestShewhart::THREE_SIGMA_WECO
@ THREE_SIGMA_WECO
Definition
vpStatisticalTestShewhart.h:85
vpStatisticalTestShewhart::ONE_SIGMA_WECO
@ ONE_SIGMA_WECO
Definition
vpStatisticalTestShewhart.h:87
vpStatisticalTestShewhart::TWO_SIGMA_WECO
@ TWO_SIGMA_WECO
Definition
vpStatisticalTestShewhart.h:86
vpStatisticalTestShewhart::NONE_WECO
@ NONE_WECO
Definition
vpStatisticalTestShewhart.h:89
vpStatisticalTestShewhart::m_twoSigmaNegLim
float m_twoSigmaNegLim
Definition
vpStatisticalTestShewhart.h:114
vpStatisticalTestShewhart::getAlarm
vpWecoRulesAlarm getAlarm() const
Get the alarm raised by the last test due to the WECO's rules.
Definition
vpStatisticalTestShewhart.h:182
vpStatisticalTestShewhart::updateTestSignals
virtual void updateTestSignals(const float &signal) VP_OVERRIDE
Update the test signals.
Definition
vpStatisticalTestShewhart.cpp:245
vpStatisticalTestShewhart::m_activatedWECOrules
std::vector< bool > m_activatedWECOrules
Definition
vpStatisticalTestShewhart.h:107
vpStatisticalTestShewhart::m_oneSigmaPosLim
float m_oneSigmaPosLim
Definition
vpStatisticalTestShewhart.h:113
vpStatisticalTestShewhart::m_nbDataInBuffer
unsigned int m_nbDataInBuffer
Definition
vpStatisticalTestShewhart.h:103
vpStatisticalTestShewhart::getSignal
virtual float getSignal() const override
Get the last value of the signal.
Definition
vpStatisticalTestShewhart.h:193
vpStatisticalTestShewhart::m_idCurrentData
unsigned int m_idCurrentData
Definition
vpStatisticalTestShewhart.h:110
vpStatisticalTestShewhart::m_alarm
vpWecoRulesAlarm m_alarm
Definition
vpStatisticalTestShewhart.h:111
vpStatisticalTestShewhart::m_twoSigmaPosLim
float m_twoSigmaPosLim
Definition
vpStatisticalTestShewhart.h:115
vpStatisticalTestShewhart::m_signal_vec
float m_signal_vec[NB_DATA_SIGNAL]
Definition
vpStatisticalTestShewhart.h:104
vpStatisticalTestShewhart::m_oneSigmaNegLim
float m_oneSigmaNegLim
Definition
vpStatisticalTestShewhart.h:112
vpStatisticalTestShewhart::m_activateWECOrules
bool m_activateWECOrules
Definition
vpStatisticalTestShewhart.h:105
vpStatisticalTestSigma::vpStatisticalTestSigma
vpStatisticalTestSigma(const float &h=3.f, const unsigned int &nbSamplesForStats=30)
Construct a new vpStatisticalTestSigma object.
Definition
vpStatisticalTestSigma.cpp:83
vpStatisticalTestSigma::getSignal
virtual float getSignal() const
Get the last value of the signal.
Definition
vpStatisticalTestSigma.h:142
vpStatisticalTestSigma::computeLimits
virtual void computeLimits()
Compute the upper and lower limits of the test signal.
Definition
vpStatisticalTestSigma.cpp:42
BEGIN_VISP_NAMESPACE
Definition
vpMbtDistanceCircle.cpp:55
modules
core
include
visp3
core
vpStatisticalTestShewhart.h
Generated by
1.17.0