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 
52 class UsbCam: public AbstractV4LUSBCam
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 */
66  static ros::Timer* frame_timer;
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 
usb_cam::UsbCam::service_stop_callback
static bool service_stop_callback(std_srvs::Empty::Request &request, std_srvs::Empty::Response &response)
Definition: usb_cam.cpp:73
forwards.h
usb_cam::UsbCam::create_suspended
static bool create_suspended
Definition: usb_cam.h:129
usb_cam::UsbCam::_service_supported_controls
ros::ServiceServer _service_supported_controls
Definition: usb_cam.h:161
usb_cam::UsbCam::camera_info_url
static std::string camera_info_url
Definition: usb_cam.h:170
usb_cam::UsbCam::service_supported_formats_callback
static bool service_supported_formats_callback(std_srvs::Trigger::Request &request, std_srvs::Trigger::Response &response)
Definition: usb_cam.cpp:78
image_transport::ImageTransport
usb_cam::UsbCam::UsbCam
UsbCam()
Definition: usb_cam.cpp:116
usb_cam
Definition: camera_driver.h:35
ros.h
camera_info_manager.h
usb_cam::UsbCam::frame_timer
static ros::Timer * frame_timer
Definition: usb_cam.h:134
usb_cam::UsbCam::camera_frame_id
static std::string camera_frame_id
Definition: usb_cam.h:168
ros::ServiceServer
usb_cam::UsbCam::service_start
static ros::ServiceServer * service_start
Definition: usb_cam.h:149
usb_cam::UsbCam::_service_stop
ros::ServiceServer _service_stop
Definition: usb_cam.h:153
usb_cam::UsbCam::_service_start_name
std::string _service_start_name
Definition: usb_cam.h:147
usb_cam::UsbCam::img_msg
static sensor_msgs::Image * img_msg
Definition: usb_cam.h:139
usb_cam::UsbCam::_service_stop_name
std::string _service_stop_name
Definition: usb_cam.h:152
usb_cam::UsbCam::service_supported_formats
static ros::ServiceServer * service_supported_formats
Definition: usb_cam.h:158
usb_cam::UsbCam::Instance
static UsbCam & Instance()
Definition: usb_cam.cpp:317
usb_cam::UsbCam::~UsbCam
virtual ~UsbCam()
Definition: usb_cam.cpp:312
camera_info_manager::CameraInfoManager
image_transport::CameraPublisher
usb_cam::UsbCam::node
ros::NodeHandle node
Definition: usb_cam.h:132
usb_cam::UsbCam::service_supported_controls_callback
static bool service_supported_controls_callback(std_srvs::Trigger::Request &request, std_srvs::Trigger::Response &response)
Definition: usb_cam.cpp:101
camera_driver.h
ros::TimerEvent
image_transport.h
usb_cam::UsbCam::image_transport
static image_transport::ImageTransport * image_transport
Definition: usb_cam.h:144
usb_cam::UsbCam
Definition: usb_cam.h:86
usb_cam::UsbCam::_image_transport
image_transport::ImageTransport _image_transport
Definition: usb_cam.h:143
usb_cam::UsbCam::_img_msg
sensor_msgs::Image _img_msg
Definition: usb_cam.h:138
usb_cam::UsbCam::service_supported_controls
static ros::ServiceServer * service_supported_controls
Definition: usb_cam.h:162
usb_cam::UsbCam::image_pub
static image_transport::CameraPublisher * image_pub
Definition: usb_cam.h:141
usb_cam::UsbCam::_image_pub
image_transport::CameraPublisher _image_pub
Definition: usb_cam.h:140
usb_cam::UsbCam::camera_name
static std::string camera_name
Definition: usb_cam.h:167
usb_cam::UsbCam::camera_transport_suffix
static std::string camera_transport_suffix
Definition: usb_cam.h:169
usb_cam::UsbCam::operator=
UsbCam operator=(const UsbCam &root)=delete
usb_cam::UsbCam::service_start_callback
static bool service_start_callback(std_srvs::Empty::Request &request, std_srvs::Empty::Response &response)
Definition: usb_cam.cpp:68
usb_cam::UsbCam::camera_info
static camera_info_manager::CameraInfoManager * camera_info
Definition: usb_cam.h:142
usb_cam::UsbCam::service_stop
static ros::ServiceServer * service_stop
Definition: usb_cam.h:154
ros::Timer
usb_cam::UsbCam::_service_start
ros::ServiceServer _service_start
Definition: usb_cam.h:148
usb_cam::UsbCam::_service_supported_formats
ros::ServiceServer _service_supported_formats
Definition: usb_cam.h:157
usb_cam::UsbCam::_frame_timer
ros::Timer _frame_timer
Definition: usb_cam.h:133
ros::NodeHandle
usb_cam::UsbCam::frame_timer_callback
static void frame_timer_callback(const ros::TimerEvent &event)
Definition: usb_cam.cpp:281


usb_cam
Author(s): Benjamin Pitzer
autogenerated on Sun Sep 3 2023 02:44:54