10 #include "ImiDefines.h" 11 #include "ImiProperties.h" 12 #include <boost/thread/thread.hpp> 32 clock_gettime (CLOCK_MONOTONIC, &ts);
33 ticks = NUM_NANNOSECS_PER_SEC *
static_cast<uint64_t
> (ts.tv_sec) +
34 static_cast<uint64_t> (ts.tv_nsec);
50 {IMI_PIXEL_FORMAT_DEP_16BIT, 320, 240, 16, 30}};
53 {CAMERA_PIXEL_FORMAT_RGB888, 960, 720, 30},
54 {CAMERA_PIXEL_FORMAT_RGB888, 1280, 720, 30},
55 {CAMERA_PIXEL_FORMAT_RGB888, 1920, 1080, 30}};
60 color_subscribers_(false),
61 depth_subscribers_(false),
62 cloud_subscribers_(false),
63 uvc_subscribers_(false),
72 ROS_DEBUG(
"Waiting for dynamic reconfigure configuration.");
73 boost::this_thread::sleep(boost::posix_time::milliseconds(100));
96 printf(
"************ %d %d\n", config.depth_mode, config.color_mode);
113 ImiFrameMode frameMode;
114 frameMode.pixelFormat = supportFrameMode[
depthMode].pixelFormat;
115 frameMode.resolutionX = supportFrameMode[
depthMode].resolutionX;
116 frameMode.resolutionY = supportFrameMode[
depthMode].resolutionY;
117 frameMode.bitsPerPixel = supportFrameMode[
depthMode].bitsPerPixel;
118 frameMode.framerate = supportFrameMode[
depthMode].framerate;
125 ImiFrameMode frameMode;
126 frameMode.pixelFormat = IMI_PIXEL_FORMAT_IMAGE_RGB24;
127 frameMode.resolutionX = 640;
128 frameMode.resolutionY = 480;
129 frameMode.bitsPerPixel = 16;
130 frameMode.framerate = 30;
136 ImiCameraFrameMode frameMode;
137 frameMode.pixelFormat = supportCameraFrameMode[
colorMode].pixelFormat;
138 frameMode.resolutionX = supportCameraFrameMode[
colorMode].resolutionX;
139 frameMode.resolutionY = supportCameraFrameMode[
colorMode].resolutionY;
140 frameMode.fps = supportCameraFrameMode[
colorMode].fps;
152 clock_gettime(CLOCK_REALTIME, &timenow);
160 info->header.stamp = image->header.stamp;
163 info->header.frame_id = image->header.frame_id;
174 if(uvcStartTime == 0)
182 clock_gettime(CLOCK_REALTIME, &timenow);
189 info->header.stamp = image->header.stamp;
192 info->header.frame_id = image->header.frame_id;
195 if (
imi_time()-uvcStartTime >= 10000)
211 if(depthStartTime == 0)
218 clock_gettime(CLOCK_REALTIME, &timenow);
225 info->header.stamp = image->header.stamp;
227 info->header.frame_id = image->header.frame_id;
231 if (
imi_time()-depthStartTime >= 10000)
257 printf(
"****** color_subscribers_ in \n");
263 printf(
"****** color_subscribers_ out \n");
275 printf(
"****** uvc_subscribers_ in \n");
283 printf(
"****** uvc_subscribers_ out \n");
295 printf(
"****** depth_subscribers_ in \n");
303 printf(
"****** depth_subscribers_ out \n");
315 printf(
"****** cloud_subscribers_ in \n");
321 printf(
"****** cloud_subscribers_ out \n");
360 pub_cloud_ = cloud_it.
advertise<sensor_msgs::PointCloud2>(
"image", 1, itssc_cloud, itssc_cloud);
image_transport::CameraPublisher pub_color_
static const int64_t NUM_NANOSECS_PER_MICROSEC
void setUVCFrameCallback(FrameCallbackFunction callback)
void publish(const sensor_msgs::Image &image, const sensor_msgs::CameraInfo &info) const
boost::function< void(const SingleSubscriberPublisher &)> SubscriberStatusCallback
void publish(const boost::shared_ptr< M > &message) const
dynamic_reconfigure::Server< Config > ReconfigureServer
uint32_t getNumSubscribers() const
bool hasDepthSensor() const
boost::function< void(const SingleSubscriberPublisher &)> SubscriberStatusCallback
void newUVCFrameCallback(sensor_msgs::ImagePtr image)
int startDepthStream(ImiFrameMode depthFrameMode)
int startColorStream(ImiFrameMode colorFrameMode)
void setCloudPointCallback(CloudCallbackFunction callback)
ImiFrameMode supportFrameMode[]
CameraPublisher advertiseCamera(const std::string &base_topic, uint32_t queue_size, bool latch=false)
void advertiseROSTopics()
static const int64_t NUM_MILLISEC_PER_SEC
int startUVCStream(ImiCameraFrameMode uvcframeMode)
boost::shared_ptr< ReconfigureServer > reconfigure_server_
ImiCameraFrameMode supportCameraFrameMode[]
static const int64_t NUM_MICROSECS_PER_SEC
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
bool hasColorSensor() const
image_transport::CameraPublisher pub_uvc_
ImiDriver(ros::NodeHandle &n, ros::NodeHandle &pnh)
static const int64_t NUM_MICROSECS_PER_MILLESEC
void setColorFrameCallback(FrameCallbackFunction callback)
sensor_msgs::CameraInfoPtr getDefaultCameraInfo(int width, int height)
void setDepthFrameCallback(FrameCallbackFunction callback)
uint32_t getNumSubscribers() const
ros::Publisher pub_cloud_
image_transport::CameraPublisher pub_depth_
void newColorFrameCallback(sensor_msgs::ImagePtr image)
bool hasUVCSensor() const
void newCloudPointCallback(boost::shared_ptr< sensor_msgs::PointCloud2 > cloudPtr)
imi_ros_cfg::ImiConfig Config
void newDepthFrameCallback(sensor_msgs::ImagePtr image)
static const int64_t NUM_NANNOSECS_PER_SEC
void configCb(Config &config, uint32_t level)
static const int64_t NUM_NANOSECS_PER_MILLESEC