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 
43  GAUSSIAN_QUANTIZED = 2,
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
The Noise class contains information about a noise model, such as a Gaussian distribution.
Definition: Noise.hh:50
void SetPrecision(double _precision)
For type "gaussian_quantized", set the precision of output signals.
double BiasStdDev() const
Get the standard deviation of the Gaussian distribution from which bias values are drawn.
void SetDynamicBiasCorrelationTime(double _time)
For type "gaussian*", set the correlation time in seconds of the noise used to drive a process to mod...
double DynamicBiasStdDev() const
For type "gaussian*", get the standard deviation of the noise used to drive a process to model slow v...
sdf::ElementPtr Element() const
Get a pointer to the SDF element that was used during load.
Errors Load(ElementPtr _sdf)
Load the noise based on a element pointer.
bool operator!=(const Noise &_noise) const
Return true the Noise objects do not contain the same values.
~Noise()
Destructor.
void SetType(NoiseType _type)
Set the type of noise.
double DynamicBiasCorrelationTime() const
For type "gaussian*", get the correlation time of the noise used to drive a process to model slow var...
bool operator==(const Noise &_noise) const
Return true if both Noise objects contain the same values.
double StdDev() const
Get the standard deviation of the Gaussian distribution from which noise values are drawn.
Noise & operator=(Noise &&_noise)
Move assignment operator.
double Mean() const
Get the mean of the Gaussian distribution from which noise values are drawn.
Noise(const Noise &_noise)
Copy constructor.
void SetBiasMean(double _bias)
Set the mean of the Gaussian distribution from which bias values are drawn.
void SetBiasStdDev(double _bias)
Set the standard deviation of the Gaussian distribution from which bias values are drawn.
NoiseType Type() const
Get the type of noise.
double Precision() const
For type "gaussian_quantized", get the precision of output signals.
Noise()
Default constructor.
Noise(Noise &&_noise) noexcept
Move constructor.
Noise & operator=(const Noise &_noise)
Assignment operator.
double BiasMean() const
Get the mean of the Gaussian distribution from which bias values are drawn.
void SetStdDev(double _stddev)
Set the standard deviation of the Gaussian distribution from which noise values are drawn.
void SetDynamicBiasStdDev(double _stddev)
For type "gaussian*", set the standard deviation of the noise used to drive a process to model slow v...
void SetMean(double _mean)
Set the mean of the Gaussian distribution from which noise values are drawn.
NoiseType
The set of noise types.
Definition: Noise.hh:34
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:89
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:53
namespace for Simulation Description Format parser
Definition: Actor.hh:33
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system_util.hh:48