sensor2D_nodelet.cpp
Go to the documentation of this file.
00001 /******************************************************************************
00002  * Copyright (c) 2016
00003  * VoXel Interaction Design GmbH
00004  *
00005  * @author Angel Merino Sastre
00006  *
00007  * Permission is hereby granted, free of charge, to any person obtaining a copy
00008  * of this software and associated documentation files (the "Software"), to deal
00009  * in the Software without restriction, including without limitation the rights
00010  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00011  * copies of the Software, and to permit persons to whom the Software is
00012  * furnished to do so, subject to the following conditions:
00013  *
00014  * The above copyright notice and this permission notice shall be included in
00015  * all copies or substantial portions of the Software.
00016  *
00017  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00018  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00019  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00020  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00021  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00022  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00023  * THE SOFTWARE.
00024  *
00025  ******************************************************************************/
00026 
00043 #include <bta_tof_driver/sensor2D.hpp>
00044 #include <nodelet/nodelet.h>
00045 #include <boost/thread.hpp>
00046 
00047 namespace bta_tof_driver {
00048 
00049         class Sensor2DNodelet : public nodelet::Nodelet {
00050 
00051         public:
00052                  Sensor2DNodelet() : 
00053                         nodelet::Nodelet(),
00054                         lp_(NULL),
00055                         stream_thread_(NULL)
00056                  {
00057                  };
00058                  
00059                 virtual ~Sensor2DNodelet() 
00060                 {
00061                         stream_thread_->join();
00062                 };
00063         
00064         private:
00065                 virtual void onInit() 
00066                 {
00067                         NODELET_WARN_STREAM("Initializing nodelet..." << getName());
00068                 
00069                         lp_.reset(new bta_tof_driver::Sensor2D(getNodeHandle(), getPrivateNodeHandle(), getName()));
00070                         stream_thread_.reset(new boost::thread(boost::bind(&Sensor2D::init, lp_.get())));
00071                 };
00072                         boost::scoped_ptr<bta_tof_driver::Sensor2D> lp_;
00073                         boost::scoped_ptr<boost::thread> stream_thread_;
00074         };
00075         
00076 }
00077 
00078 #include <pluginlib/class_list_macros.h>
00079 PLUGINLIB_EXPORT_CLASS(bta_tof_driver::Sensor2DNodelet, nodelet::Nodelet);
00080 
00081 


bta_tof_driver
Author(s): Angel Merino , Simon Vogl
autogenerated on Thu Jun 20 2019 19:58:11