genicam_camera_nodelet.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 Roboception GmbH
3  * All rights reserved
4  *
5  * Author: Heiko Hirschmueller
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright notice,
11  * this list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright notice,
14  * this list of conditions and the following disclaimer in the documentation
15  * and/or other materials provided with the distribution.
16  *
17  * 3. Neither the name of the copyright holder nor the names of its contributors
18  * may be used to endorse or promote products derived from this software without
19  * specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #include "genicam_camera_nodelet.h"
35 #include "timestamp_corrector.h"
36 
37 #include <rc_genicam_api/device.h>
38 #include <rc_genicam_api/stream.h>
39 #include <rc_genicam_api/buffer.h>
40 #include <rc_genicam_api/config.h>
42 
44 #include <exception>
45 
46 #include <fstream>
47 #include <sstream>
48 #include <stdexcept>
49 #include <cctype>
50 
51 #include <ros/ros.h>
53 
54 namespace rcgccam
55 {
56 #define ROS_HAS_STEADYTIME (ROS_VERSION_MINIMUM(1, 13, 1) || ((ROS_VERSION_MINOR == 12) && ROS_VERSION_PATCH >= 8))
57 
59 {
61  sync_tolerance_ = 0;
62  rotate_ = false;
63  running_ = false;
64 }
65 
67 {
68  ROS_INFO("rc_genicam_camera: Shutting down");
69 
70  // signal running_ threads and wait until they finish
71 
72  running_ = false;
73  if (grab_thread_.joinable())
74  {
75  grab_thread_.join();
76  }
77 
79 }
80 
82 {
83  ROS_INFO("rc_genicam_camera: Initialization");
84 
85  // get parameter configuration
86 
89 
90  std::string device = "";
91  std::string access = "control";
92  std::string config = "";
93  std::string calib = "";
94  int calib_id=-1;
95 
96  pnh.param("frame_id", frame_id_, frame_id_);
97 
98  if (frame_id_.size() == 0)
99  {
100  std::string ns = ros::this_node::getNamespace();
101 
102  if (ns.size() > 0 && ns[0] == '/')
103  {
104  ns = ns.substr(1);
105  }
106 
107  if (ns.size() > 0)
108  {
109  frame_id_ = ns + "_camera";
110  }
111  else
112  {
113  frame_id_ = "camera";
114  }
115 
116  int cid=-1;
117  pnh.param("calib_id", cid, cid);
118 
119  if (cid >= 0)
120  {
121  frame_id_ = frame_id_ + std::to_string(cid);
122  }
123  }
124 
125  pnh.param("device", device, device);
126  pnh.param("gev_access", access, access);
127  pnh.param("config_file", config, config);
128  pnh.param("calib_file", calib, calib);
129  pnh.param("calib_id", calib_id, calib_id);
130 
131  if (device.size() == 0)
132  {
133  ROS_FATAL("The GenICam device ID must be given in the private parameter 'device'!");
134  return;
135  }
136 
137  rcg::Device::ACCESS access_id;
138  if (access == "exclusive")
139  {
140  access_id = rcg::Device::EXCLUSIVE;
141  }
142  else if (access == "control")
143  {
144  access_id = rcg::Device::CONTROL;
145  }
146  else
147  {
148  ROS_FATAL_STREAM("rc_visard_driver: Access must be 'control' or 'exclusive': " << access);
149  return;
150  }
151 
152  // optional parameters for timestamp correction
153 
154  bool host_timestamp = false;
155  pnh.param("host_timestamp", host_timestamp, host_timestamp);
156  pnh.param("timestamp_tolerance_", timestamp_tolerance_, 0.01);
157 
158  if (!host_timestamp)
159  {
161  }
162 
163  // optional parameters for timestamp synchronization
164 
165  std::string sync_info;
166  pnh.param("sync_info", sync_info, sync_info);
167  pnh.param("sync_tolerance", sync_tolerance_, 0.019);
168 
169  if (sync_info.size() > 0)
170  {
171  sub_sync_info_ = nh.subscribe(sync_info, 10, &GenICamCameraNodelet::syncInfo, this);
172 
173  image_list_.setSize(25);
174  image_list_.setTolerance(static_cast<uint64_t>(sync_tolerance_ * 1000000000.0));
175 
176  info_list_.setSize(25);
177  info_list_.setTolerance(static_cast<uint64_t>(sync_tolerance_ * 1000000000.0));
178  }
179  else
180  {
181  sync_tolerance_ = -1;
182  }
183 
184  // setup service for getting and setting parameters
185 
187 
189 
190  // initialize publishers
191 
192  caminfo_pub_.init(nh, calib.c_str(), calib_id);
193 
195  image_pub_.init(it);
196 
197  // get optional prefix for storing all grabbed images
198 
199  pnh.param("image_prefix", image_prefix_, image_prefix_);
200 
201  // rotating images by 180 degrees?
202 
203  pnh.param("rotate", rotate_, rotate_);
204 
205  // start grabbing threads
206 
207  running_ = true;
208  grab_thread_ = std::thread(&GenICamCameraNodelet::grab, this, device, access_id, config);
209 }
210 
211 namespace
212 {
213 // read file as string
214 
215 std::string loadConfig(const std::string& filename)
216 {
217  if (filename.size() > 0)
218  {
219  std::ifstream in(filename);
220  std::stringstream buffer;
221 
222  if (in)
223  {
224  buffer << in.rdbuf();
225  return buffer.str();
226  }
227  else
228  {
229  ROS_ERROR_STREAM("rc_genicam_camera: Cannot load config: " << filename);
230  }
231  }
232 
233  return std::string();
234 }
235 
236 // Expect one or more GenICam parameter name and values in the format
237 // <name>[=<value>], which must not contain a white space, separated by white
238 // spaces and applies them to the given nodemap.
239 //
240 // An expection is thrown in case of an error. Execution stops on the first
241 // error.
242 
243 void applyParameters(const std::shared_ptr<GenApi::CNodeMapRef>& nodemap, const std::string& parameters)
244 {
245  size_t i = 0;
246 
247  while (i < parameters.size())
248  {
249  // eat all white spaces
250 
251  while (i < parameters.size() && std::isspace(parameters[i]))
252  i++;
253 
254  // skip comments which start with # and end by \n
255 
256  if (i < parameters.size() && parameters[i] == '#')
257  {
258  while (i < parameters.size() && parameters[i] != '\n')
259  i++;
260  }
261  else
262  {
263  size_t k = i;
264  while (k < parameters.size() && !std::isspace(parameters[k]))
265  k++;
266 
267  size_t j = parameters.find('=', i);
268 
269  if (j <= k)
270  {
271  std::string name = parameters.substr(i, j - i);
272  std::string value = parameters.substr(j + 1, k - j - 1);
273 
274  rcg::setString(nodemap, name.c_str(), value.c_str(), true);
275  }
276  else if (i < k)
277  {
278  std::string name = parameters.substr(i, k - i);
279 
280  rcg::callCommand(nodemap, name.c_str(), true);
281  }
282 
283  i = k;
284  }
285  }
286 }
287 
288 } // namespace
289 
290 bool GenICamCameraNodelet::getGenICamParameter(rc_genicam_camera::GetGenICamParameter::Request& req,
291  rc_genicam_camera::GetGenICamParameter::Response& resp)
292 {
293  std::lock_guard<std::mutex> lock(device_mtx_);
294 
295  if (rcgnodemap_)
296  {
297  try
298  {
299  resp.value = rcg::getString(rcgnodemap_, req.name.c_str(), true);
300  resp.return_code.value = resp.return_code.SUCCESS;
301  resp.return_code.message = "ok";
302  }
303  catch (const std::exception& ex)
304  {
305  ROS_ERROR_STREAM("rc_genicam_camera: Cannot get parameter: " << ex.what());
306 
307  resp.return_code.value = resp.return_code.INVALID_ARGUMENT;
308  resp.return_code.message = ex.what();
309  }
310  }
311 
312  return true;
313 }
314 
315 bool GenICamCameraNodelet::setGenICamParameter(rc_genicam_camera::SetGenICamParameter::Request& req,
316  rc_genicam_camera::SetGenICamParameter::Response& resp)
317 {
318  std::lock_guard<std::mutex> lock(device_mtx_);
319 
320  if (rcgnodemap_)
321  {
322  try
323  {
324  applyParameters(rcgnodemap_, req.parameters);
325 
326  resp.return_code.value = resp.return_code.SUCCESS;
327  resp.return_code.message = "ok";
328  }
329  catch (const std::exception& ex)
330  {
331  ROS_ERROR_STREAM("rc_genicam_camera: Cannot set parameters: " << ex.what());
332 
333  resp.return_code.value = resp.return_code.INVALID_ARGUMENT;
334  resp.return_code.message = ex.what();
335  }
336  }
337 
338  return true;
339 }
340 
341 namespace
342 {
343 
344 void storeImage(const std::string &prefix, const sensor_msgs::ImagePtr &image)
345 {
346  // prepare file name
347 
348  std::ostringstream name;
349 
350  uint64_t t_sec = image->header.stamp.sec;
351  uint64_t t_nsec = image->header.stamp.nsec;
352 
353  name << prefix << "_" << t_sec << "." << std::setfill('0') << std::setw(9) << t_nsec << ".pgm";
354 
355  // store 8 bit images
356 
357  if (image->encoding == sensor_msgs::image_encodings::MONO8 ||
358  image->encoding == sensor_msgs::image_encodings::BAYER_BGGR8 ||
359  image->encoding == sensor_msgs::image_encodings::BAYER_GBRG8 ||
360  image->encoding == sensor_msgs::image_encodings::BAYER_GRBG8 ||
362  {
363  size_t width = image->width;
364  size_t height = image->height;
365  uint8_t* p = reinterpret_cast<uint8_t*>(&image->data[0]);
366 
367  FILE *out = fopen(name.str().c_str(), "w");
368 
369  if (out)
370  {
371  fprintf(out, "P5\n%lu %lu\n255\n", width, height);
372  size_t n = fwrite(p, 1, width*height, out);
373 
374  if (n < width*height)
375  {
376  ROS_ERROR_STREAM("Cannot write to file " << name.str() <<
377  " (" << n << " < " << width*height << ")");
378  }
379 
380  fclose(out);
381  }
382  else
383  {
384  ROS_ERROR_STREAM("Cannot create file " << name.str());
385  }
386  }
387 }
388 
389 }
390 
391 void GenICamCameraNodelet::syncInfo(sensor_msgs::CameraInfoPtr info)
392 {
393  sensor_msgs::ImagePtr image;
394 
395  {
396  std::lock_guard<std::mutex> lock(sync_mtx_);
397 
398  // find image that corresponds to camera info
399 
400  image = image_list_.find(info->header.stamp);
401 
402  if (image != 0)
403  {
404  // remove all older images and infos
405 
406  int n = image_list_.removeOld(image->header.stamp) - 1;
407  info_list_.removeOld(info->header.stamp);
408 
409  if (n > 0)
410  {
411  ROS_WARN_STREAM("rc_genicam_camera: Dropped unused images: " << n);
412  }
413 
414  // correct time stamp of image
415 
416  image->header.stamp = info->header.stamp;
417  }
418  else
419  {
420  // store info
421 
422  info_list_.add(info);
423  }
424  }
425 
426  // publish images
427 
428  if (image)
429  {
430  caminfo_pub_.publish(image);
431  image_pub_.publish(image);
432 
433  // store images
434 
435  if (image_prefix_.size() > 0)
436  {
437  storeImage(image_prefix_, image);
438  }
439  }
440 }
441 
442 void GenICamCameraNodelet::grab(std::string device, rcg::Device::ACCESS access, std::string config)
443 {
444  try
445  {
446  ROS_INFO("rc_genicam_camera: Grabbing thread started");
447 
448  // load initial configuration for camera into string
449 
450  std::string init_params = loadConfig(config);
451 
452  // initialize optional timestamp correction
453 
454  TimestampCorrector ts_host;
455  ts_host.setMaximumTolerance(static_cast<int64_t>(timestamp_tolerance_ * 1000000000));
456  ts_host.setInterval(1000000000ll);
457 
458  // loop until nodelet is killed
459 
460  while (running_)
461  {
462  // report standard exceptions and try again
463 
464  try
465  {
466  {
467  std::lock_guard<std::mutex> lock(device_mtx_);
468 
469  // open device and get nodemap
470 
471  rcgdev_ = rcg::getDevice(device.c_str());
472 
473  if (!rcgdev_)
474  {
475  throw std::invalid_argument("Cannot find device");
476  }
477 
478  rcgdev_->open(access);
479  rcgnodemap_ = rcgdev_->getRemoteNodeMap();
480 
481  // initialize camera
482 
483  try
484  {
485  applyParameters(rcgnodemap_, init_params);
486  }
487  catch (const std::exception& ex)
488  {
489  ROS_ERROR_STREAM("rc_genicam_camera: Error during initial camera configuration: " << ex.what());
490  }
491  }
492 
493  // initialize timestamp correction
494 
495  if (!ts_host.determineOffset(rcgnodemap_))
496  {
498  "rc_genicam_camera: Cannot determine offset between host and camera clock with maximum tolerance of "
499  << timestamp_tolerance_ << " s");
500  }
501 
502  // start streaming
503 
504  std::vector<std::shared_ptr<rcg::Stream> > stream = rcgdev_->getStreams();
505 
506  if (stream.size() == 0)
507  {
508  throw std::invalid_argument("Device does not offer streams");
509  }
510 
511  stream[0]->open();
512  stream[0]->startStreaming();
513 
514  ROS_INFO_STREAM("rc_genicam_camera: Start streaming");
515 
516  // grabbing thread
517 
518  while (running_)
519  {
520  const rcg::Buffer* buffer = stream[0]->grab(50);
521 
522  if (buffer != 0)
523  {
524  if (!buffer->getIsIncomplete())
525  {
526  uint32_t npart = buffer->getNumberOfParts();
527  for (uint32_t part = 0; part < npart; part++)
528  {
529  if (buffer->getImagePresent(part))
530  {
531  // convert image to ROS
532 
533  sensor_msgs::ImagePtr image = rosImageFromBuffer(frame_id_, buffer, part, rotate_);
534 
535  if (image)
536  {
537  // correct timestamp
538 
539  ts_host.correct(image->header.stamp);
540 
541  // optionally take timestamp of approximately synchronized
542  // camera info
543 
544  if (sync_tolerance_ > 0)
545  {
546  std::lock_guard<std::mutex> lock(sync_mtx_);
547 
548  // find camera info that corresponds to the image
549 
550  sensor_msgs::CameraInfoPtr info = info_list_.find(image->header.stamp);
551 
552  if (info != 0)
553  {
554  // remove all older images and infos
555 
556  int n = image_list_.removeOld(image->header.stamp);
557  info_list_.removeOld(info->header.stamp);
558 
559  if (n > 0)
560  {
561  ROS_WARN_STREAM("rc_genicam_camera: Dropped images: " << n);
562  }
563 
564  // correct time stamp of image
565 
566  image->header.stamp = info->header.stamp;
567  }
568  else
569  {
570  // store image in internal list for later
571  // synchronization to camera info
572 
573  image = image_list_.add(image);
574 
575  if (image)
576  {
577  ROS_WARN_THROTTLE(10, "rc_genicam_camera: Input queue full, dropping image");
578  }
579 
580  image.reset();
581  }
582  }
583 
584  // publish images
585 
586  if (image)
587  {
588  caminfo_pub_.publish(image);
589  image_pub_.publish(image);
590 
591  // store images
592 
593  if (image_prefix_.size() > 0)
594  {
595  storeImage(image_prefix_, image);
596  }
597  }
598  }
599  else
600  {
601  ROS_ERROR_STREAM("rc_genicam_camera: Unsupported pixel format");
602  }
603  }
604  }
605 
606  // re-determine offset of host and camera clock
607 
608  if (!ts_host.determineOffset(rcgnodemap_))
609  {
610  ROS_ERROR_STREAM("rc_genicam_camera: Cannot determine offset between host and camera clock with "
611  "maximum tolerance of "
612  << timestamp_tolerance_ << " s");
613  }
614  }
615  else
616  {
617  ROS_WARN_STREAM("rc_genicam_camera: Incomplete buffer received");
618  }
619  }
620  }
621 
622  // stop streaming
623 
624  stream[0]->stopStreaming();
625  stream[0]->close();
626  }
627  catch (const std::exception& ex)
628  {
629  ROS_ERROR_STREAM("rc_genicam_camera: " << ex.what());
630  sleep(1);
631  }
632 
633  // close device
634 
635  {
636  std::lock_guard<std::mutex> lock(device_mtx_);
637 
638  if (rcgdev_)
639  rcgdev_->close();
640 
641  rcgdev_.reset();
642  rcgnodemap_.reset();
643  }
644  }
645  }
646  catch (const std::exception& ex)
647  {
648  ROS_FATAL_STREAM("rc_genicam_camera: " << ex.what());
649  }
650  catch (...)
651  {
652  ROS_FATAL_STREAM("rc_genicam_camera: Unknown exception");
653  }
654 
655  running_ = false;
656  ROS_INFO("rc_genicam_camera: Grabbing thread stopped");
657 }
658 
659 } // namespace rcgccam
660 
pixel_formats.h
sensor_msgs::image_encodings::BAYER_RGGB8
const std::string BAYER_RGGB8
ros::this_node::getNamespace
const ROSCPP_DECL std::string & getNamespace()
nodelet::Nodelet::getNodeHandle
ros::NodeHandle & getNodeHandle() const
image_encodings.h
image_transport::ImageTransport
ROS_ERROR_STREAM
#define ROS_ERROR_STREAM(args)
rcgccam::ImageList::removeOld
int removeOld(const ros::Time &timestamp)
Remove all images that have a timestamp that is older or equal than the given timestamp.
Definition: imagelist.cc:72
rcgccam::GenICamCameraNodelet::rotate_
bool rotate_
Definition: genicam_camera_nodelet.h:102
rcg::Buffer
rcgccam::GenICamCameraNodelet::running_
std::atomic_bool running_
Definition: genicam_camera_nodelet.h:105
rcgccam::rosImageFromBuffer
sensor_msgs::ImagePtr rosImageFromBuffer(const std::string &frame_id, const rcg::Buffer *buffer, uint32_t part, bool rotate)
Converts a (supported) image in a GenICam buffer into a ROS image.
Definition: image_publisher.cc:229
ROS_FATAL_STREAM
#define ROS_FATAL_STREAM(args)
ROS_WARN_THROTTLE
#define ROS_WARN_THROTTLE(period,...)
ros.h
rcgccam::ImageList::find
sensor_msgs::ImagePtr find(const ros::Time &timestamp) const
Returns the oldest image that has a timestamp within the tolerance of the given timestamp.
Definition: imagelist.cc:93
rcgccam::GenICamCameraNodelet::grab
void grab(std::string device, rcg::Device::ACCESS access, std::string config)
Definition: genicam_camera_nodelet.cc:442
rcgccam::GenICamCameraNodelet::timestamp_tolerance_
double timestamp_tolerance_
Definition: genicam_camera_nodelet.h:81
rcgccam::CameraInfoPublisher::publish
void publish(const sensor_msgs::ImagePtr &image)
Definition: camera_info_publisher.cc:559
rcgccam::ImageList::add
sensor_msgs::ImagePtr add(const sensor_msgs::ImagePtr &image)
Adds the given image to the internal list.
Definition: imagelist.cc:57
sensor_msgs::image_encodings::BAYER_GBRG8
const std::string BAYER_GBRG8
rcgccam::GenICamCameraNodelet::get_param_service_
ros::ServiceServer get_param_service_
Definition: genicam_camera_nodelet.h:86
width::width
width(unsigned int i)
ros::NodeHandle::advertiseService
ServiceServer advertiseService(AdvertiseServiceOptions &ops)
rcg::Buffer::getNumberOfParts
std::uint32_t getNumberOfParts() const
buffer.h
rcgccam::GenICamCameraNodelet::info_list_
CameraInfoList info_list_
Definition: genicam_camera_nodelet.h:96
rcgccam::GenICamCameraNodelet::caminfo_pub_
CameraInfoPublisher caminfo_pub_
Definition: genicam_camera_nodelet.h:99
rcg::Buffer::getIsIncomplete
bool getIsIncomplete() const
rcgccam::CameraInfoList::setSize
void setSize(size_t maxsize)
Set maximum size of the list.
Definition: camerainfolist.cc:47
rcgccam::GenICamCameraNodelet::getGenICamParameter
bool getGenICamParameter(rc_genicam_camera::GetGenICamParameter::Request &req, rc_genicam_camera::GetGenICamParameter::Response &resp)
Definition: genicam_camera_nodelet.cc:290
nodelet::Nodelet::getPrivateNodeHandle
ros::NodeHandle & getPrivateNodeHandle() const
timestamp_corrector.h
rcg::Device::EXCLUSIVE
EXCLUSIVE
storeImage
std::string storeImage(const std::string &name, ImgFmt fmt, const Image &image, size_t yoffset=0, size_t height=0)
rcgccam::CameraInfoList::removeOld
int removeOld(const ros::Time &timestamp)
Remove all camera infos that have a timestamp that is older or equal than the given timestamp.
Definition: camerainfolist.cc:72
rcg::callCommand
bool callCommand(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, bool exception=false)
rcgccam
Definition: camerainfolist.cc:40
class_list_macros.h
rcgccam::ImagePublisher::init
void init(image_transport::ImageTransport &id)
Initialization of publisher.
Definition: image_publisher.cc:51
rcgccam::ImagePublisher::publish
void publish(const sensor_msgs::ImagePtr &image)
Definition: image_publisher.cc:61
rcgccam::TimestampCorrector::determineOffset
bool determineOffset(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap)
Determine the offset between the system and camera clock.
Definition: timestamp_corrector.cc:76
genicam_camera_nodelet.h
ROS_WARN_STREAM
#define ROS_WARN_STREAM(args)
rcgccam::CameraInfoList::setTolerance
void setTolerance(uint64_t tolerance)
Set tolerance for finding corresponding timestamps.
Definition: camerainfolist.cc:52
PLUGINLIB_EXPORT_CLASS
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
rcgccam::GenICamCameraNodelet::grab_thread_
std::thread grab_thread_
Definition: genicam_camera_nodelet.h:104
rcg::getDevice
std::shared_ptr< Device > getDevice(const char *devid)
rcg::System::clearSystems
static void clearSystems()
rcgccam::GenICamCameraNodelet
Definition: genicam_camera_nodelet.h:59
sensor_msgs::image_encodings::BAYER_BGGR8
const std::string BAYER_BGGR8
rcgccam::GenICamCameraNodelet::GenICamCameraNodelet
GenICamCameraNodelet()
Definition: genicam_camera_nodelet.cc:58
rcgccam::GenICamCameraNodelet::frame_id_
std::string frame_id_
Definition: genicam_camera_nodelet.h:89
rcgccam::TimestampCorrector::correct
int64_t correct(ros::Time &time)
Correct the given camera timestamp to system time.
Definition: timestamp_corrector.cc:135
rcgccam::GenICamCameraNodelet::image_prefix_
std::string image_prefix_
Definition: genicam_camera_nodelet.h:101
rcgccam::GenICamCameraNodelet::sync_mtx_
std::mutex sync_mtx_
Definition: genicam_camera_nodelet.h:97
rcgccam::TimestampCorrector::setMaximumTolerance
void setMaximumTolerance(int64_t tol_ns)
Set the maximum tolerance for the offset between system and camera clock.
Definition: timestamp_corrector.cc:55
rcg::Device::CONTROL
CONTROL
rcgccam::GenICamCameraNodelet::~GenICamCameraNodelet
virtual ~GenICamCameraNodelet()
Definition: genicam_camera_nodelet.cc:66
ros::NodeHandle::subscribe
Subscriber subscribe(const std::string &topic, uint32_t queue_size, const boost::function< void(C)> &callback, const VoidConstPtr &tracked_object=VoidConstPtr(), const TransportHints &transport_hints=TransportHints())
ROS_INFO_STREAM
#define ROS_INFO_STREAM(args)
rcgccam::CameraInfoList::find
sensor_msgs::CameraInfoPtr find(const ros::Time &timestamp) const
Returns the oldest camera info that has a timestamp within the tolerance of the given timestamp.
Definition: camerainfolist.cc:93
ROS_FATAL
#define ROS_FATAL(...)
rcgccam::GenICamCameraNodelet::setGenICamParameter
bool setGenICamParameter(rc_genicam_camera::SetGenICamParameter::Request &req, rc_genicam_camera::SetGenICamParameter::Response &resp)
Definition: genicam_camera_nodelet.cc:315
rcgccam::GenICamCameraNodelet::set_param_service_
ros::ServiceServer set_param_service_
Definition: genicam_camera_nodelet.h:87
rcg::Device::ACCESS
ACCESS
rcgccam::GenICamCameraNodelet::onInit
virtual void onInit()
Definition: genicam_camera_nodelet.cc:81
rcg::setString
bool setString(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, const char *value, bool exception=false)
std::ostringstream::str
std::string str()
nodelet::Nodelet
device.h
rcgccam::CameraInfoList::add
sensor_msgs::CameraInfoPtr add(const sensor_msgs::CameraInfoPtr &info)
Adds the given camera info to the internal list.
Definition: camerainfolist.cc:57
int64_t
__int64 int64_t
rcgccam::CameraInfoPublisher::init
void init(ros::NodeHandle &nh, const char *calib_file, int id)
Initialization of publisher.
Definition: camera_info_publisher.cc:343
sensor_msgs::image_encodings::MONO8
const std::string MONO8
std::ostringstream
rcgccam::TimestampCorrector
This class uses the GenICam command "TimestampLatch" and the parameter "TimestampLatchValue" to deter...
Definition: timestamp_corrector.h:49
rcgccam::ImageList::setSize
void setSize(size_t maxsize)
Set maximum size of the list.
Definition: imagelist.cc:47
rcg::Buffer::getImagePresent
bool getImagePresent(std::uint32_t part) const
rcgccam::GenICamCameraNodelet::image_list_
ImageList image_list_
Definition: genicam_camera_nodelet.h:95
width
rcgccam::ImageList::setTolerance
void setTolerance(uint64_t tolerance)
Set tolerance for finding corresponding timestamps.
Definition: imagelist.cc:52
rcgccam::TimestampCorrector::setInterval
void setInterval(int64_t interval_ns)
Set minimum time between determination of offset.
Definition: timestamp_corrector.cc:60
rcgccam::GenICamCameraNodelet::rcgnodemap_
std::shared_ptr< GenApi::CNodeMapRef > rcgnodemap_
Definition: genicam_camera_nodelet.h:92
ros::NodeHandle::param
T param(const std::string &param_name, const T &default_val) const
rcgccam::GenICamCameraNodelet::device_mtx_
std::mutex device_mtx_
Definition: genicam_camera_nodelet.h:93
rcgccam::GenICamCameraNodelet::syncInfo
void syncInfo(sensor_msgs::CameraInfoPtr info)
Definition: genicam_camera_nodelet.cc:391
sensor_msgs::image_encodings::BAYER_GRBG8
const std::string BAYER_GRBG8
rcg::getString
std::string getString(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, bool exception=false, bool igncache=false)
ROS_INFO
#define ROS_INFO(...)
rcgccam::GenICamCameraNodelet::sync_tolerance_
double sync_tolerance_
Definition: genicam_camera_nodelet.h:82
rcgccam::GenICamCameraNodelet::sub_sync_info_
ros::Subscriber sub_sync_info_
Definition: genicam_camera_nodelet.h:84
rcgccam::GenICamCameraNodelet::image_pub_
ImagePublisher image_pub_
Definition: genicam_camera_nodelet.h:100
rcgccam::GenICamCameraNodelet::rcgdev_
std::shared_ptr< rcg::Device > rcgdev_
Definition: genicam_camera_nodelet.h:91
ros::NodeHandle
stream.h


rc_genicam_camera
Author(s): Heiko Hirschmueller
autogenerated on Wed Mar 2 2022 00:49:18