camera_driver.cpp
Go to the documentation of this file.
1 /*********************************************************************
2 * Software License Agreement (BSD License)
3 *
4 * Copyright (C) 2012 Ken Tossell
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
17 * * Neither the name of the author nor other contributors may be
18 * used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 *********************************************************************/
35 
36 #include <ros/ros.h>
37 #include <sensor_msgs/Image.h>
38 #include <std_msgs/Header.h>
40 #include <dynamic_reconfigure/server.h>
41 #include <libuvc/libuvc.h>
42 #include <astra_camera/GetDeviceType.h>
43 #include <astra_camera/GetCameraInfo.h>
44 #include <cmath>
45 
46 #define libuvc_VERSION (libuvc_VERSION_MAJOR * 10000 \
47  + libuvc_VERSION_MINOR * 100 \
48  + libuvc_VERSION_PATCH)
49 
50 namespace libuvc_camera {
51 
53  : nh_(nh), priv_nh_(priv_nh),
54  state_(kInitial),
55  ctx_(NULL), dev_(NULL), devh_(NULL), rgb_frame_(NULL),
56  it_(nh_),
57  config_server_(mutex_, priv_nh_),
58  config_changed_(false),
59  cinfo_manager_(nh) {
60  cam_pub_ = it_.advertiseCamera("image_raw", 1, false);
62  device_type_client = nh_.serviceClient<astra_camera::GetDeviceType>(ns + "/get_device_type");
63  camera_info_client = nh_.serviceClient<astra_camera::GetCameraInfo>(ns + "/get_camera_info");
70  device_type_init_ = false;
71  camera_info_init_ = false;
72  uvc_flip_ = 0;
74  int slash_end;
75  for (slash_end = 0; slash_end < ns.length(); slash_end++)
76  {
77  if (ns[slash_end] != '/')
78  {
79  break;
80  }
81  }
82  ns_no_slash = ns.substr(slash_end);
83  camera_info_valid_ = false;
84 }
85 
87  if (rgb_frame_)
88  uvc_free_frame(rgb_frame_);
89 
90  if (ctx_)
91  uvc_exit(ctx_); // Destroys dev_, devh_, etc.
92 }
93 
94 bool CameraDriver::getUVCExposureCb(astra_camera::GetUVCExposureRequest& req, astra_camera::GetUVCExposureResponse& res)
95 {
96  uint32_t expo;
97  uvc_error_t err = uvc_get_exposure_abs(devh_, &expo, UVC_GET_CUR);
98  res.exposure = expo;
99  return (err == UVC_SUCCESS);
100 }
101 
102 bool CameraDriver::setUVCExposureCb(astra_camera::SetUVCExposureRequest& req, astra_camera::SetUVCExposureResponse& res)
103 {
104  if (req.exposure == 0)
105  {
106  uvc_set_ae_mode(devh_, 2);
107  return true;
108  }
109  uvc_set_ae_mode(devh_, 1); // mode 1: manual mode; 2: auto mode; 4: shutter priority mode; 8: aperture priority mode
110  if (req.exposure > 330)
111  {
112  ROS_ERROR("Please set exposure lower than 330");
113  return false;
114  }
115  uvc_error_t err = uvc_set_exposure_abs(devh_, req.exposure);
116  return (err == UVC_SUCCESS);
117 }
118 
119 bool CameraDriver::getUVCGainCb(astra_camera::GetUVCGainRequest& req, astra_camera::GetUVCGainResponse& res)
120 {
121  uint16_t gain;
122  uvc_error_t err = uvc_get_gain(devh_, &gain, UVC_GET_CUR);
123  res.gain = gain;
124  return (err == UVC_SUCCESS);
125 }
126 
127 bool CameraDriver::setUVCGainCb(astra_camera::SetUVCGainRequest& req, astra_camera::SetUVCGainResponse& res)
128 {
129  uvc_error_t err = uvc_set_gain(devh_, req.gain);
130  return (err == UVC_SUCCESS);
131 }
132 
133 bool CameraDriver::getUVCWhiteBalanceCb(astra_camera::GetUVCWhiteBalanceRequest& req, astra_camera::GetUVCWhiteBalanceResponse& res)
134 {
135  uint16_t white_balance;
136  uvc_error_t err = uvc_get_white_balance_temperature(devh_, &white_balance, UVC_GET_CUR);
137  res.white_balance = white_balance;
138  return (err == UVC_SUCCESS);
139 }
140 
141 bool CameraDriver::setUVCWhiteBalanceCb(astra_camera::SetUVCWhiteBalanceRequest& req, astra_camera::SetUVCWhiteBalanceResponse& res)
142 {
143  if (req.white_balance == 0)
144  {
145  uvc_set_white_balance_temperature_auto(devh_, 1);
146  return true;
147  }
148  uvc_set_white_balance_temperature_auto(devh_, 0); // 0: manual, 1: auto
149  uvc_error_t err = uvc_set_white_balance_temperature(devh_, req.white_balance);
150  return (err == UVC_SUCCESS);
151 }
152 
154  assert(state_ == kInitial);
155 
156  uvc_error_t err;
157 
158  err = uvc_init(&ctx_, NULL);
159 
160  if (err != UVC_SUCCESS) {
161  uvc_perror(err, "ERROR: uvc_init");
162  return false;
163  }
164 
165  state_ = kStopped;
166 
167  config_server_.setCallback(boost::bind(&CameraDriver::ReconfigureCallback, this, _1, _2));
168 
169  return state_ == kRunning;
170 }
171 
173  boost::recursive_mutex::scoped_lock(mutex_);
174 
175  assert(state_ != kInitial);
176 
177  if (state_ == kRunning)
178  CloseCamera();
179 
180  assert(state_ == kStopped);
181 
182  uvc_exit(ctx_);
183  ctx_ = NULL;
184 
185  state_ = kInitial;
186 }
187 
188 void CameraDriver::ReconfigureCallback(UVCCameraConfig &new_config, uint32_t level) {
189  boost::recursive_mutex::scoped_lock(mutex_);
190 
191  if ((level & kReconfigureClose) == kReconfigureClose) {
192  if (state_ == kRunning)
193  CloseCamera();
194  }
195 
196  if (state_ == kStopped) {
197  OpenCamera(new_config);
198  }
199 
200  if (new_config.camera_info_url != config_.camera_info_url)
201  cinfo_manager_.loadCameraInfo(new_config.camera_info_url);
202 
203  if (state_ == kRunning) {
204 #define PARAM_INT(name, fn, value) if (new_config.name != config_.name) { \
205  int val = (value); \
206  if (uvc_set_##fn(devh_, val)) { \
207  ROS_WARN("Unable to set " #name " to %d", val); \
208  new_config.name = config_.name; \
209  } \
210  }
211 
212  PARAM_INT(scanning_mode, scanning_mode, new_config.scanning_mode);
213  PARAM_INT(auto_exposure, ae_mode, 1 << new_config.auto_exposure);
214  PARAM_INT(auto_exposure_priority, ae_priority, new_config.auto_exposure_priority);
215  PARAM_INT(exposure_absolute, exposure_abs, new_config.exposure_absolute * 10000);
216  PARAM_INT(auto_focus, focus_auto, new_config.auto_focus ? 1 : 0);
217  PARAM_INT(focus_absolute, focus_abs, new_config.focus_absolute);
218 #if libuvc_VERSION > 00005 /* version > 0.0.5 */
219  PARAM_INT(gain, gain, new_config.gain);
220  PARAM_INT(iris_absolute, iris_abs, new_config.iris_absolute);
221  PARAM_INT(brightness, brightness, new_config.brightness);
222 #endif
223 
224 
225  if (new_config.pan_absolute != config_.pan_absolute || new_config.tilt_absolute != config_.tilt_absolute) {
226  if (uvc_set_pantilt_abs(devh_, new_config.pan_absolute, new_config.tilt_absolute)) {
227  ROS_WARN("Unable to set pantilt to %d, %d", new_config.pan_absolute, new_config.tilt_absolute);
228  new_config.pan_absolute = config_.pan_absolute;
229  new_config.tilt_absolute = config_.tilt_absolute;
230  }
231  }
232  // TODO: roll_absolute
233  // TODO: privacy
234  // TODO: backlight_compensation
235  // TODO: contrast
236  // TODO: power_line_frequency
237  // TODO: auto_hue
238  // TODO: saturation
239  // TODO: sharpness
240  // TODO: gamma
241  // TODO: auto_white_balance
242  // TODO: white_balance_temperature
243  // TODO: white_balance_BU
244  // TODO: white_balance_RV
245  }
246 
247  config_ = new_config;
248 }
249 
250 void CameraDriver::ImageCallback(uvc_frame_t *frame) {
251  ros::Time timestamp = ros::Time(frame->capture_time.tv_sec, frame->capture_time.tv_usec);
252  if ( timestamp == ros::Time(0) ) {
253  timestamp = ros::Time::now();
254  }
255 
256  boost::recursive_mutex::scoped_lock(mutex_);
257 
258  assert(state_ == kRunning);
259  assert(rgb_frame_);
260 
261  sensor_msgs::Image::Ptr image(new sensor_msgs::Image());
262  image->width = config_.width;
263  image->height = config_.height;
264  image->step = image->width * 3;
265  image->data.resize(image->step * image->height);
266 
267  if (frame->frame_format == UVC_FRAME_FORMAT_BGR){
268  image->encoding = "bgr8";
269  memcpy(&(image->data[0]), frame->data, frame->data_bytes);
270  } else if (frame->frame_format == UVC_FRAME_FORMAT_RGB){
271  image->encoding = "rgb8";
272  memcpy(&(image->data[0]), frame->data, frame->data_bytes);
273  } else if (frame->frame_format == UVC_FRAME_FORMAT_UYVY) {
274  image->encoding = "yuv422";
275  memcpy(&(image->data[0]), frame->data, frame->data_bytes);
276  } else if (frame->frame_format == UVC_FRAME_FORMAT_YUYV) {
277  // FIXME: uvc_any2bgr does not work on "yuyv" format, so use uvc_yuyv2bgr directly.
278  uvc_error_t conv_ret = uvc_yuyv2bgr(frame, rgb_frame_);
279  if (conv_ret != UVC_SUCCESS) {
280  uvc_perror(conv_ret, "Couldn't convert frame to RGB");
281  return;
282  }
283  image->encoding = "bgr8";
284  memcpy(&(image->data[0]), rgb_frame_->data, rgb_frame_->data_bytes);
285 #if libuvc_VERSION > 00005 /* version > 0.0.5 */
286  } else if (frame->frame_format == UVC_FRAME_FORMAT_MJPEG) {
287  // Enable mjpeg support despite uvs_any2bgr shortcoming
288  // https://github.com/ros-drivers/libuvc_ros/commit/7508a09f
289  uvc_error_t conv_ret = uvc_mjpeg2rgb(frame, rgb_frame_);
290  if (conv_ret != UVC_SUCCESS) {
291  uvc_perror(conv_ret, "Couldn't convert frame to RGB");
292  return;
293  }
294  image->encoding = "rgb8";
295  memcpy(&(image->data[0]), rgb_frame_->data, rgb_frame_->data_bytes);
296 #endif
297  } else {
298  uvc_error_t conv_ret = uvc_any2bgr(frame, rgb_frame_);
299  if (conv_ret != UVC_SUCCESS) {
300  uvc_perror(conv_ret, "Couldn't convert frame to RGB");
301  return;
302  }
303  image->encoding = "bgr8";
304  memcpy(&(image->data[0]), rgb_frame_->data, rgb_frame_->data_bytes);
305  }
306 
307  astra_camera::GetDeviceType device_type_srv;
308  astra_camera::GetCameraInfo camera_info_srv;
309 
310  if (device_type_init_ == false)
311  {
312  if (device_type_client.call(device_type_srv))
313  {
314  device_type_ = device_type_srv.response.device_type;
315  if (strcmp(device_type_.c_str(), OB_STEREO_S) == 0)
316  {
318  }
319  else if (strcmp(device_type_.c_str(), OB_EMBEDDED_S) == 0)
320  {
322  uvc_flip_ = 1;
323  }
324  else if (strcmp(device_type_.c_str(), OB_ASTRA_PRO) == 0)
325  {
327  }
328  else if (strcmp(device_type_.c_str(), OB_STEREO_S_U3) == 0)
329  {
331  }
332  else
333  {
335  }
336  device_type_init_ = true;
337  }
338  }
339 
340  if (camera_info_init_ == false)
341  {
342  if (camera_info_client.call(camera_info_srv))
343  {
344  camera_info_ = camera_info_srv.response.info;
345  camera_info_init_ = true;
346  camera_info_valid_ = true;
347  if (std::isnan(camera_info_.K[0]) || std::isnan(camera_info_.K[2]) || std::isnan(camera_info_.K[4]) || std::isnan(camera_info_.K[5]))
348  {
349  camera_info_valid_ = false;
350  }
351  }
352  }
353 
354  sensor_msgs::CameraInfo::Ptr cinfo(new sensor_msgs::CameraInfo(cinfo_manager_.getCameraInfo()));
356  {
357  // update cinfo
358  if (camera_info_init_ == true && camera_info_valid_ == true)
359  {
360  cinfo->height = image->height;
361  cinfo->width = image->width;
362  cinfo->distortion_model = camera_info_.distortion_model;
363  cinfo->D.resize(5, 0.0);
364  cinfo->D[4] = 0.0000000001;
365  // for (int i = 0; i < 5; i++)
366  // {
367  // cinfo->D[i] = camera_info_.D[i];
368  // }
369  for (int i = 0; i < 9; i++)
370  {
371  cinfo->K[i] = camera_info_.K[i];
372  cinfo->R[i] = camera_info_.R[i];
373  }
374  cinfo->K[0] = (1 - uvc_flip_)*(camera_info_.K[0]) + (uvc_flip_)*(-camera_info_.K[0]);
375  cinfo->K[2] = (1 - uvc_flip_)*(camera_info_.K[2]) + (uvc_flip_)*(image->width - camera_info_.K[2]);
376  for (int i = 0; i < 12; i++)
377  {
378  cinfo->P[i] = camera_info_.P[i];
379  }
380  }
381  image->header.frame_id = ns_no_slash + "_rgb_optical_frame";
382  cinfo->header.frame_id = ns_no_slash + "_rgb_optical_frame";
383  }
384  else
385  {
386  image->header.frame_id = config_.frame_id;
387  cinfo->header.frame_id = config_.frame_id;
388  }
389  image->header.stamp = timestamp;
390  cinfo->header.stamp = timestamp;
391 
392  cam_pub_.publish(image, cinfo);
393 
394  if (config_changed_)
395  {
396  config_server_.updateConfig(config_);
397  config_changed_ = false;
398  }
399 }
400 
401 /* static */ void CameraDriver::ImageCallbackAdapter(uvc_frame_t *frame, void *ptr) {
402  CameraDriver *driver = static_cast<CameraDriver*>(ptr);
403 
404  driver->ImageCallback(frame);
405 }
406 
408  enum uvc_status_class status_class,
409  int event,
410  int selector,
411  enum uvc_status_attribute status_attribute,
412  void *data, size_t data_len) {
413  boost::recursive_mutex::scoped_lock(mutex_);
414 
415  printf("Controls callback. class: %d, event: %d, selector: %d, attr: %d, data_len: %zu\n",
416  status_class, event, selector, status_attribute, data_len);
417 
418  if (status_attribute == UVC_STATUS_ATTRIBUTE_VALUE_CHANGE) {
419  switch (status_class) {
420  case UVC_STATUS_CLASS_CONTROL_CAMERA: {
421  switch (selector) {
422  case UVC_CT_EXPOSURE_TIME_ABSOLUTE_CONTROL:
423  uint8_t *data_char = (uint8_t*) data;
424  uint32_t exposure_int = ((data_char[0]) | (data_char[1] << 8) |
425  (data_char[2] << 16) | (data_char[3] << 24));
426  config_.exposure_absolute = exposure_int * 0.0001;
427  config_changed_ = true;
428  break;
429  }
430  break;
431  }
432  case UVC_STATUS_CLASS_CONTROL_PROCESSING: {
433  switch (selector) {
434  case UVC_PU_WHITE_BALANCE_TEMPERATURE_CONTROL:
435  uint8_t *data_char = (uint8_t*) data;
436  config_.white_balance_temperature =
437  data_char[0] | (data_char[1] << 8);
438  config_changed_ = true;
439  break;
440  }
441  break;
442  }
443  }
444 
445  // config_server_.updateConfig(config_);
446  }
447 }
448 
450  enum uvc_status_class status_class,
451  int event,
452  int selector,
453  enum uvc_status_attribute status_attribute,
454  void *data, size_t data_len,
455  void *ptr) {
456  CameraDriver *driver = static_cast<CameraDriver*>(ptr);
457 
458  driver->AutoControlsCallback(status_class, event, selector,
459  status_attribute, data, data_len);
460 }
461 
462 enum uvc_frame_format CameraDriver::GetVideoMode(std::string vmode){
463  if(vmode == "uncompressed") {
464  return UVC_COLOR_FORMAT_UNCOMPRESSED;
465  } else if (vmode == "compressed") {
466  return UVC_COLOR_FORMAT_COMPRESSED;
467  } else if (vmode == "yuyv") {
468  return UVC_COLOR_FORMAT_YUYV;
469  } else if (vmode == "uyvy") {
470  return UVC_COLOR_FORMAT_UYVY;
471  } else if (vmode == "rgb") {
472  return UVC_COLOR_FORMAT_RGB;
473  } else if (vmode == "bgr") {
474  return UVC_COLOR_FORMAT_BGR;
475  } else if (vmode == "mjpeg") {
476  return UVC_COLOR_FORMAT_MJPEG;
477  } else if (vmode == "gray8") {
478  return UVC_COLOR_FORMAT_GRAY8;
479  } else {
480  ROS_ERROR_STREAM("Invalid Video Mode: " << vmode);
481  ROS_WARN_STREAM("Continue using video mode: uncompressed");
482  return UVC_COLOR_FORMAT_UNCOMPRESSED;
483  }
484 };
485 
486 void CameraDriver::OpenCamera(UVCCameraConfig &new_config) {
487  assert(state_ == kStopped);
488 
489  int vendor_id = strtol(new_config.vendor.c_str(), NULL, 0);
490  int product_id = strtol(new_config.product.c_str(), NULL, 0);
491 
492  ROS_INFO("Opening camera with vendor=0x%x, product=0x%x, serial=\"%s\", index=%d",
493  vendor_id, product_id, new_config.serial.c_str(), new_config.index);
494 
495  uvc_device_t **devs;
496 
497  // Implement missing index select behavior
498  // https://github.com/ros-drivers/libuvc_ros/commit/4f30e9a0
499 #if libuvc_VERSION > 00005 /* version > 0.0.5 */
500  uvc_error_t find_err = uvc_find_devices(
501  ctx_, &devs,
502  vendor_id,
503  product_id,
504  new_config.serial.empty() ? NULL : new_config.serial.c_str());
505 
506  if (find_err != UVC_SUCCESS) {
507  uvc_perror(find_err, "uvc_find_device");
508  return;
509  }
510 
511  // select device by index
512  dev_ = NULL;
513  int dev_idx = 0;
514  while (devs[dev_idx] != NULL) {
515  if(dev_idx == new_config.index) {
516  dev_ = devs[dev_idx];
517  }
518  else {
519  uvc_unref_device(devs[dev_idx]);
520  }
521 
522  dev_idx++;
523  }
524 
525  if(dev_ == NULL) {
526  ROS_ERROR("Unable to find device at index %d", new_config.index);
527  return;
528  }
529 #else
530  uvc_error_t find_err = uvc_find_device(
531  ctx_, &dev_,
532  vendor_id,
533  product_id,
534  new_config.serial.empty() ? NULL : new_config.serial.c_str());
535 
536  if (find_err != UVC_SUCCESS) {
537  uvc_perror(find_err, "uvc_find_device");
538  return;
539  }
540 
541 #endif
542  uvc_error_t open_err = uvc_open(dev_, &devh_);
543 
544  if (open_err != UVC_SUCCESS) {
545  switch (open_err) {
546  case UVC_ERROR_ACCESS:
547 #ifdef __linux__
548  ROS_ERROR("Permission denied opening /dev/bus/usb/%03d/%03d",
549  uvc_get_bus_number(dev_), uvc_get_device_address(dev_));
550 #else
551  ROS_ERROR("Permission denied opening device %d on bus %d",
552  uvc_get_device_address(dev_), uvc_get_bus_number(dev_));
553 #endif
554  break;
555  default:
556 #ifdef __linux__
557  ROS_ERROR("Can't open /dev/bus/usb/%03d/%03d: %s (%d)",
558  uvc_get_bus_number(dev_), uvc_get_device_address(dev_),
559  uvc_strerror(open_err), open_err);
560 #else
561  ROS_ERROR("Can't open device %d on bus %d: %s (%d)",
562  uvc_get_device_address(dev_), uvc_get_bus_number(dev_),
563  uvc_strerror(open_err), open_err);
564 #endif
565  break;
566  }
567 
568  uvc_unref_device(dev_);
569  return;
570  }
571 
572  uvc_set_status_callback(devh_, &CameraDriver::AutoControlsCallbackAdapter, this);
573 
574  uvc_stream_ctrl_t ctrl;
575  uvc_error_t mode_err = uvc_get_stream_ctrl_format_size(
576  devh_, &ctrl,
577  GetVideoMode(new_config.video_mode),
578  new_config.width, new_config.height,
579  new_config.frame_rate);
580 
581  if (mode_err != UVC_SUCCESS) {
582  uvc_perror(mode_err, "uvc_get_stream_ctrl_format_size");
583  uvc_close(devh_);
584  uvc_unref_device(dev_);
585  ROS_ERROR("check video_mode/width/height/frame_rate are available");
586  uvc_print_diag(devh_, NULL);
587  return;
588  }
589 
590  uvc_error_t stream_err = uvc_start_streaming(devh_, &ctrl, &CameraDriver::ImageCallbackAdapter, this, 0);
591 
592  if (stream_err != UVC_SUCCESS) {
593  uvc_perror(stream_err, "uvc_start_streaming");
594  uvc_close(devh_);
595  uvc_unref_device(dev_);
596  return;
597  }
598 
599  if (rgb_frame_)
600  uvc_free_frame(rgb_frame_);
601 
602  rgb_frame_ = uvc_allocate_frame(new_config.width * new_config.height * 3);
603  assert(rgb_frame_);
604 
605  state_ = kRunning;
606 }
607 
609  assert(state_ == kRunning);
610 
611  uvc_close(devh_);
612  devh_ = NULL;
613 
614  uvc_unref_device(dev_);
615  dev_ = NULL;
616 
617  state_ = kStopped;
618 }
619 
620 };
boost::recursive_mutex mutex_
Definition: camera_driver.h:76
ros::ServiceServer set_uvc_exposure_server
Definition: camera_driver.h:95
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
static void ImageCallbackAdapter(uvc_frame_t *frame, void *ptr)
enum uvc_frame_format GetVideoMode(std::string vmode)
void publish(const sensor_msgs::Image &image, const sensor_msgs::CameraInfo &info) const
bool getUVCExposureCb(astra_camera::GetUVCExposureRequest &req, astra_camera::GetUVCExposureResponse &res)
sensor_msgs::CameraInfo getCameraInfo(void)
ros::ServiceServer get_uvc_gain_server
Definition: camera_driver.h:96
bool setUVCGainCb(astra_camera::SetUVCGainRequest &req, astra_camera::SetUVCGainResponse &res)
unsigned short uint16_t
ros::ServiceServer get_uvc_white_balance_server
Definition: camera_driver.h:98
bool loadCameraInfo(const std::string &url)
bool setUVCExposureCb(astra_camera::SetUVCExposureRequest &req, astra_camera::SetUVCExposureResponse &res)
bool call(MReq &req, MRes &res)
static void AutoControlsCallbackAdapter(enum uvc_status_class status_class, int event, int selector, enum uvc_status_attribute status_attribute, void *data, size_t data_len, void *ptr)
ros::ServiceClient camera_info_client
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
unsigned char uint8_t
image_transport::ImageTransport it_
Definition: camera_driver.h:83
#define ROS_WARN(...)
ros::ServiceServer set_uvc_white_balance_server
Definition: camera_driver.h:99
sensor_msgs::CameraInfo camera_info_
#define OB_EMBEDDED_S
dynamic_reconfigure::Server< UVCCameraConfig > config_server_
Definition: camera_driver.h:86
ros::ServiceServer get_uvc_exposure_server
Definition: camera_driver.h:94
bool astraWithUVC(OB_DEVICE_NO id)
void ReconfigureCallback(UVCCameraConfig &config, uint32_t level)
CameraPublisher advertiseCamera(const std::string &base_topic, uint32_t queue_size, bool latch=false)
#define OB_STEREO_S
void ImageCallback(uvc_frame_t *frame)
ROSCPP_DECL const std::string & getNamespace()
bool getUVCGainCb(astra_camera::GetUVCGainRequest &req, astra_camera::GetUVCGainResponse &res)
#define ROS_INFO(...)
bool setUVCWhiteBalanceCb(astra_camera::SetUVCWhiteBalanceRequest &req, astra_camera::SetUVCWhiteBalanceResponse &res)
#define PARAM_INT(name, fn, value)
ros::ServiceClient device_type_client
#define ROS_WARN_STREAM(args)
bool getUVCWhiteBalanceCb(astra_camera::GetUVCWhiteBalanceRequest &req, astra_camera::GetUVCWhiteBalanceResponse &res)
void OpenCamera(UVCCameraConfig &new_config)
image_transport::CameraPublisher cam_pub_
Definition: camera_driver.h:84
camera_info_manager::CameraInfoManager cinfo_manager_
Definition: camera_driver.h:90
#define OB_STEREO_S_U3
void AutoControlsCallback(enum uvc_status_class status_class, int event, int selector, enum uvc_status_attribute status_attribute, void *data, size_t data_len)
unsigned int uint32_t
ros::ServiceServer set_uvc_gain_server
Definition: camera_driver.h:97
static Time now()
#define OB_ASTRA_PRO
static const int kReconfigureClose
Definition: camera_driver.h:41
CameraDriver(ros::NodeHandle nh, ros::NodeHandle priv_nh)
#define ROS_ERROR_STREAM(args)
#define ROS_ERROR(...)
uvc_device_handle_t * devh_
Definition: camera_driver.h:80


astra_camera
Author(s): Tim Liu
autogenerated on Wed Dec 16 2020 03:54:34