StereoNode.h
Go to the documentation of this file.
00001 /*********************************************************************
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Copyright (c) 2012-2016, Kevin Hallenbeck
00005  *  All rights reserved.
00006  *
00007  *  Redistribution and use in source and binary forms, with or without
00008  *  modification, are permitted provided that the following conditions
00009  *  are met:
00010  *
00011  *   * Redistributions of source code must retain the above copyright
00012  *     notice, this list of conditions and the following disclaimer.
00013  *   * Redistributions in binary form must reproduce the above
00014  *     copyright notice, this list of conditions and the following
00015  *     disclaimer in the documentation and/or other materials provided
00016  *     with the distribution.
00017  *   * Neither the name of Kevin Hallenbeck nor the names of its
00018  *     contributors may be used to endorse or promote products derived
00019  *     from this software without specific prior written permission.
00020  *
00021  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00022  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00023  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00024  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00025  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00026  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00027  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00028  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00029  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00030  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00031  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00032  *  POSSIBILITY OF SUCH DAMAGE.
00033  *********************************************************************/
00034 
00035 #ifndef _STEREO_NODE_H_
00036 #define _STEREO_NODE_H_
00037 
00038 // Use includes from CameraNode
00039 #include <ueye/CameraNode.h>
00040 #include <ueye/stereoConfig.h>
00041 
00042 // Threading
00043 #include <boost/thread/mutex.hpp>
00044 #include <boost/thread/lock_guard.hpp>
00045 
00046 namespace ueye
00047 {
00048 
00049 class StereoNode
00050 {
00051 public:
00052   StereoNode(ros::NodeHandle node, ros::NodeHandle private_nh);
00053   ~StereoNode();
00054 
00055 private:
00056   // ROS callbacks
00057   void reconfig(stereoConfig &config, uint32_t level);
00058   void reconfigCam(stereoConfig &config, uint32_t level, Camera &cam);
00059   void timerCallback(const ros::TimerEvent& event);
00060   void timerForceTrigger(const ros::TimerEvent& event);
00061   bool setCameraInfoL(sensor_msgs::SetCameraInfo::Request& req, sensor_msgs::SetCameraInfo::Response& rsp);
00062   bool setCameraInfoR(sensor_msgs::SetCameraInfo::Request& req, sensor_msgs::SetCameraInfo::Response& rsp);
00063   bool setCameraInfo(sensor_msgs::SetCameraInfo::Request& req, sensor_msgs::SetCameraInfo::Response& rsp, Camera& cam,
00064                      sensor_msgs::CameraInfo &msg_info);
00065 
00066   void loadIntrinsics(Camera &cam, sensor_msgs::CameraInfo &msg_info);
00067   sensor_msgs::ImagePtr processFrame(const char *frame, size_t size, const Camera &cam,
00068                                      sensor_msgs::CameraInfoPtr &info, sensor_msgs::CameraInfo &msg_info);
00069   void publishImageL(const char *frame, size_t size);
00070   void publishImageR(const char *frame, size_t size);
00071   void startCamera();
00072   void stopCamera();
00073   void closeCamera();
00074   void handlePath(std::string &path);
00075 
00076   dynamic_reconfigure::Server<stereoConfig> srv_;
00077   ros::Timer timer_;
00078   ros::Timer timer_force_trigger_;
00079   sensor_msgs::CameraInfo l_msg_camera_info_, r_msg_camera_info_;
00080 
00081   ueye::Camera l_cam_, r_cam_;
00082   bool running_;
00083   bool configured_;
00084   bool force_streaming_;
00085   std::string config_path_;
00086   int trigger_mode_;
00087   bool auto_exposure_;
00088   bool auto_gain_;
00089   int zoom_;
00090   ros::Time l_stamp_, r_stamp_;
00091 
00092   // ROS topics
00093   image_transport::ImageTransport it_;
00094   image_transport::CameraPublisher l_pub_stream_, r_pub_stream_;
00095   ros::ServiceServer l_srv_cam_info_, r_srv_cam_info_;
00096 
00097   // Threading
00098   boost::mutex mutex_;
00099 };
00100 
00101 } // namespace ueye
00102 
00103 #endif // _STEREO_NODE_H_


ueye
Author(s): Kevin Hallenbeck
autogenerated on Thu Sep 7 2017 09:31:27