driver1394stereo.h
Go to the documentation of this file.
1 /* -*- mode: C++ -*- */
2 /* $Id: driver1394.h 35611 2011-01-30 05:49:18Z joq $ */
3 
4 /*********************************************************************
5 * Software License Agreement (BSD License)
6 *
7 * Copyright (c) 2010 Jack O'Quin
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 *
14 * * Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * * Redistributions in binary form must reproduce the above
17 * copyright notice, this list of conditions and the following
18 * disclaimer in the documentation and/or other materials provided
19 * with the distribution.
20 * * Neither the name of the author nor other contributors may be
21 * used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 *********************************************************************/
37 
38 #include <boost/thread/mutex.hpp>
39 
40 #include <ros/ros.h>
42 #include <dynamic_reconfigure/server.h>
44 #include <sensor_msgs/CameraInfo.h>
45 
46 #include "dev_camera1394stereo.h"
47 #include "camera1394stereo/Camera1394StereoConfig.h"
48 typedef camera1394stereo::Camera1394StereoConfig Config;
49 
57 {
58 
59 // Dynamic reconfiguration levels
60 //
61 // Must agree with SensorLevels class in cfg/Camera1394.cfg
62 class Levels
63 {
64 public:
65  static const uint32_t RECONFIGURE_CLOSE = 3; // Close the device to change
66  static const uint32_t RECONFIGURE_STOP = 1; // Stop the device to change
67  static const uint32_t RECONFIGURE_RUNNING = 0; // Parameters that can change any time
68 };
69 
71 {
72 public:
73 
74  // public methods
76  ros::NodeHandle camera_nh);
78  void poll(void);
79  void setup(void);
80  void shutdown(void);
81 
82  // driver states
83  static const uint8_t CLOSED = 0; // Not connected to the device
84  static const uint8_t OPENED = 1; // Connected to the camera, ready to stream
85  static const uint8_t RUNNING = 2; // Streaming images
86 
87 
88 private:
89 
90  enum CameraSelector {LEFT=0,RIGHT=1};
91  static const int NUM_CAMERAS = 2;
92  static const std::string CameraSelectorString[NUM_CAMERAS]; // = {"left","right"};
93 
94  // private methods
95  void closeCamera();
96  bool openCamera(Config &newconfig);
97  void publish(const sensor_msgs::ImagePtr image[NUM_CAMERAS]);
98  bool read(sensor_msgs::ImagePtr image[NUM_CAMERAS]);
99  void reconfig(camera1394stereo::Camera1394StereoConfig &newconfig, uint32_t level);
100 
102  boost::mutex mutex_;
103 
104  volatile uint8_t state_; // current driver state
105  volatile bool reconfiguring_; // true when reconfig() running
106 
107  ros::NodeHandle priv_nh_; // private node handle
108  ros::NodeHandle camera_nh_; // camera name space handle
109  ros::NodeHandle single_camera_nh_[NUM_CAMERAS]; // left/right camera name space handle
110  std::string camera_name_; // camera name
111 
114 
116  camera1394stereo::Camera1394StereoConfig config_;
117  dynamic_reconfigure::Server<camera1394stereo::Camera1394StereoConfig> srv_;
118  ros::Rate cycle_; // polling rate when closed
119 
122  bool calibration_matches_[NUM_CAMERAS]; // CameraInfo matches video mode
123 
126  image_transport::CameraPublisher image_pub_[NUM_CAMERAS];
127 
128 }; // end class Camera1394Driver
129 
130 }; // end namespace camera1394_driver
camera1394stereo::Camera1394StereoConfig Config
static const uint32_t RECONFIGURE_STOP
IEEE 1394 digital camera library interface.
boost::shared_ptr< camera1394stereo::Camera1394Stereo > dev_
camera1394stereo::Camera1394StereoConfig Config
camera1394stereo::Camera1394StereoConfig config_
dynamic_reconfigure::Server< camera1394stereo::Camera1394StereoConfig > srv_
static const uint32_t RECONFIGURE_CLOSE
static const uint32_t RECONFIGURE_RUNNING
boost::shared_ptr< image_transport::ImageTransport > it_


camera1394stereo
Author(s): Joan Pau Beltran
autogenerated on Mon Jun 10 2019 12:52:45