nodelet.cpp
Go to the documentation of this file.
1 /*
2 This code was developed by the National Robotics Engineering Center (NREC), part of the Robotics Institute at Carnegie
3 Mellon University.
4 Its development was funded by DARPA under the LS3 program and submitted for public release on June 7th, 2012.
5 Release was granted on August, 21st 2012 with Distribution Statement "A" (Approved for Public Release, Distribution
6 Unlimited).
7 
8 This software is released under a BSD license:
9 
10 Copyright (c) 2012, Carnegie Mellon University. All rights reserved.
11 Copyright (c) 2018, Clearpath Robotics, Inc., All rights reserved.
12 
13 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
14 following conditions are met:
15 
16 Redistributions of source code must retain the above copyright notice, this list of conditions and the following
17 disclaimer.
18 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
19 disclaimer in the documentation and/or other materials provided with the distribution.
20 Neither the name of the Carnegie Mellon University nor the names of its contributors may be used to endorse or promote
21 products derived from this software without specific prior written permission.
22 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
23 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30 
49 // ROS and associated nodelet interface and PLUGINLIB declaration header
50 #include "ros/ros.h"
52 #include <nodelet/nodelet.h>
53 
54 #include "spinnaker_camera_driver/SpinnakerCamera.h" // The actual standalone library for the Spinnakers
56 
57 #include <image_transport/image_transport.h> // ROS library that allows sending compressed images
58 #include <camera_info_manager/camera_info_manager.h> // ROS library that publishes CameraInfo topics
59 #include <sensor_msgs/CameraInfo.h> // ROS message header for CameraInfo
60 
61 #include <wfov_camera_msgs/WFOVImage.h>
62 #include <image_exposure_msgs/ExposureSequence.h> // Message type for configuring gain and white balance.
63 
64 #include <diagnostic_updater/diagnostic_updater.h> // Headers for publishing diagnostic messages.
66 
67 #include <boost/thread.hpp> // Needed for the nodelet to launch the reading thread.
68 
69 #include <dynamic_reconfigure/server.h> // Needed for the dynamic_reconfigure gui service to run
70 
71 #include <fstream>
72 #include <string>
73 
75 {
77 {
78 public:
80  {
81  }
82 
84  {
85  std::lock_guard<std::mutex> scopedLock(connect_mutex_);
86 
87  if (diagThread_)
88  {
89  diagThread_->interrupt();
90  diagThread_->join();
91  }
92 
93  if (pubThread_)
94  {
95  pubThread_->interrupt();
96  pubThread_->join();
97 
98  try
99  {
100  NODELET_DEBUG_ONCE("Stopping camera capture.");
101  spinnaker_.stop();
102  NODELET_DEBUG_ONCE("Disconnecting from camera.");
104  }
105  catch (const std::runtime_error& e)
106  {
107  NODELET_ERROR("%s", e.what());
108  }
109  }
110  }
111 
112 private:
123  void paramCallback(const spinnaker_camera_driver::SpinnakerConfig& config, uint32_t level)
124  {
125  config_ = config;
126 
127  try
128  {
129  NODELET_DEBUG_ONCE("Dynamic reconfigure callback with level: %u", level);
130  spinnaker_.setNewConfiguration(config, level);
131 
132  // Store needed parameters for the metadata message
133  gain_ = config.gain;
134  wb_blue_ = config.white_balance_blue_ratio;
135  wb_red_ = config.white_balance_red_ratio;
136 
137  // No separate param in CameraInfo for binning/decimation
138  binning_x_ = config.image_format_x_binning * config.image_format_x_decimation;
139  binning_y_ = config.image_format_y_binning * config.image_format_y_decimation;
140 
141  // Store CameraInfo RegionOfInterest information
142  // TODO(mhosmar): Not compliant with CameraInfo message: "A particular ROI always denotes the
143  // same window of pixels on the camera sensor, regardless of binning settings."
144  // These values are in the post binned frame.
145  if ((config.image_format_roi_width + config.image_format_roi_height) > 0 &&
146  (config.image_format_roi_width < spinnaker_.getWidthMax() ||
147  config.image_format_roi_height < spinnaker_.getHeightMax()))
148  {
149  roi_x_offset_ = config.image_format_x_offset;
150  roi_y_offset_ = config.image_format_y_offset;
151  roi_width_ = config.image_format_roi_width;
152  roi_height_ = config.image_format_roi_height;
153  do_rectify_ = true; // Set to true if an ROI is used.
154  }
155  else
156  {
157  // Zeros mean the full resolution was captured.
158  roi_x_offset_ = 0;
159  roi_y_offset_ = 0;
160  roi_height_ = 0;
161  roi_width_ = 0;
162  do_rectify_ = false; // Set to false if the whole image is captured.
163  }
164  }
165  catch (std::runtime_error& e)
166  {
167  NODELET_ERROR("Reconfigure Callback failed with error: %s", e.what());
168  }
169  }
170 
171  void diagCb()
172  {
173  if (!diagThread_) // We need to connect
174  {
175  // Start the thread to loop through and publish messages
176  diagThread_.reset(
177  new boost::thread(boost::bind(&spinnaker_camera_driver::SpinnakerCameraNodelet::diagPoll, this)));
178  }
179  }
180 
186  void connectCb()
187  {
188  if (!pubThread_) // We need to connect
189  {
190  // Start the thread to loop through and publish messages
191  pubThread_.reset(
192  new boost::thread(boost::bind(&spinnaker_camera_driver::SpinnakerCameraNodelet::devicePoll, this)));
193  }
194 
195  // @tthomas - removing subscriber check and logic below as it's leading to mutex locks and crashes currently
196  /*
197  NODELET_DEBUG_ONCE("Connect callback!");
198  std::lock_guard<std::mutex> scopedLock(connect_mutex_); // Grab the mutex. Wait until we're done initializing
199  before letting this function through.
200  // Check if we should disconnect (there are 0 subscribers to our data)
201  if(it_pub_.getNumSubscribers() == 0 && pub_->getPublisher().getNumSubscribers() == 0)
202  {
203  if (pubThread_)
204  {
205  NODELET_DEBUG_ONCE("Disconnecting.");
206  pubThread_->interrupt();
207  scopedLock.unlock();
208  pubThread_->join();
209  scopedLock.lock();
210  pubThread_.reset();
211  sub_.shutdown();
212 
213  try
214  {
215  NODELET_DEBUG_ONCE("Stopping camera capture.");
216  spinnaker_.stop();
217  }
218  catch(std::runtime_error& e)
219  {
220  NODELET_ERROR("%s", e.what());
221  }
222 
223  try
224  {
225  NODELET_DEBUG_ONCE("Disconnecting from camera.");
226  spinnaker_.disconnect();
227  }
228  catch(std::runtime_error& e)
229  {
230  NODELET_ERROR("%s", e.what());
231  }
232  }
233  }
234  else if(!pubThread_) // We need to connect
235  {
236  // Start the thread to loop through and publish messages
237  pubThread_.reset(new boost::thread(boost::bind(&spinnaker_camera_driver::SpinnakerCameraNodelet::devicePoll,
238  this)));
239  }
240  else
241  {
242  NODELET_DEBUG_ONCE("Do nothing in callback.");
243  }
244  */
245  }
246 
253  void onInit()
254  {
255  // Get nodeHandles
258 
259  // Get a serial number through ros
260  int serial = 0;
261 
262  XmlRpc::XmlRpcValue serial_xmlrpc;
263  pnh.getParam("serial", serial_xmlrpc);
264  if (serial_xmlrpc.getType() == XmlRpc::XmlRpcValue::TypeInt)
265  {
266  pnh.param<int>("serial", serial, 0);
267  }
268  else if (serial_xmlrpc.getType() == XmlRpc::XmlRpcValue::TypeString)
269  {
270  std::string serial_str;
271  pnh.param<std::string>("serial", serial_str, "0");
272  std::istringstream(serial_str) >> serial;
273  }
274  else
275  {
276  NODELET_DEBUG_ONCE("Serial XMLRPC type.");
277  serial = 0;
278  }
279 
280  std::string camera_serial_path;
281  pnh.param<std::string>("camera_serial_path", camera_serial_path, "");
282  NODELET_DEBUG_ONCE("Camera serial path %s", camera_serial_path.c_str());
283  // If serial has been provided directly as a param, ignore the path
284  // to read in the serial from.
285  while (serial == 0 && !camera_serial_path.empty())
286  {
287  serial = readSerialAsHexFromFile(camera_serial_path);
288  if (serial == 0)
289  {
290  NODELET_WARN_ONCE("Waiting for camera serial path to become available");
291  ros::Duration(1.0).sleep(); // Sleep for 1 second, wait for serial device path to become available
292  }
293  }
294 
295  NODELET_DEBUG_ONCE("Using camera serial %d", serial);
296 
297  spinnaker_.setDesiredCamera((uint32_t)serial);
298 
299  // Get GigE camera parameters:
300  pnh.param<int>("packet_size", packet_size_, 1400);
301  pnh.param<bool>("auto_packet_size", auto_packet_size_, true);
302  pnh.param<int>("packet_delay", packet_delay_, 4000);
303 
304  // TODO(mhosmar): Set GigE parameters:
305  // spinnaker_.setGigEParameters(auto_packet_size_, packet_size_, packet_delay_);
306 
307  // Get the location of our camera config yaml
308  std::string camera_info_url;
309  pnh.param<std::string>("camera_info_url", camera_info_url, "");
310  // Get the desired frame_id, set to 'camera' if not found
311  pnh.param<std::string>("frame_id", frame_id_, "camera");
312  // Do not call the connectCb function until after we are done initializing.
313  std::lock_guard<std::mutex> scopedLock(connect_mutex_);
314 
315  // Start up the dynamic_reconfigure service, note that this needs to stick around after this function ends
316  srv_ = std::make_shared<dynamic_reconfigure::Server<spinnaker_camera_driver::SpinnakerConfig> >(pnh);
317  dynamic_reconfigure::Server<spinnaker_camera_driver::SpinnakerConfig>::CallbackType f =
319 
320  srv_->setCallback(f);
321 
322  // queue size of ros publisher
323  int queue_size;
324  pnh.param<int>("queue_size", queue_size, 5);
325 
326  // Start the camera info manager and attempt to load any configurations
327  std::stringstream cinfo_name;
328  cinfo_name << serial;
329  cinfo_.reset(new camera_info_manager::CameraInfoManager(nh, cinfo_name.str(), camera_info_url));
330 
331  // Publish topics using ImageTransport through camera_info_manager (gives cool things like compression)
332  it_.reset(new image_transport::ImageTransport(nh));
334  it_pub_ = it_->advertiseCamera("image_raw", queue_size, cb, cb);
335 
336  // Set up diagnostics
337  updater_.setHardwareID("spinnaker_camera " + cinfo_name.str());
338 
339  // Set up a diagnosed publisher
340  double desired_freq;
341  pnh.param<double>("desired_freq", desired_freq, 30.0);
342  pnh.param<double>("min_freq", min_freq_, desired_freq);
343  pnh.param<double>("max_freq", max_freq_, desired_freq);
344  double freq_tolerance; // Tolerance before stating error on publish frequency, fractional percent of desired
345  // frequencies.
346  pnh.param<double>("freq_tolerance", freq_tolerance, 0.1);
347  int window_size; // Number of samples to consider in frequency
348  pnh.param<int>("window_size", window_size, 100);
349  double min_acceptable; // The minimum publishing delay (in seconds) before warning. Negative values mean future
350  // dated messages.
351  pnh.param<double>("min_acceptable_delay", min_acceptable, 0.0);
352  double max_acceptable; // The maximum publishing delay (in seconds) before warning.
353  pnh.param<double>("max_acceptable_delay", max_acceptable, 0.2);
355  pub_.reset(
357  nh.advertise<wfov_camera_msgs::WFOVImage>("image", queue_size, cb2, cb2),
359  &min_freq_, &max_freq_, freq_tolerance, window_size),
361  max_acceptable)));
362 
363  // Set up diagnostics aggregator publisher and diagnostics manager
365  boost::bind(&SpinnakerCameraNodelet::diagCb, this);
366  diagnostics_pub_.reset(
367  new ros::Publisher(nh.advertise<diagnostic_msgs::DiagnosticArray>(
368  "/diagnostics", 1, diag_cb, diag_cb)));
369 
370  diag_man = std::unique_ptr<DiagnosticsManager>(new DiagnosticsManager(
371  frame_id_, std::to_string(spinnaker_.getSerial()), diagnostics_pub_));
372  diag_man->addDiagnostic("DeviceTemperature", true, std::make_pair(0.0f, 90.0f), -10.0f, 95.0f);
373  diag_man->addDiagnostic("AcquisitionResultingFrameRate", true, std::make_pair(10.0f, 60.0f), 5.0f, 90.0f);
374  diag_man->addDiagnostic("PowerSupplyVoltage", true, std::make_pair(4.5f, 5.2f), 4.4f, 5.3f);
375  diag_man->addDiagnostic("PowerSupplyCurrent", true, std::make_pair(0.4f, 0.6f), 0.3f, 1.0f);
376  diag_man->addDiagnostic<int>("DeviceUptime");
377  diag_man->addDiagnostic<int>("U3VMessageChannelID");
378  }
379 
387  int readSerialAsHexFromFile(std::string camera_serial_path)
388  {
389  NODELET_DEBUG_ONCE("Reading camera serial file from: %s", camera_serial_path.c_str());
390 
391  std::ifstream serial_file(camera_serial_path.c_str());
392  std::stringstream buffer;
393  int serial = 0;
394 
395  if (serial_file.is_open())
396  {
397  std::string serial_str((std::istreambuf_iterator<char>(serial_file)), std::istreambuf_iterator<char>());
398  NODELET_DEBUG_ONCE("Serial file contents: %s", serial_str.c_str());
399  buffer << std::hex << serial_str;
400  buffer >> serial;
401  NODELET_DEBUG_ONCE("Serial discovered %d", serial);
402 
403  return serial;
404  }
405 
406  NODELET_WARN_ONCE("Unable to open serial path: %s", camera_serial_path.c_str());
407  return 0;
408  }
409 
410  void diagPoll()
411  {
412  while (!boost::this_thread::interruption_requested()) // Block until we need
413  // to stop this
414  // thread.
415  {
416  diag_man->processDiagnostics(&spinnaker_);
417  }
418  }
419 
426  void devicePoll()
427  {
428  ROS_INFO_ONCE("devicePoll");
429 
430  enum State
431  {
432  NONE,
433  ERROR,
434  STOPPED,
435  DISCONNECTED,
436  CONNECTED,
437  STARTED
438  };
439 
440  State state = DISCONNECTED;
441  State previous_state = NONE;
442 
443  while (!boost::this_thread::interruption_requested()) // Block until we need to stop this thread.
444  {
445  bool state_changed = state != previous_state;
446 
447  previous_state = state;
448 
449  switch (state)
450  {
451  case ERROR:
452 // Generally there's no need to stop before disconnecting after an
453 // error. Indeed, stop will usually fail.
454 #if STOP_ON_ERROR
455  // Try stopping the camera
456  {
457  std::lock_guard<std::mutex> scopedLock(connect_mutex_);
458  sub_.shutdown();
459  }
460 
461  try
462  {
463  NODELET_DEBUG_ONCE("Stopping camera.");
464  spinnaker_.stop();
465  NODELET_DEBUG_ONCE("Stopped camera.");
466 
467  state = STOPPED;
468  }
469  catch (std::runtime_error& e)
470  {
471  if (state_changed)
472  {
473  NODELET_ERROR("Failed to stop with error: %s", e.what());
474  ros::Duration(1.0).sleep(); // sleep for one second each time
475  }
476  state = ERROR;
477  }
478 
479  break;
480 #endif
481  case STOPPED:
482  // Try disconnecting from the camera
483  try
484  {
485  NODELET_DEBUG("Disconnecting from camera.");
487  NODELET_DEBUG("Disconnected from camera.");
488 
489  state = DISCONNECTED;
490  }
491  catch (std::runtime_error& e)
492  {
493  if (state_changed)
494  {
495  NODELET_ERROR("Failed to disconnect with error: %s", e.what());
496  ros::Duration(1.0).sleep(); // sleep for one second each time
497  }
498  state = ERROR;
499  }
500 
501  break;
502  case DISCONNECTED:
503  // Try connecting to the camera
504  try
505  {
506  NODELET_DEBUG("Connecting to camera.");
507 
509 
510  NODELET_DEBUG("Connected to camera.");
511 
512  // Set last configuration, forcing the reconfigure level to stop
514 
515  // Set the timeout for grabbing images.
516  try
517  {
518  double timeout;
519  getMTPrivateNodeHandle().param("timeout", timeout, 1.0);
520 
521  NODELET_DEBUG_ONCE("Setting timeout to: %f.", timeout);
522  spinnaker_.setTimeout(timeout);
523  }
524  catch (const std::runtime_error& e)
525  {
526  NODELET_ERROR("%s", e.what());
527  }
528 
529  // Subscribe to gain and white balance changes
530  {
531  std::lock_guard<std::mutex> scopedLock(connect_mutex_);
532  sub_ =
533  getMTNodeHandle().subscribe("image_exposure_sequence", 10,
535  }
536 
537  state = CONNECTED;
538  }
539  catch (const std::runtime_error& e)
540  {
541  if (state_changed)
542  {
543  NODELET_ERROR("Failed to connect with error: %s", e.what());
544  ros::Duration(1.0).sleep(); // sleep for one second each time
545  }
546  state = ERROR;
547  }
548 
549  break;
550  case CONNECTED:
551  // Try starting the camera
552  try
553  {
554  NODELET_DEBUG("Starting camera.");
555  spinnaker_.start();
556  NODELET_DEBUG("Started camera.");
557  NODELET_DEBUG("Attention: if nothing subscribes to the camera topic, the camera_info is not published "
558  "on the correspondent topic.");
559  state = STARTED;
560  }
561  catch (std::runtime_error& e)
562  {
563  if (state_changed)
564  {
565  NODELET_ERROR("Failed to start with error: %s", e.what());
566  ros::Duration(1.0).sleep(); // sleep for one second each time
567  }
568  state = ERROR;
569  }
570 
571  break;
572  case STARTED:
573  try
574  {
575  wfov_camera_msgs::WFOVImagePtr wfov_image(new wfov_camera_msgs::WFOVImage);
576  // Get the image from the camera library
577  NODELET_DEBUG_ONCE("Starting a new grab from camera with serial {%d}.", spinnaker_.getSerial());
578  spinnaker_.grabImage(&wfov_image->image, frame_id_);
579 
580  // Set other values
581  wfov_image->header.frame_id = frame_id_;
582 
583  wfov_image->gain = gain_;
584  wfov_image->white_balance_blue = wb_blue_;
585  wfov_image->white_balance_red = wb_red_;
586 
587  // wfov_image->temperature = spinnaker_.getCameraTemperature();
588 
589  ros::Time time = ros::Time::now() + ros::Duration(config_.time_offset);
590  wfov_image->header.stamp = time;
591  wfov_image->image.header.stamp = time;
592 
593  // Set the CameraInfo message
594  ci_.reset(new sensor_msgs::CameraInfo(cinfo_->getCameraInfo()));
595  ci_->header.stamp = wfov_image->image.header.stamp;
596  ci_->header.frame_id = wfov_image->header.frame_id;
597  // The height, width, distortion model, and parameters are all filled in by camera info manager.
598  ci_->binning_x = binning_x_;
599  ci_->binning_y = binning_y_;
600  ci_->roi.x_offset = roi_x_offset_;
601  ci_->roi.y_offset = roi_y_offset_;
602  ci_->roi.height = roi_height_;
603  ci_->roi.width = roi_width_;
604  ci_->roi.do_rectify = do_rectify_;
605 
606  wfov_image->info = *ci_;
607 
608  // Publish the full message
609  pub_->publish(wfov_image);
610 
611  // Publish the message using standard image transport
612  if (it_pub_.getNumSubscribers() > 0)
613  {
614  sensor_msgs::ImagePtr image(new sensor_msgs::Image(wfov_image->image));
615  it_pub_.publish(image, ci_);
616  }
617  }
618  catch (CameraTimeoutException& e)
619  {
620  NODELET_WARN("%s", e.what());
621  }
622 
623  catch (std::runtime_error& e)
624  {
625  NODELET_ERROR("%s", e.what());
626  state = ERROR;
627  }
628 
629  break;
630  default:
631  NODELET_ERROR("Unknown camera state %d!", state);
632  }
633 
634  // Update diagnostics
635  updater_.update();
636  }
637  NODELET_DEBUG_ONCE("Leaving thread.");
638  }
639 
640  void gainWBCallback(const image_exposure_msgs::ExposureSequence& msg)
641  {
642  try
643  {
644  NODELET_DEBUG_ONCE("Gain callback: Setting gain to %f and white balances to %u, %u", msg.gain,
645  msg.white_balance_blue, msg.white_balance_red);
646  gain_ = msg.gain;
647 
648  spinnaker_.setGain(static_cast<float>(gain_));
649  wb_blue_ = msg.white_balance_blue;
650  wb_red_ = msg.white_balance_red;
651 
652  // TODO(mhosmar):
653  // spinnaker_.setBRWhiteBalance(false, wb_blue_, wb_red_);
654  }
655  catch (std::runtime_error& e)
656  {
657  NODELET_ERROR("gainWBCallback failed with error: %s", e.what());
658  }
659  }
660 
661  /* Class Fields */
662  std::shared_ptr<dynamic_reconfigure::Server<spinnaker_camera_driver::SpinnakerConfig> > srv_;
663  std::shared_ptr<image_transport::ImageTransport> it_;
668  std::shared_ptr<camera_info_manager::CameraInfoManager> cinfo_;
672  std::shared_ptr<diagnostic_updater::DiagnosedPublisher<wfov_camera_msgs::WFOVImage> > pub_;
673  std::shared_ptr<ros::Publisher> diagnostics_pub_;
679 
680  std::mutex connect_mutex_;
681 
683  double min_freq_;
684  double max_freq_;
685 
687  sensor_msgs::CameraInfoPtr ci_;
688  std::string frame_id_;
689  std::shared_ptr<boost::thread> pubThread_;
690  std::shared_ptr<boost::thread> diagThread_;
691 
692  std::unique_ptr<DiagnosticsManager> diag_man;
693 
694  double gain_;
695  uint16_t wb_blue_;
696  uint16_t wb_red_;
697 
698  // Parameters for cameraInfo
699  size_t binning_x_;
700  size_t binning_y_;
701  size_t roi_x_offset_;
702  size_t roi_y_offset_;
703  size_t roi_height_;
704  size_t roi_width_;
705  bool do_rectify_;
706 
708  // For GigE cameras:
715 
717  spinnaker_camera_driver::SpinnakerConfig config_;
718 };
719 
721  nodelet::Nodelet) // Needed for Nodelet declaration
722 } // namespace spinnaker_camera_driver
std::unique_ptr< DiagnosticsManager > diag_man
Definition: nodelet.cpp:692
void grabImage(sensor_msgs::Image *image, const std::string &frame_id)
Loads the raw data from the cameras buffer.
void disconnect()
Disconnects from the camera.
void publish(const sensor_msgs::Image &image, const sensor_msgs::CameraInfo &info) const
void connect()
Function that connects to a specified camera.
boost::function< void(const SingleSubscriberPublisher &)> SubscriberStatusCallback
#define NODELET_ERROR(...)
#define NODELET_WARN(...)
size_t roi_x_offset_
Camera Info ROI x offset.
Definition: nodelet.cpp:701
NONE
f
#define ROS_INFO_ONCE(...)
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
std::shared_ptr< image_transport::ImageTransport > it_
Definition: nodelet.cpp:667
size_t binning_x_
Camera Info pixel binning along the image x axis.
Definition: nodelet.cpp:699
uint32_t getNumSubscribers() const
void setHardwareID(const std::string &hwid)
bool sleep() const
boost::function< void(const SingleSubscriberPublisher &)> SubscriberStatusCallback
ros::NodeHandle & getMTNodeHandle() const
size_t roi_width_
Camera Info ROI width.
Definition: nodelet.cpp:704
Type const & getType() const
sensor_msgs::CameraInfoPtr ci_
Camera Info message.
Definition: nodelet.cpp:687
std::shared_ptr< camera_info_manager::CameraInfoManager > cinfo_
Definition: nodelet.cpp:669
diagnostic_updater::Updater updater_
Handles publishing diagnostics messages.
Definition: nodelet.cpp:682
std::shared_ptr< ros::Publisher > diagnostics_pub_
Definition: nodelet.cpp:673
ros::NodeHandle & getMTPrivateNodeHandle() const
ros::Subscriber sub_
Subscriber for gain and white balance changes.
Definition: nodelet.cpp:678
void gainWBCallback(const image_exposure_msgs::ExposureSequence &msg)
Definition: nodelet.cpp:640
std::shared_ptr< dynamic_reconfigure::Server< spinnaker_camera_driver::SpinnakerConfig > > srv_
Definition: nodelet.cpp:662
size_t roi_height_
Camera Info ROI height.
Definition: nodelet.cpp:703
bool auto_packet_size_
If true, GigE packet size is automatically determined, otherwise packet_size_ is used: ...
Definition: nodelet.cpp:710
void connectCb()
Connection callback to only do work when someone is listening.
Definition: nodelet.cpp:186
void start()
Starts the camera loading data into its buffer.
PLUGINLIB_EXPORT_CLASS(image_proc::CropNonZeroNodelet, nodelet::Nodelet)
void onInit()
Serves as a psuedo constructor for nodelets.
Definition: nodelet.cpp:253
Class to support ROS Diagnostics Aggregator for Spinnaker Camera.
bool param(const std::string &param_name, T &param_val, const T &default_val) const
std::shared_ptr< boost::thread > pubThread_
The thread that reads and publishes the images.
Definition: nodelet.cpp:689
void setTimeout(const double &timeout)
Will set grabImage timeout for the camera.
spinnaker_camera_driver::SpinnakerConfig config_
Configuration:
Definition: nodelet.cpp:717
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
#define NODELET_WARN_ONCE(...)
void setDesiredCamera(const uint32_t &id)
Used to set the serial number for the camera you wish to connect to.
int readSerialAsHexFromFile(std::string camera_serial_path)
Reads in the camera serial from a specified file path. The format of the serial is expected to be bas...
Definition: nodelet.cpp:387
#define NODELET_DEBUG_ONCE(...)
size_t binning_y_
Camera Info pixel binning along the image y axis.
Definition: nodelet.cpp:700
std::shared_ptr< boost::thread > diagThread_
The thread that reads and publishes the diagnostics.
Definition: nodelet.cpp:690
size_t roi_y_offset_
Camera Info ROI y offset.
Definition: nodelet.cpp:702
bool getParam(const std::string &key, std::string &s) const
void paramCallback(const spinnaker_camera_driver::SpinnakerConfig &config, uint32_t level)
Function that allows reconfiguration of the camera.
Definition: nodelet.cpp:123
void devicePoll()
Function for the boost::thread to grabImages and publish them.
Definition: nodelet.cpp:426
Interface to Point Grey cameras.
static Time now()
std::shared_ptr< diagnostic_updater::DiagnosedPublisher< wfov_camera_msgs::WFOVImage > > pub_
Diagnosed.
Definition: nodelet.cpp:672
void stop()
Stops the camera loading data into its buffer.
#define NODELET_DEBUG(...)
image_transport::CameraPublisher it_pub_
CameraInfoManager ROS publisher.
Definition: nodelet.cpp:671
SpinnakerCamera spinnaker_
Instance of the SpinnakerCamera library, used to interface with the hardware.
Definition: nodelet.cpp:686
ERROR
void setNewConfiguration(const spinnaker_camera_driver::SpinnakerConfig &config, const uint32_t &level)
Function that allows reconfiguration of the camera.
std::string frame_id_
Frame id for the camera messages, defaults to &#39;camera&#39;.
Definition: nodelet.cpp:688


spinnaker_camera_driver
Author(s): Chad Rockey
autogenerated on Sun Feb 14 2021 03:47:26