Go to the documentation of this file.
23 #ifndef GAZEBO_ROS_DEPTH_CAMERA_HH
24 #define GAZEBO_ROS_DEPTH_CAMERA_HH
32 #include <sensor_msgs/PointCloud2.h>
33 #include <sensor_msgs/Image.h>
34 #include <sensor_msgs/CameraInfo.h>
36 #include <std_msgs/Float64.h>
38 #include <visualization_msgs/MarkerArray.h>
39 #include <visualization_msgs/Marker.h>
42 #include <sdf/Param.hh>
43 #include <gazebo/physics/physics.hh>
44 #include <gazebo/transport/TransportTypes.hh>
45 #include <gazebo/msgs/MessageTypes.hh>
46 #include <gazebo/common/Time.hh>
47 #include <gazebo/sensors/SensorTypes.hh>
48 #include <gazebo/plugins/DepthCameraPlugin.hh>
51 #include <gazebo_plugins/GazeboRosCameraConfig.h>
52 #include <dynamic_reconfigure/server.h>
55 #include <boost/thread/mutex.hpp>
73 public:
virtual void Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf)
override;
80 unsigned int _width,
unsigned int _height,
81 unsigned int _depth,
const std::string &_format)
override;
85 unsigned int _width,
unsigned int _height,
86 unsigned int _depth,
const std::string &_format)
override;
90 unsigned int _width,
unsigned int _height,
91 unsigned int _depth,
const std::string &_format)
override;
93 #if GAZEBO_MAJOR_VERSION == 9 && GAZEBO_MINOR_VERSION > 12
94 protected:
virtual void OnNewReflectanceFrame(
const float * _reflectance,
96 unsigned int _width,
unsigned int _height,
97 unsigned int _depth,
const std::string &_format)
override;
100 protected:
virtual void OnNewNormalsFrame(
const float * _normals,
101 unsigned int _width,
unsigned int _height,
102 unsigned int _depth,
const std::string &_format)
override;
137 uint32_t rows_arg, uint32_t cols_arg,
138 uint32_t step_arg,
void* data_arg);
141 uint32_t rows_arg, uint32_t cols_arg,
142 uint32_t step_arg,
void* data_arg);
156 private:
float *
pcd_ =
nullptr;
ros::Publisher reflectance_pub_
std::string depth_image_camera_info_topic_name_
std::string point_cloud_topic_name_
ROS image topic name.
ros::Publisher depth_image_pub_
bool use_depth_image_16UC1_format_
virtual void OnNewImageFrame(const unsigned char *_image, unsigned int _width, unsigned int _height, unsigned int _depth, const std::string &_format) override
Update the controller.
bool FillDepthImageHelper(sensor_msgs::Image &image_msg, uint32_t rows_arg, uint32_t cols_arg, uint32_t step_arg, void *data_arg)
~GazeboRosDepthCamera()
Destructor.
std::string normals_topic_name_
ROS normals topic name.
void PointCloudDisconnect()
virtual void Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf) override
Load the plugin.
virtual void OnNewDepthFrame(const float *_image, unsigned int _width, unsigned int _height, unsigned int _depth, const std::string &_format) override
Update the controller.
virtual void Advertise()
Advertise point cloud, depth image, normals and reflectance.
void FillDepthImage(const float *_src)
push depth image data into ros topic
ros::Publisher depth_image_camera_info_pub_
sensor_msgs::Image depth_image_msg_
std::string depth_image_topic_name_
image where each pixel contains the depth information
void DepthInfoDisconnect()
std::string reflectance_topic_name_
ROS reflectance topic name.
void ReflectanceDisconnect()
Decrease the counter which count the subscribers are connected.
common::Time last_depth_image_camera_info_update_time_
GazeboRosDepthCamera()
Constructor.
bool FillPointCloudHelper(sensor_msgs::PointCloud2 &point_cloud_msg, uint32_t rows_arg, uint32_t cols_arg, uint32_t step_arg, void *data_arg)
void ReflectanceConnect()
Increase the counter which count the subscribers are connected.
void NormalsConnect()
Increase the counter which count the subscribers are connected.
double point_cloud_cutoff_
int point_cloud_connect_count_
Keep track of number of connctions for point clouds.
virtual void PublishCameraInfo()
sensor_msgs::Image reflectance_msg_
void FillPointdCloud(const float *_src)
Put camera data to the ROS topic.
int reduce_normals_
adding one value each reduce_normals_ to the array marker
int depth_image_connect_count_
Keep track of number of connctions for point clouds.
int reflectance_connect_count_
Keep track of number of connections for reflectance.
float * pcd_
copy of the pointcloud data, used to place normals in the world
event::ConnectionPtr load_connection_
ros::Publisher normal_pub_
int depth_info_connect_count_
void DepthImageDisconnect()
common::Time depth_sensor_update_time_
virtual void OnNewRGBPointCloud(const float *_pcd, unsigned int _width, unsigned int _height, unsigned int _depth, const std::string &_format) override
Update the controller.
void NormalsDisconnect()
Decrease the counter which count the subscribers are connected.
ros::Publisher point_cloud_pub_
A pointer to the ROS node. A node will be instantiated if it does not exist.
int normals_connect_count_
Keep track of number of connections for normals.
sensor_msgs::PointCloud2 point_cloud_msg_
PointCloud2 point cloud message.
gazebo_plugins
Author(s): John Hsu
autogenerated on Thu Sep 5 2024 02:49:55