gazebo_ros_openni_kinect.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2014 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  * Desc: A dynamic controller plugin that publishes ROS image_raw camera_info topic for generic camera sensor.
19  * Author: John Hsu
20  * Date: 24 Sept 2008
21  */
22 
23 #ifndef GAZEBO_ROS_OPENNI_KINECT_HH
24 #define GAZEBO_ROS_OPENNI_KINECT_HH
25 
26 // ros stuff
27 #include <ros/ros.h>
28 #include <ros/callback_queue.h>
29 #include <ros/advertise_options.h>
30 
31 // ros messages stuff
32 #include <sensor_msgs/PointCloud2.h>
33 #include <sensor_msgs/Image.h>
34 #include <sensor_msgs/CameraInfo.h>
35 #include <sensor_msgs/fill_image.h>
36 #include <std_msgs/Float64.h>
38 
39 // gazebo stuff
40 #include <sdf/Param.hh>
41 #include <gazebo/physics/physics.hh>
42 #include <gazebo/transport/TransportTypes.hh>
43 #include <gazebo/msgs/MessageTypes.hh>
44 #include <gazebo/common/Time.hh>
45 #include <gazebo/sensors/SensorTypes.hh>
46 #include <gazebo/plugins/DepthCameraPlugin.hh>
47 
48 // dynamic reconfigure stuff
49 #include <gazebo_plugins/GazeboRosOpenniKinectConfig.h>
50 #include <dynamic_reconfigure/server.h>
51 
52 // boost stuff
53 #include <boost/thread/mutex.hpp>
54 
55 // camera stuff
57 
58 namespace gazebo
59 {
60  class GazeboRosOpenniKinect : public DepthCameraPlugin, GazeboRosCameraUtils
61  {
64  public: GazeboRosOpenniKinect();
65 
67  public: ~GazeboRosOpenniKinect();
68 
71  public: virtual void Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf);
72 
74  public: virtual void Advertise();
75 
77  protected: virtual void OnNewDepthFrame(const float *_image,
78  unsigned int _width, unsigned int _height,
79  unsigned int _depth, const std::string &_format);
80 
82  protected: virtual void OnNewImageFrame(const unsigned char *_image,
83  unsigned int _width, unsigned int _height,
84  unsigned int _depth, const std::string &_format);
85 
87  private: void FillPointdCloud(const float *_src);
88 
90  private: void FillDepthImage(const float *_src);
91 
94  private: void PointCloudConnect();
95  private: void PointCloudDisconnect();
96 
99  private: void DepthImageConnect();
100  private: void DepthImageDisconnect();
101 
102  private: bool FillPointCloudHelper(sensor_msgs::PointCloud2 &point_cloud_msg,
103  uint32_t rows_arg, uint32_t cols_arg,
104  uint32_t step_arg, void* data_arg);
105 
106  private: bool FillDepthImageHelper( sensor_msgs::Image& image_msg,
107  uint32_t height, uint32_t width,
108  uint32_t step, void* data_arg);
109 
113 
115  private: sensor_msgs::PointCloud2 point_cloud_msg_;
116  private: sensor_msgs::Image depth_image_msg_;
117 
119  private: double point_cloud_cutoff_;
121  private: double point_cloud_cutoff_max_;
122 
124  private: std::string point_cloud_topic_name_;
125 
126 
128  private: std::string depth_image_topic_name_;
129  private: common::Time depth_sensor_update_time_;
130 
131  // overload with our own
134  private: void DepthInfoConnect();
135  private: void DepthInfoDisconnect();
139 
141  protected: virtual void PublishCameraInfo();
142 
143  private: event::ConnectionPtr load_connection_;
144  };
145 
146 }
147 #endif
148 
gazebo::GazeboRosOpenniKinect::depth_info_connect_count_
int depth_info_connect_count_
Definition: gazebo_ros_openni_kinect.h:133
fill_image.h
gazebo::GazeboRosOpenniKinect::DepthInfoDisconnect
void DepthInfoDisconnect()
Definition: gazebo_ros_openni_kinect.cpp:187
gazebo::GazeboRosOpenniKinect::point_cloud_topic_name_
std::string point_cloud_topic_name_
ROS image topic name.
Definition: gazebo_ros_openni_kinect.h:124
ros::Publisher
gazebo::GazeboRosOpenniKinect::point_cloud_cutoff_max_
double point_cloud_cutoff_max_
Maximum range of the point cloud.
Definition: gazebo_ros_openni_kinect.h:121
gazebo::GazeboRosOpenniKinect::point_cloud_pub_
ros::Publisher point_cloud_pub_
A pointer to the ROS node. A node will be instantiated if it does not exist.
Definition: gazebo_ros_openni_kinect.h:111
gazebo
gazebo::GazeboRosOpenniKinect::DepthImageDisconnect
void DepthImageDisconnect()
Definition: gazebo_ros_openni_kinect.cpp:174
gazebo::GazeboRosOpenniKinect::point_cloud_cutoff_
double point_cloud_cutoff_
Minimum range of the point cloud.
Definition: gazebo_ros_openni_kinect.h:119
ros.h
gazebo::GazeboRosOpenniKinect::PointCloudDisconnect
void PointCloudDisconnect()
Definition: gazebo_ros_openni_kinect.cpp:157
gazebo::GazeboRosOpenniKinect::last_depth_image_camera_info_update_time_
common::Time last_depth_image_camera_info_update_time_
Definition: gazebo_ros_openni_kinect.h:136
gazebo::GazeboRosOpenniKinect::FillPointCloudHelper
bool FillPointCloudHelper(sensor_msgs::PointCloud2 &point_cloud_msg, uint32_t rows_arg, uint32_t cols_arg, uint32_t step_arg, void *data_arg)
Definition: gazebo_ros_openni_kinect.cpp:324
gazebo::GazeboRosOpenniKinect::DepthInfoConnect
void DepthInfoConnect()
Definition: gazebo_ros_openni_kinect.cpp:181
gazebo::GazeboRosCameraUtils
Definition: gazebo_ros_camera_utils.h:56
gazebo::GazeboRosCameraUtils::PublishCameraInfo
void PublishCameraInfo()
Definition: gazebo_ros_camera_utils.cpp:674
gazebo::GazeboRosOpenniKinect::PointCloudConnect
void PointCloudConnect()
Definition: gazebo_ros_openni_kinect.cpp:149
gazebo::GazeboRosOpenniKinect::depth_image_camera_info_pub_
ros::Publisher depth_image_camera_info_pub_
Definition: gazebo_ros_openni_kinect.h:138
gazebo_ros_camera_utils.h
gazebo::GazeboRosOpenniKinect::Advertise
virtual void Advertise()
Advertise point cloud and depth image.
Definition: gazebo_ros_openni_kinect.cpp:120
gazebo::GazeboRosOpenniKinect::depth_image_msg_
sensor_msgs::Image depth_image_msg_
Definition: gazebo_ros_openni_kinect.h:116
gazebo::GazeboRosOpenniKinect::point_cloud_connect_count_
int point_cloud_connect_count_
Keep track of number of connctions for point clouds.
Definition: gazebo_ros_openni_kinect.h:93
gazebo::GazeboRosOpenniKinect::depth_sensor_update_time_
common::Time depth_sensor_update_time_
Definition: gazebo_ros_openni_kinect.h:129
gazebo::GazeboRosOpenniKinect::load_connection_
event::ConnectionPtr load_connection_
Definition: gazebo_ros_openni_kinect.h:143
gazebo::GazeboRosOpenniKinect::FillPointdCloud
void FillPointdCloud(const float *_src)
push point cloud data into ros topic
Definition: gazebo_ros_openni_kinect.cpp:277
gazebo::GazeboRosOpenniKinect::FillDepthImage
void FillDepthImage(const float *_src)
push depth image data into ros topic
Definition: gazebo_ros_openni_kinect.cpp:302
image_transport.h
callback_queue.h
gazebo::GazeboRosOpenniKinect::~GazeboRosOpenniKinect
~GazeboRosOpenniKinect()
Destructor.
Definition: gazebo_ros_openni_kinect.cpp:60
gazebo::GazeboRosOpenniKinect::FillDepthImageHelper
bool FillDepthImageHelper(sensor_msgs::Image &image_msg, uint32_t height, uint32_t width, uint32_t step, void *data_arg)
Definition: gazebo_ros_openni_kinect.cpp:413
gazebo::GazeboRosOpenniKinect::Load
virtual void Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf)
Load the plugin.
Definition: gazebo_ros_openni_kinect.cpp:66
advertise_options.h
gazebo::GazeboRosOpenniKinect::use_depth_image_16UC1_format_
bool use_depth_image_16UC1_format_
Definition: gazebo_ros_openni_kinect.h:137
gazebo::GazeboRosOpenniKinect::depth_image_connect_count_
int depth_image_connect_count_
Keep track of number of connctions for point clouds.
Definition: gazebo_ros_openni_kinect.h:98
gazebo::GazeboRosOpenniKinect::depth_image_camera_info_topic_name_
std::string depth_image_camera_info_topic_name_
Definition: gazebo_ros_openni_kinect.h:132
gazebo::GazeboRosOpenniKinect
Definition: gazebo_ros_openni_kinect.h:60
gazebo::GazeboRosOpenniKinect::depth_image_topic_name_
std::string depth_image_topic_name_
image where each pixel contains the depth data
Definition: gazebo_ros_openni_kinect.h:128
gazebo::GazeboRosOpenniKinect::OnNewImageFrame
virtual void OnNewImageFrame(const unsigned char *_image, unsigned int _width, unsigned int _height, unsigned int _depth, const std::string &_format)
Update the controller.
Definition: gazebo_ros_openni_kinect.cpp:243
gazebo::GazeboRosOpenniKinect::PublishCameraInfo
virtual void PublishCameraInfo()
Definition: gazebo_ros_openni_kinect.cpp:474
gazebo::GazeboRosOpenniKinect::point_cloud_msg_
sensor_msgs::PointCloud2 point_cloud_msg_
PointCloud2 point cloud message.
Definition: gazebo_ros_openni_kinect.h:115
gazebo::GazeboRosOpenniKinect::GazeboRosOpenniKinect
GazeboRosOpenniKinect()
Constructor.
Definition: gazebo_ros_openni_kinect.cpp:50
gazebo::GazeboRosOpenniKinect::DepthImageConnect
void DepthImageConnect()
Definition: gazebo_ros_openni_kinect.cpp:167
gazebo::GazeboRosOpenniKinect::OnNewDepthFrame
virtual void OnNewDepthFrame(const float *_image, unsigned int _width, unsigned int _height, unsigned int _depth, const std::string &_format)
Update the controller.
Definition: gazebo_ros_openni_kinect.cpp:194
gazebo::GazeboRosOpenniKinect::depth_image_pub_
ros::Publisher depth_image_pub_
Definition: gazebo_ros_openni_kinect.h:112


gazebo_plugins
Author(s): John Hsu
autogenerated on Thu Sep 5 2024 02:49:55