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 <gz/utils/ImplPtr.hh>
21 #include <sdf/Error.hh>
22 #include <sdf/Element.hh>
23 #include <sdf/sdf_config.h>
24 
25 namespace sdf
26 {
27  // Inline bracke to help doxygen filtering.
28  inline namespace SDF_VERSION_NAMESPACE {
31  enum class NoiseType
32  {
34  NONE = 0,
35 
38  GAUSSIAN = 1,
39 
42  };
43 
48  {
50  public: Noise();
51 
55  public: bool operator==(const Noise &_noise) const;
56 
60  public: bool operator!=(const Noise &_noise) const;
61 
68  public: Errors Load(ElementPtr _sdf);
69 
72  public: NoiseType Type() const;
73 
76  public: void SetType(NoiseType _type);
77 
82  public: double Mean() const;
83 
88  public: void SetMean(double _mean);
89 
94  public: double StdDev() const;
95 
100  public: void SetStdDev(double _stddev);
101 
106  public: double BiasMean() const;
107 
112  public: void SetBiasMean(double _bias);
113 
118  public: double BiasStdDev() const;
119 
125  public: void SetBiasStdDev(double _bias);
126 
130  public: double Precision() const;
131 
135  public: void SetPrecision(double _precision);
136 
140  public: double DynamicBiasStdDev() const;
141 
145  public: void SetDynamicBiasStdDev(double _stddev);
146 
150  public: double DynamicBiasCorrelationTime() const;
151 
157  public: void SetDynamicBiasCorrelationTime(double _time);
158 
163  public: sdf::ElementPtr Element() const;
164 
170  public: sdf::ElementPtr ToElement() const;
171 
178  public: sdf::ElementPtr ToElement(sdf::Errors &_errors) const;
179 
181  GZ_UTILS_IMPL_PTR(dataPtr)
182  };
183  }
184 }
185 #endif
The Noise class contains information about a noise model, such as a Gaussian distribution.
Definition: Noise.hh:48
void SetMean(double _mean)
Set the mean of the Gaussian distribution from which noise values are drawn.
double Mean() const
Get the mean of the Gaussian distribution from which noise values are drawn.
double BiasStdDev() const
Get the standard deviation of the Gaussian distribution from which bias values are drawn.
Noise()
Default constructor.
void SetDynamicBiasCorrelationTime(double _time)
For type "gaussian*", set the correlation time in seconds of the noise used to drive a process to mod...
sdf::ElementPtr ToElement(sdf::Errors &_errors) const
Create and return an SDF element filled with data from this noise.
void SetDynamicBiasStdDev(double _stddev)
For type "gaussian*", set the standard deviation of the noise used to drive a process to model slow v...
Errors Load(ElementPtr _sdf)
Load the noise based on a element pointer.
sdf::ElementPtr Element() const
Get a pointer to the SDF element that was used during load.
bool operator!=(const Noise &_noise) const
Return true the Noise objects do not contain the same values.
double DynamicBiasStdDev() const
For type "gaussian*", get the standard deviation of the noise used to drive a process to model slow v...
NoiseType Type() const
Get the type of noise.
void SetStdDev(double _stddev)
Set the standard deviation of the Gaussian distribution from which noise values are drawn.
double DynamicBiasCorrelationTime() const
For type "gaussian*", get the correlation time of the noise used to drive a process to model slow var...
void SetPrecision(double _precision)
For type "gaussian_quantized", set the precision of output signals.
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.
sdf::ElementPtr ToElement() const
Create and return an SDF element filled with data from this noise.
void SetBiasStdDev(double _bias)
Set the standard deviation of the Gaussian distribution from which bias values are drawn.
void SetType(NoiseType _type)
Set the type of noise.
double Precision() const
For type "gaussian_quantized", get the precision of output signals.
double BiasMean() const
Get the mean of the Gaussian distribution from which bias values are drawn.
void SetBiasMean(double _bias)
Set the mean of the Gaussian distribution from which bias values are drawn.
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:95
NoiseType
The set of noise types.
Definition: Noise.hh:32
@ GAUSSIAN
Draw noise values independently for each measurement from a Gaussian distribution.
@ GAUSSIAN_QUANTIZED
Gaussian noise plus quantization of outputs (ie. rounding).
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:55
namespace for Simulation Description Format parser
Definition: Actor.hh:35
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system_util.hh:25