Visual Servoing Platform
version 3.7.0
Toggle main menu visibility
Loading...
Searching...
No Matches
vpTemporalWeighting.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
#ifndef VP_TEMPORAL_WEIGHTING_H
31
#define VP_TEMPORAL_WEIGHTING_H
32
33
#include <visp3/core/vpConfig.h>
34
#include <visp3/core/vpException.h>
35
36
#if defined(VISP_HAVE_NLOHMANN_JSON)
37
#include VISP_NLOHMANN_JSON(json_fwd.hpp)
38
#endif
39
40
BEGIN_VISP_NAMESPACE
41
class
VISP_EXPORT
vpTemporalWeighting
42
{
43
public
:
44
vpTemporalWeighting
() =
default
;
45
virtual
double
weight
(
const
double
progress)
const
= 0;
46
virtual
~vpTemporalWeighting
() =
default
;
47
#if defined(VISP_HAVE_NLOHMANN_JSON)
48
static
std::shared_ptr<vpTemporalWeighting>
parseTemporalWeighting
(
const
nlohmann::json &j);
49
static
std::shared_ptr<vpTemporalWeighting>
parseTemporalWeightingRawJson
(
const
std::string &j);
50
51
#endif
52
};
53
54
class
VISP_EXPORT
vpFixedTemporalWeighting
:
public
vpTemporalWeighting
55
{
56
public
:
57
vpFixedTemporalWeighting
(
double
weight
) : m_weight(
weight
) { }
58
59
double
weight(
const
double
/*progress*/
)
const
VP_OVERRIDE;
60
61
double
getWeight
()
const
{
return
m_weight; }
62
void
setWeight
(
double
weight
) { m_weight =
weight
; }
63
private
:
64
double
m_weight;
65
};
66
67
class
VISP_EXPORT
vpSigmoidTemporalWeighting
:
public
vpTemporalWeighting
68
{
69
public
:
70
vpSigmoidTemporalWeighting
(
double
minWeight,
double
maxWeight,
double
location,
double
power)
71
{
72
setLocation
(location);
73
setSlopePower
(power);
74
setMinimumWeight
(minWeight);
75
setMaximumWeight
(maxWeight);
76
77
if
(maxWeight < minWeight) {
78
throw
vpException
(
vpException::badValue
,
"Maximum weight should be equal or greater than the minimum weight"
);
79
}
80
}
81
82
double
getLocation
()
const
{
return
m_location; }
83
void
setLocation
(
double
location)
84
{
85
if
(location < 0 || location > 1) {
86
throw
vpException
(
vpException::badValue
,
"Location parameter needs to be between 0 and 1"
);
87
}
88
m_location = location;
89
}
90
91
double
weight(
const
double
progress)
const
VP_OVERRIDE;
92
93
double
getSlopePower
()
const
{
return
m_power; }
94
void
setSlopePower
(
double
power) { m_power = power; }
95
96
double
getMinimumWeight
()
const
{
return
m_minWeight; }
97
void
setMinimumWeight
(
double
w) { m_minWeight = w; }
98
99
double
getMaximumWeight
()
const
{
return
m_maxWeight; }
100
void
setMaximumWeight
(
double
w) { m_maxWeight = w; }
101
102
103
private
:
104
double
m_location;
105
double
m_power;
106
double
m_minWeight;
107
double
m_maxWeight;
108
109
};
110
111
END_VISP_NAMESPACE
112
113
#endif
vpException
error that can be emitted by ViSP classes.
Definition
vpException.h:60
vpException::badValue
@ badValue
Used to indicate that a value is not in the allowed range.
Definition
vpException.h:73
vpFixedTemporalWeighting::getWeight
double getWeight() const
Definition
vpTemporalWeighting.h:61
vpFixedTemporalWeighting::weight
double weight(const double) const VP_OVERRIDE
Definition
vpTemporalWeighting.cpp:73
vpFixedTemporalWeighting::setWeight
void setWeight(double weight)
Definition
vpTemporalWeighting.h:62
vpFixedTemporalWeighting::vpFixedTemporalWeighting
vpFixedTemporalWeighting(double weight)
Definition
vpTemporalWeighting.h:57
vpSigmoidTemporalWeighting::getSlopePower
double getSlopePower() const
Definition
vpTemporalWeighting.h:93
vpSigmoidTemporalWeighting::setSlopePower
void setSlopePower(double power)
Definition
vpTemporalWeighting.h:94
vpSigmoidTemporalWeighting::setMaximumWeight
void setMaximumWeight(double w)
Definition
vpTemporalWeighting.h:100
vpSigmoidTemporalWeighting::setLocation
void setLocation(double location)
Definition
vpTemporalWeighting.h:83
vpSigmoidTemporalWeighting::getMaximumWeight
double getMaximumWeight() const
Definition
vpTemporalWeighting.h:99
vpSigmoidTemporalWeighting::vpSigmoidTemporalWeighting
vpSigmoidTemporalWeighting(double minWeight, double maxWeight, double location, double power)
Definition
vpTemporalWeighting.h:70
vpSigmoidTemporalWeighting::getMinimumWeight
double getMinimumWeight() const
Definition
vpTemporalWeighting.h:96
vpSigmoidTemporalWeighting::setMinimumWeight
void setMinimumWeight(double w)
Definition
vpTemporalWeighting.h:97
vpSigmoidTemporalWeighting::getLocation
double getLocation() const
Definition
vpTemporalWeighting.h:82
vpTemporalWeighting::weight
virtual double weight(const double progress) const =0
vpTemporalWeighting::~vpTemporalWeighting
virtual ~vpTemporalWeighting()=default
vpTemporalWeighting::vpTemporalWeighting
vpTemporalWeighting()=default
vpTemporalWeighting::parseTemporalWeighting
static std::shared_ptr< vpTemporalWeighting > parseTemporalWeighting(const nlohmann::json &j)
Definition
vpTemporalWeighting.cpp:42
vpTemporalWeighting::parseTemporalWeightingRawJson
static std::shared_ptr< vpTemporalWeighting > parseTemporalWeightingRawJson(const std::string &j)
Definition
vpTemporalWeighting.cpp:65
BEGIN_VISP_NAMESPACE
Definition
vpMbtDistanceCircle.cpp:55
modules
tracker
rbt
include
visp3
rbt
vpTemporalWeighting.h
Generated by
1.17.0