usb_cam.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * Software License Agreement (BSD License)
4  *
5  * Copyright (c) 2014, Robert Bosch LLC.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials provided
17  * with the distribution.
18  * * Neither the name of the Robert Bosch nor the names of its
19  * contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  *
35  *********************************************************************/
36 #ifndef USB_CAM_USB_CAM_H
37 #define USB_CAM_USB_CAM_H
38 
39 #include <ros/forwards.h>
40 #include "usb_cam/camera_driver.h"
41 
42 #include <ros/ros.h>
43 #include <sensor_msgs/Image.h>
46 #include <std_srvs/Empty.h>
47 #include <std_srvs/Trigger.h>
48 
49 namespace usb_cam
50 {
51 
53 {
54 private:
55  /* SINGLETON */
56  explicit UsbCam();
57  virtual ~UsbCam();
58  UsbCam(const UsbCam& root) = delete;
59  UsbCam operator=(const UsbCam& root) = delete;
60 protected:
61  static bool create_suspended;
62 
63  /* ROS */
67  static void frame_timer_callback(const ros::TimerEvent& event);
68 
69  /* Image stream publisher */
70  sensor_msgs::Image _img_msg; // img_
71  static sensor_msgs::Image* img_msg;
77 
78  /* Service servers */
79  std::string _service_start_name;
82  static bool service_start_callback(std_srvs::Empty::Request& request,
83  std_srvs::Empty::Response& response);
84  std::string _service_stop_name;
87  static bool service_stop_callback(std_srvs::Empty::Request& request,
88  std_srvs::Empty::Response& response);
91  static bool service_supported_formats_callback(std_srvs::Trigger::Request& request,
92  std_srvs::Trigger::Response& response);
95  static bool service_supported_controls_callback(std_srvs::Trigger::Request& request,
96  std_srvs::Trigger::Response& response);
97 
98  /* Node parameters */
99  static std::string camera_name;
100  static std::string camera_frame_id;
101  static std::string camera_transport_suffix;
102  static std::string camera_info_url;
103 
104 public:
105  static UsbCam& Instance();
106 };
107 
108 }
109 
110 #endif
111 
ros::ServiceServer _service_supported_formats
Definition: usb_cam.h:89
static image_transport::ImageTransport * image_transport
Definition: usb_cam.h:76
static bool service_supported_controls_callback(std_srvs::Trigger::Request &request, std_srvs::Trigger::Response &response)
Definition: usb_cam.cpp:101
ros::ServiceServer _service_supported_controls
Definition: usb_cam.h:93
ros::ServiceServer _service_stop
Definition: usb_cam.h:85
static ros::ServiceServer * service_supported_controls
Definition: usb_cam.h:94
static ros::ServiceServer * service_stop
Definition: usb_cam.h:86
UsbCam operator=(const UsbCam &root)=delete
std::string _service_stop_name
Definition: usb_cam.h:84
image_transport::CameraPublisher _image_pub
Definition: usb_cam.h:72
ros::ServiceServer _service_start
Definition: usb_cam.h:80
static sensor_msgs::Image * img_msg
Definition: usb_cam.h:71
virtual ~UsbCam()
Definition: usb_cam.cpp:312
static ros::ServiceServer * service_start
Definition: usb_cam.h:81
static camera_info_manager::CameraInfoManager * camera_info
Definition: usb_cam.h:74
ros::Timer _frame_timer
Definition: usb_cam.h:65
static bool service_start_callback(std_srvs::Empty::Request &request, std_srvs::Empty::Response &response)
Definition: usb_cam.cpp:68
static void frame_timer_callback(const ros::TimerEvent &event)
Definition: usb_cam.cpp:281
ros::NodeHandle node
Definition: usb_cam.h:64
static std::string camera_info_url
Definition: usb_cam.h:102
static bool service_supported_formats_callback(std_srvs::Trigger::Request &request, std_srvs::Trigger::Response &response)
Definition: usb_cam.cpp:78
static bool create_suspended
Definition: usb_cam.h:61
sensor_msgs::Image _img_msg
Definition: usb_cam.h:70
static ros::Timer * frame_timer
Definition: usb_cam.h:66
image_transport::ImageTransport _image_transport
Definition: usb_cam.h:75
static std::string camera_transport_suffix
Definition: usb_cam.h:101
std::string _service_start_name
Definition: usb_cam.h:79
static std::string camera_name
Definition: usb_cam.h:99
static UsbCam & Instance()
Definition: usb_cam.cpp:317
static image_transport::CameraPublisher * image_pub
Definition: usb_cam.h:73
static std::string camera_frame_id
Definition: usb_cam.h:100
static ros::ServiceServer * service_supported_formats
Definition: usb_cam.h:90
static bool service_stop_callback(std_srvs::Empty::Request &request, std_srvs::Empty::Response &response)
Definition: usb_cam.cpp:73


usb_cam
Author(s): Benjamin Pitzer
autogenerated on Sat May 27 2023 02:53:05