cv_camera_nodelet.cpp
Go to the documentation of this file.
1 // Copyright [2015] Takashi Ogura<t.ogura@gmail.com>
2 
3 #include "cv_camera/driver.h"
4 
5 #include <nodelet/nodelet.h>
6 #include <boost/thread.hpp>
7 
8 namespace cv_camera
9 {
10 
15 {
16 public:
18  {
19  }
21  {
22  if (is_running_)
23  {
24  is_running_ = false;
25  thread_->join();
26  }
27  }
28 
29 private:
33  virtual void onInit()
34  {
37  try
38  {
39  driver_->setup();
40  is_running_ = true;
41  thread_ = boost::shared_ptr<boost::thread>(new boost::thread(boost::bind(&CvCameraNodelet::main, this)));
42  }
43  catch (cv_camera::DeviceError &e)
44  {
45  NODELET_ERROR_STREAM("failed to open device... do nothing: " << e.what());
46  }
47  }
48 
52  void main()
53  {
54  while (is_running_)
55  {
56  driver_->proceed();
57  }
58  }
59 
64 
69 
74 };
75 
76 } // end namespace cv_camera
77 
boost::shared_ptr< Driver > driver_
ROS cv camera driver.
ROS cv camera device exception.
Definition: exception.h:16
ros::NodeHandle & getPrivateNodeHandle() const
#define NODELET_ERROR_STREAM(...)
void main()
capture and publish.
namespace of this package
Definition: capture.h:20
boost::shared_ptr< boost::thread > thread_
thread object for main loop.
bool is_running_
true is thread is running.
virtual void onInit()
Start capture/publish thread.
ROS cv camera driver.
Definition: driver.h:16
Nodelet version of cv_camera.
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)


cv_camera
Author(s): Takashi Ogura
autogenerated on Mon Jun 1 2020 03:55:59