naoqidriver
camera.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2015 Aldebaran
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef PUBLISHER_CAMERA_HPP
19 #define PUBLISHER_CAMERA_HPP
20 
21 /*
22 * ROS includes
23 */
24 #include <ros/ros.h>
25 #include <image_transport/image_transport.h>
26 
27 namespace naoqi
28 {
29 namespace publisher
30 {
31 
33 {
34 public:
35  CameraPublisher( const std::string& topic, int camera_source );
36 
38 
39  inline std::string topic() const
40  {
41  return topic_;
42  }
43 
44  inline bool isInitialized() const
45  {
46  return is_initialized_;
47  }
48 
49  void publish( const sensor_msgs::ImagePtr& img, const sensor_msgs::CameraInfo& camera_info );
50 
51  void reset( ros::NodeHandle& nh );
52 
53  inline bool isSubscribed() const
54  {
55  if (is_initialized_ == false) return false;
56  return pub_.getNumSubscribers() > 0;
57  }
58 
59 private:
60  std::string topic_;
61 
63 
64  //image_transport::ImageTransport it_;
65  image_transport::CameraPublisher pub_;
66 
68 };
69 
70 } //publisher
71 } //naoqi
72 
73 
74 #endif
void publish(const sensor_msgs::ImagePtr &img, const sensor_msgs::CameraInfo &camera_info)
Definition: camera.cpp:44
~CameraPublisher()
Definition: camera.cpp:40
Definition: audio.cpp:29
bool isInitialized() const
Definition: camera.hpp:44
image_transport::CameraPublisher pub_
Definition: camera.hpp:65
bool is_initialized_
Definition: camera.hpp:62
void reset(ros::NodeHandle &nh)
Definition: camera.cpp:49
bool isSubscribed() const
Definition: camera.hpp:53
Definition: camera.hpp:32
std::string topic() const
Definition: camera.hpp:39
CameraPublisher(const std::string &topic, int camera_source)
Definition: camera.cpp:33
int camera_source_
Definition: camera.hpp:67
std::string topic_
Definition: camera.hpp:60