Noise.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2019 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 #ifndef SDF_NOISE_HH_
18 #define SDF_NOISE_HH_
19 
20 #include <sdf/Error.hh>
21 #include <sdf/Element.hh>
22 #include <sdf/sdf_config.h>
23 
24 namespace sdf
25 {
26  // Inline bracke to help doxygen filtering.
27  inline namespace SDF_VERSION_NAMESPACE {
28  // Forward declare private data class.
29  class NoisePrivate;
30 
33  enum class NoiseType
34  {
36  NONE = 0,
37 
40  GAUSSIAN = 1,
41 
44  };
45 
50  {
52  public: Noise();
53 
56  public: Noise(const Noise &_noise);
57 
60  public: Noise(Noise &&_noise) noexcept;
61 
63  public: ~Noise();
64 
68  public: Noise &operator=(const Noise &_noise);
69 
73  public: Noise &operator=(Noise &&_noise);
74 
78  public: bool operator==(const Noise &_noise) const;
79 
83  public: bool operator!=(const Noise &_noise) const;
84 
91  public: Errors Load(ElementPtr _sdf);
92 
95  public: NoiseType Type() const;
96 
99  public: void SetType(NoiseType _type);
100 
105  public: double Mean() const;
106 
111  public: void SetMean(double _mean);
112 
117  public: double StdDev() const;
118 
123  public: void SetStdDev(double _stddev);
124 
129  public: double BiasMean() const;
130 
135  public: void SetBiasMean(double _bias);
136 
141  public: double BiasStdDev() const;
142 
148  public: void SetBiasStdDev(double _bias);
149 
153  public: double Precision() const;
154 
158  public: void SetPrecision(double _precision);
159 
163  public: double DynamicBiasStdDev() const;
164 
168  public: void SetDynamicBiasStdDev(double _stddev);
169 
173  public: double DynamicBiasCorrelationTime() const;
174 
180  public: void SetDynamicBiasCorrelationTime(double _time);
181 
186  public: sdf::ElementPtr Element() const;
187 
189  private: NoisePrivate *dataPtr;
190  };
191  }
192 }
193 #endif
sdf::v9::Noise::SetMean
void SetMean(double _mean)
Set the mean of the Gaussian distribution from which noise values are drawn.
sdf::v9::Noise::Noise
Noise(const Noise &_noise)
Copy constructor.
sdf::v9::Noise::SetPrecision
void SetPrecision(double _precision)
For type "gaussian_quantized", set the precision of output signals.
sdf::v9::Noise::Mean
double Mean() const
Get the mean of the Gaussian distribution from which noise values are drawn.
Error.hh
sdf::v9::Noise::Element
sdf::ElementPtr Element() const
Get a pointer to the SDF element that was used during load.
sdf::v9::Noise::operator==
bool operator==(const Noise &_noise) const
Return true if both Noise objects contain the same values.
sdf::v9::Noise::~Noise
~Noise()
Destructor.
sdf::v9::Noise::SetBiasMean
void SetBiasMean(double _bias)
Set the mean of the Gaussian distribution from which bias values are drawn.
sdf
namespace for Simulation Description Format parser
Definition: Actor.hh:33
sdf::v9::Noise::operator=
Noise & operator=(Noise &&_noise)
Move assignment operator.
sdf::v9::Noise::SetDynamicBiasCorrelationTime
void SetDynamicBiasCorrelationTime(double _time)
For type "gaussian*", set the correlation time in seconds of the noise used to drive a process to mod...
sdf::v9::Noise::SetStdDev
void SetStdDev(double _stddev)
Set the standard deviation of the Gaussian distribution from which noise values are drawn.
sdf::v9::Noise::Noise
Noise(Noise &&_noise) noexcept
Move constructor.
sdf::v9::Noise::operator=
Noise & operator=(const Noise &_noise)
Assignment operator.
sdf::v9::Noise::SetBiasStdDev
void SetBiasStdDev(double _bias)
Set the standard deviation of the Gaussian distribution from which bias values are drawn.
sdf::v9::Noise::SetDynamicBiasStdDev
void SetDynamicBiasStdDev(double _stddev)
For type "gaussian*", set the standard deviation of the noise used to drive a process to model slow v...
sdf::v9::Noise::operator!=
bool operator!=(const Noise &_noise) const
Return true the Noise objects do not contain the same values.
sdf::v9::Errors
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:89
sdf::v9::Noise::BiasStdDev
double BiasStdDev() const
Get the standard deviation of the Gaussian distribution from which bias values are drawn.
SDFORMAT_VISIBLE
#define SDFORMAT_VISIBLE
Definition: system_util.hh:48
sdf::v9::NoiseType::GAUSSIAN
@ GAUSSIAN
Draw noise values independently for each measurement from a Gaussian distribution.
sdf::v9::Noise
The Noise class contains information about a noise model, such as a Gaussian distribution.
Definition: Noise.hh:50
sdf::v9::Noise::DynamicBiasCorrelationTime
double DynamicBiasCorrelationTime() const
For type "gaussian*", get the correlation time of the noise used to drive a process to model slow var...
sdf::v9::Noise::Type
NoiseType Type() const
Get the type of noise.
sdf::v9::Noise::DynamicBiasStdDev
double DynamicBiasStdDev() const
For type "gaussian*", get the standard deviation of the noise used to drive a process to model slow v...
sdf::v9::Noise::Load
Errors Load(ElementPtr _sdf)
Load the noise based on a element pointer.
sdf::v9::ElementPtr
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:53
sdf::v9::Noise::SetType
void SetType(NoiseType _type)
Set the type of noise.
sdf::v9::NoiseType
NoiseType
Definition: Noise.hh:34
sdf::v9::Noise::Precision
double Precision() const
For type "gaussian_quantized", get the precision of output signals.
sdf::v9::Noise::BiasMean
double BiasMean() const
Get the mean of the Gaussian distribution from which bias values are drawn.
sdf::v9::Noise::Noise
Noise()
Default constructor.
sdf::v9::Noise::StdDev
double StdDev() const
Get the standard deviation of the Gaussian distribution from which noise values are drawn.
Element.hh
sdf::v9::NoiseType::GAUSSIAN_QUANTIZED
@ GAUSSIAN_QUANTIZED
Gaussian noise plus quantization of outputs (ie. rounding).
sdf::v9::ErrorCode::NONE
@ NONE