Ignition Sensors

API Reference

5.0.0
Noise.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 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 
18 #ifndef IGNITION_SENSORS_NOISE_HH_
19 #define IGNITION_SENSORS_NOISE_HH_
20 
21 #include <functional>
22 #include <string>
23 #include <vector>
24 
25 #include <ignition/sensors/config.hh>
27 #include <ignition/sensors/Export.hh>
28 
29 #include <sdf/sdf.hh>
30 
31 namespace ignition
32 {
33  namespace sensors
34  {
35  // Inline bracket to help doxygen filtering.
36  inline namespace IGNITION_SENSORS_VERSION_NAMESPACE {
37  // Forward declarations
38  class NoisePrivate;
39 
42  class IGNITION_SENSORS_VISIBLE NoiseFactory
43  {
51  public: static NoisePtr NewNoiseModel(sdf::ElementPtr _sdf,
52  const std::string &_sensorType = "");
53 
61  public: static NoisePtr NewNoiseModel(const sdf::Noise &_sdf,
62  const std::string &_sensorType = "");
63  };
64 
66  enum class IGNITION_SENSORS_VISIBLE NoiseType : int
67  {
68  NONE = 0,
69  CUSTOM = 1,
70  GAUSSIAN = 2
71  };
72 
75  class IGNITION_SENSORS_VISIBLE Noise
76  {
82  public: explicit Noise(NoiseType _type);
83 
85  public: virtual ~Noise();
86 
89  public: virtual void Load(const sdf::Noise &_sdf);
90 
95  public: double Apply(double _in, double _dt = 0.0);
96 
102  public: virtual double ApplyImpl(double _in, double _dt);
103 
106  public: NoiseType Type() const;
107 
112  public: virtual void SetCustomNoiseCallback(
113  std::function<double(double, double)> _cb);
114 
117  public: virtual void Print(std::ostream &_out) const;
118 
120  private: NoisePrivate *dataPtr = nullptr;
121  };
122  }
123  }
124 }
125 #endif
Noise models for sensor output signals.
Definition: Noise.hh:75
NoiseType
Which noise types we support.
Definition: Noise.hh:66
Use this noise manager for creating and loading noise models.
Definition: Noise.hh:42
STL class.
Forward declarations and typedefs for sensors.
Definition: AirPressureSensor.hh:32
STL class.