depth_noise_model.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2018 Michael Pantic, ASL, ETH Zurich, Switzerland
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 #ifndef ROTORS_GAZEBO_PLUGINS_DEPTH_NOISE_MODEL_H
17 #define ROTORS_GAZEBO_PLUGINS_DEPTH_NOISE_MODEL_H
18 
19 #include <Eigen/Eigen>
20 #include <random>
21 
23  public:
25  : max_depth(1000.0f), min_depth(0.2f), gen(std::random_device{}()) {}
26 
27  virtual void ApplyNoise(uint32_t width, uint32_t height, float *data) = 0;
28 
29  float max_depth; // [m]
30  float min_depth; // [m] Values smaller/larger than these two are replaced
31  // by NaN
32 
33  protected:
34  bool InRange(float depth) const;
35 
36  const float bad_point = std::numeric_limits<float>::quiet_NaN();
37  std::normal_distribution<float> dist;
38  std::mt19937 gen;
39 };
40 
42  public:
44 
45  void ApplyNoise(uint32_t width, uint32_t height, float *data);
46 };
47 
49  public:
51 
52  void ApplyNoise(uint32_t width, uint32_t height, float *data);
53 };
54 
55 
57  public:
59  : h_fov(M_PI_2), // Default 90deg for D435
60  baseline(0.05f), // Default 50 mm for D435
61  subpixel_err(0.1f), // Default subpixel calibration error
62  max_stdev(3.0f),
63  DepthNoiseModel() {}
64 
65  void ApplyNoise(uint32_t width, uint32_t height, float *data);
66 
67  // public params...
68  float h_fov; // [rad]
69  float baseline; // [m]
70  float subpixel_err; // [pixel] Calibration error
71  float max_stdev; // [m] cutoff for distance standard deviation:
72  // If modeled standard deviation becomes bigger, it is replaced with this
73  // value.
74 };
75 
76 #endif // ROTORS_GAZEBO_PLUGINS_DEPTH_NOISE_MODEL_H
uint8_t data[MAX_SIZE]
bool InRange(float depth) const
std::normal_distribution< float > dist
virtual void ApplyNoise(uint32_t width, uint32_t height, float *data)=0


rotors_gazebo_plugins
Author(s): Fadri Furrer, Michael Burri, Mina Kamel, Janosch Nikolic, Markus Achtelik
autogenerated on Mon Feb 28 2022 23:39:03