nodelets/viewer.cpp
Go to the documentation of this file.
1 #include <boost/bind.hpp>
2 #include <boost/make_shared.hpp>
3 #include <boost/shared_ptr.hpp>
4 #include <boost/thread.hpp>
5 
6 #include <nodelet/nodelet.h>
8 
9 #include "tracker-viewer.hh"
10 
11 namespace visp_tracker
12 {
14  {
15  public:
17  : nodelet::Nodelet (),
18  exiting_ (false),
19  trackerViewer_ (),
20  thread_ ()
21  {}
22 
24  {
25  exiting_ = true;
26  if (thread_)
27  if (!thread_->timed_join (boost::posix_time::seconds (2)))
28  NODELET_WARN ("failed to join thread but continuing anyway");
29  thread_.reset ();
30  trackerViewer_.reset ();
31  }
32 
33  void spin ()
34  {
37  (getMTNodeHandle (),
39  exiting_, 5u));
40  while (ros::ok () && !exiting_)
41  trackerViewer_->spin ();
42  }
43 
44  virtual void onInit ()
45  {
46  NODELET_DEBUG ("Initializing nodelet...");
47  exiting_ = false;
48  thread_ = boost::make_shared<boost::thread>
49  (boost::bind (&TrackerViewerNodelet::spin, this));
50  }
51  private:
52  volatile bool exiting_;
55  };
56 
57 } // end of namespace visp_tracker.
58 
boost::shared_ptr< boost::thread > thread_
#define NODELET_WARN(...)
PLUGINLIB_DECLARE_CLASS(visp_tracker, TrackerViewer, visp_tracker::TrackerViewerNodelet, nodelet::Nodelet)
boost::shared_ptr< visp_tracker::TrackerViewer > trackerViewer_
ros::NodeHandle & getMTNodeHandle() const
ros::NodeHandle & getMTPrivateNodeHandle() const
ROSCPP_DECL bool ok()
Monitors the tracking result provided by the tracking node.
#define NODELET_DEBUG(...)


visp_tracker
Author(s): Thomas Moulard
autogenerated on Wed Jul 3 2019 19:48:07