Noise.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 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 _GAZEBO_NOISE_HH_
19 #define _GAZEBO_NOISE_HH_
20 
21 #include <vector>
22 #include <string>
23 
24 #include <boost/function.hpp>
25 #include <sdf/sdf.hh>
26 
29 #include "gazebo/util/system.hh"
30 
31 namespace gazebo
32 {
33  namespace sensors
34  {
37 
40  class GZ_SENSORS_VISIBLE NoiseFactory
41  {
49  public: static NoisePtr NewNoiseModel(sdf::ElementPtr _sdf,
50  const std::string &_sensorType = "");
51  };
52 
55  class GZ_SENSORS_VISIBLE Noise
56  {
58  public: enum NoiseType
59  {
62  GAUSSIAN
63  };
64 
70  public: explicit Noise(NoiseType _type);
71 
73  public: virtual ~Noise();
74 
78  public: virtual void Load(sdf::ElementPtr _sdf);
79 
83  public: double Apply(double _in);
84 
89  public: virtual double ApplyImpl(double _in);
90 
92  public: virtual void Fini();
93 
96  public: NoiseType GetNoiseType() const;
97 
102  public: virtual void SetCustomNoiseCallback(
103  boost::function<double (double)> _cb);
104 
109  public: virtual void SetCamera(rendering::CameraPtr _camera);
110 
113  public: virtual void Print(std::ostream &_out) const;
114 
116  private: NoiseType type;
117 
119  private: sdf::ElementPtr sdf;
120 
122  private: std::function<double (double)> customNoiseCallback;
123  };
125  }
126 }
127 #endif
std::shared_ptr< Noise > NoisePtr
Definition: SensorTypes.hh:124
Use this noise manager for creating and loading noise models.
Definition: Noise.hh:40
Definition: Noise.hh:61
Forward declarations and typedefs for sensors.
NoiseType
Which noise types we support.
Definition: Noise.hh:58
Definition: Noise.hh:60
boost::shared_ptr< Camera > CameraPtr
Definition: RenderTypes.hh:90
Noise models for sensor output signals.
Definition: Noise.hh:55