1 #ifndef _ASTRA_ROS_ROS_DEVICE_HPP_
2 #define _ASTRA_ROS_ROS_DEVICE_HPP_
6 #include <image_transport/image_transport.h>
7 #include <dynamic_reconfigure/server.h>
8 #include <tf2_ros/transform_broadcaster.h>
10 #include "astra_ros/DeviceConfig.h"
12 #include "astra_ros/BodyFrame.h"
14 #include "astra_ros/GetChipId.h"
15 #include "astra_ros/GetDepthRegistration.h"
16 #include "astra_ros/GetImageStreamMode.h"
17 #include "astra_ros/GetImageStreamModes.h"
18 #include "astra_ros/GetIrExposure.h"
19 #include "astra_ros/GetIrGain.h"
20 #include "astra_ros/GetMirrored.h"
21 #include "astra_ros/GetRunning.h"
22 #include "astra_ros/GetSerial.h"
23 #include "astra_ros/GetUsbInfo.h"
24 #include "astra_ros/SetDepthRegistration.h"
25 #include "astra_ros/SetImageStreamMode.h"
26 #include "astra_ros/SetIrExposure.h"
27 #include "astra_ros/SetIrGain.h"
28 #include "astra_ros/SetMirrored.h"
29 #include "astra_ros/SetRunning.h"
45 RosDevice(
const std::string &name, ros::NodeHandle &nh, ros::NodeHandle &pnh);
50 const std::string &
getName() const noexcept;
59 static
Device::Configuration getConfiguration(ros::NodeHandle &nh);
61 void onFrame(const
Device::Frame &frame);
62 void onDynamicReconfigure(DeviceConfig &config, uint32_t level);
64 bool onGetChipId(GetChipId::Request &req, GetChipId::Response &res);
65 bool onGetDepthRegistration(GetDepthRegistration::Request &req, GetDepthRegistration::Response &res);
66 bool onGetColorImageStreamMode(GetImageStreamMode::Request &req, GetImageStreamMode::Response &res);
67 bool onGetDepthImageStreamMode(GetImageStreamMode::Request &req, GetImageStreamMode::Response &res);
68 bool onGetIrImageStreamMode(GetImageStreamMode::Request &req, GetImageStreamMode::Response &res);
69 bool onGetColorImageStreamModes(GetImageStreamModes::Request &req, GetImageStreamModes::Response &res);
70 bool onGetDepthImageStreamModes(GetImageStreamModes::Request &req, GetImageStreamModes::Response &res);
71 bool onGetIrImageStreamModes(GetImageStreamModes::Request &req, GetImageStreamModes::Response &res);
72 bool onGetIrExposure(GetIrExposure::Request &req, GetIrExposure::Response &res);
73 bool onGetIrGain(GetIrGain::Request &req, GetIrGain::Response &res);
74 bool onGetColorMirrored(GetMirrored::Request &req, GetMirrored::Response &res);
75 bool onGetDepthMirrored(GetMirrored::Request &req, GetMirrored::Response &res);
76 bool onGetIrMirrored(GetMirrored::Request &req, GetMirrored::Response &res);
77 bool onGetColorRunning(GetRunning::Request &req, GetRunning::Response &res);
78 bool onGetDepthRunning(GetRunning::Request &req, GetRunning::Response &res);
79 bool onGetIrRunning(GetRunning::Request &req, GetRunning::Response &res);
80 bool onGetSerial(GetSerial::Request &req, GetSerial::Response &res);
81 bool onGetColorUsbInfo(GetUsbInfo::Request &req, GetUsbInfo::Response &res);
82 bool onGetDepthUsbInfo(GetUsbInfo::Request &req, GetUsbInfo::Response &res);
83 bool onGetIrUsbInfo(GetUsbInfo::Request &req, GetUsbInfo::Response &res);
84 bool onSetDepthRegistration(SetDepthRegistration::Request &req, SetDepthRegistration::Response &res);
85 bool onSetColorImageStreamMode(SetImageStreamMode::Request &req, SetImageStreamMode::Response &res);
86 bool onSetDepthImageStreamMode(SetImageStreamMode::Request &req, SetImageStreamMode::Response &res);
87 bool onSetIrImageStreamMode(SetImageStreamMode::Request &req, SetImageStreamMode::Response &res);
88 bool onSetIrExposure(SetIrExposure::Request &req, SetIrExposure::Response &res);
89 bool onSetIrGain(SetIrGain::Request &req, SetIrGain::Response &res);
90 bool onSetColorMirrored(SetMirrored::Request &req, SetMirrored::Response &res);
91 bool onSetDepthMirrored(SetMirrored::Request &req, SetMirrored::Response &res);
92 bool onSetIrMirrored(SetMirrored::Request &req, SetMirrored::Response &res);
93 bool onSetColorRunning(SetRunning::Request &req, SetRunning::Response &res);
94 bool onSetDepthRunning(SetRunning::Request &req, SetRunning::Response &res);
95 bool onSetIrRunning(SetRunning::Request &req, SetRunning::Response &res);
99 ros::NodeHandle device_nh_;
100 ros::NodeHandle &pnh_;
102 image_transport::ImageTransport image_transport_;
104 typedef dynamic_reconfigure::Server<DeviceConfig> DeviceConfigServer;
107 std::unique_ptr<boost::recursive_mutex> mut_;
108 std::unique_ptr<DeviceConfigServer> dynamic_reconfigure_server_;
110 std::unique_ptr<tf2_ros::TransformBroadcaster> tf_broadcaster_;
112 bool publish_body_markers;
113 bool publish_body_mask;
114 bool publish_floor_mask;
115 std::
string body_frame_id;
119 orbbec_camera_params camera_parameters_;
121 ros::Publisher color_camera_info_pub_;
122 ros::Publisher depth_camera_info_pub_;
124 image_transport::Publisher color_image_pub_;
125 image_transport::Publisher ir_image_pub_;
126 image_transport::Publisher depth_image_pub_;
127 image_transport::Publisher body_mask_image_pub_;
128 image_transport::Publisher floor_mask_image_pub_;
129 image_transport::Publisher colorized_body_image_pub_;
130 image_transport::Publisher masked_color_image_pub_;
132 ros::Publisher body_frame_pub_;
133 ros::Publisher body_markers_pub_;
134 ros::Publisher point_cloud_pub_;
137 ros::ServiceServer get_chip_id_svc_;
138 ros::ServiceServer get_depth_registration_svc_;
139 ros::ServiceServer get_color_image_stream_mode_svc_;
140 ros::ServiceServer get_depth_image_stream_mode_svc_;
141 ros::ServiceServer get_ir_image_stream_mode_svc_;
142 ros::ServiceServer get_color_image_stream_modes_svc_;
143 ros::ServiceServer get_depth_image_stream_modes_svc_;
144 ros::ServiceServer get_ir_image_stream_modes_svc_;
145 ros::ServiceServer get_ir_exposure_svc_;
146 ros::ServiceServer get_ir_gain_svc_;
147 ros::ServiceServer get_color_mirrored_svc_;
148 ros::ServiceServer get_depth_mirrored_svc_;
149 ros::ServiceServer get_ir_mirrored_svc_;
150 ros::ServiceServer get_color_running_svc_;
151 ros::ServiceServer get_depth_running_svc_;
152 ros::ServiceServer get_ir_running_svc_;
153 ros::ServiceServer get_serial_svc_;
154 ros::ServiceServer get_color_usb_info_svc_;
155 ros::ServiceServer get_depth_usb_info_svc_;
156 ros::ServiceServer get_ir_usb_info_svc_;
157 ros::ServiceServer set_depth_registration_svc_;
158 ros::ServiceServer set_color_image_stream_mode_svc_;
159 ros::ServiceServer set_depth_image_stream_mode_svc_;
160 ros::ServiceServer set_ir_image_stream_mode_svc_;
161 ros::ServiceServer set_ir_exposure_svc_;
162 ros::ServiceServer set_ir_gain_svc_;
163 ros::ServiceServer set_color_mirrored_svc_;
164 ros::ServiceServer set_depth_mirrored_svc_;
165 ros::ServiceServer set_ir_mirrored_svc_;
166 ros::ServiceServer set_color_running_svc_;
167 ros::ServiceServer set_depth_running_svc_;
168 ros::ServiceServer set_ir_running_svc_;
171 extern const std::
string DEVICE_NAMESPACE;