gazebo_noisydepth_plugin.h
Go to the documentation of this file.
1 /*
2  * Copyright 2018 Michael Pantic, ASL, ETH Zurich, Switzerland
3  *
4  * Forked from Openni/Kinect Depth Plugin, retaining original copyright header:
5  *
6  * Copyright (C) 2012-2014 Open Source Robotics Foundation
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20 */
21 /*
22  * Desc: A dynamic controller plugin that publishes ROS image_raw camera_info
23  * topic for generic camera sensor.
24  * Author: John Hsu
25  * Date: 24 Sept 2008
26  */
27 
28 #ifndef ROTORS_GAZEBO_PLUGINS_GAZEBO_NOISYDEPTH_PLUGIN_H
29 #define ROTORS_GAZEBO_PLUGINS_GAZEBO_NOISYDEPTH_PLUGIN_H
30 
31 #include <dynamic_reconfigure/server.h>
32 #include <boost/thread/mutex.hpp>
33 
34 #include <gazebo_plugins/GazeboRosOpenniKinectConfig.h>
36 #include <gazebo/common/Time.hh>
37 #include <gazebo/msgs/MessageTypes.hh>
38 #include <gazebo/physics/physics.hh>
39 #include <gazebo/plugins/DepthCameraPlugin.hh>
40 #include <gazebo/sensors/SensorTypes.hh>
41 #include <gazebo/transport/TransportTypes.hh>
42 
44 #include <ros/advertise_options.h>
45 #include <ros/callback_queue.h>
46 #include <ros/ros.h>
47 
48 #include <sdf/Param.hh>
49 
50 #include <sensor_msgs/CameraInfo.h>
51 #include <sensor_msgs/Image.h>
52 #include <sensor_msgs/PointCloud2.h>
53 #include <sensor_msgs/fill_image.h>
54 #include <std_msgs/Float64.h>
55 
57 
58 namespace gazebo {
59 class GazeboNoisyDepth : public DepthCameraPlugin, GazeboRosCameraUtils {
60  public:
62 
64 
67  virtual void Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf);
68 
70  virtual void Advertise();
71 
72  virtual void OnNewDepthFrame(const float *_image, unsigned int _width,
73  unsigned int _height, unsigned int _depth,
74  const std::string &_format);
75 
76  protected:
77  virtual void OnNewImageFrame(const unsigned char *_image, unsigned int _width,
78  unsigned int _height, unsigned int _depth,
79  const std::string &_format);
80 
81  private:
82  void DepthImageConnect();
83  void DepthImageDisconnect();
84  void DepthInfoConnect();
85  void DepthInfoDisconnect();
86  void FillDepthImage(const float *_src);
87  bool FillDepthImageHelper(const uint32_t rows_arg,
88  const uint32_t cols_arg,
89  const uint32_t step_arg,
90  const float *data_arg,
91  sensor_msgs::Image *image_msg);
92 
93  virtual void PublishCameraInfo();
94 
95  event::ConnectionPtr load_connection_;
96  std::unique_ptr<DepthNoiseModel> noise_model;
97 
100 
103 
106 
109  sensor_msgs::Image depth_image_msg_;
110 };
111 }
112 #endif // ROTORS_GAZEBO_PLUGINS_GAZEBO_NOISYDEPTH_PLUGIN_H
virtual void OnNewImageFrame(const unsigned char *_image, unsigned int _width, unsigned int _height, unsigned int _depth, const std::string &_format)
virtual void Advertise()
Advertise depth image.
event::ConnectionPtr load_connection_
virtual void Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf)
Load the plugin.
void FillDepthImage(const float *_src)
common::Time last_depth_image_camera_info_update_time_
std::unique_ptr< DepthNoiseModel > noise_model
bool FillDepthImageHelper(const uint32_t rows_arg, const uint32_t cols_arg, const uint32_t step_arg, const float *data_arg, sensor_msgs::Image *image_msg)
virtual void OnNewDepthFrame(const float *_image, unsigned int _width, unsigned int _height, unsigned int _depth, const std::string &_format)


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