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 CONVERTER_CAMERA_HPP
19 #define CONVERTER_CAMERA_HPP
20 
21 /*
22 * LOCAL includes
23 */
24 #include "converter_base.hpp"
26 
27 /*
28 * ROS includes
29 */
30 #include <image_transport/image_transport.h>
31 
32 namespace naoqi
33 {
34 namespace converter
35 {
36 
37 class CameraConverter : public BaseConverter<CameraConverter>
38 {
39 
40  typedef boost::function<void(sensor_msgs::ImagePtr, sensor_msgs::CameraInfo)> Callback_t;
41 
42 public:
43  CameraConverter( const std::string& name, const float& frequency, const qi::SessionPtr& session, const int& camera_source, const int& resolution );
44 
46 
47  void reset();
48 
49  void registerCallback( const message_actions::MessageAction action, Callback_t cb );
50 
51  void callAll( const std::vector<message_actions::MessageAction>& actions );
52 
53 private:
54  std::map<message_actions::MessageAction, Callback_t> callbacks_;
55 
57  qi::AnyObject p_video_;
61  std::string handle_;
62 
63  // string indicating image transport encoding
64  // goes along with colorspace_
65  std::string msg_colorspace_;
67  // msg frame id
68  std::string msg_frameid_;
69  sensor_msgs::CameraInfo camera_info_;
70  sensor_msgs::ImagePtr msg_;
71 };
72 
73 } //publisher
74 } //naoqi
75 
76 
77 #endif
std::string name() const
Definition: converter_base.hpp:54
float frequency() const
Definition: converter_base.hpp:59
Definition: camera.hpp:37
void callAll(const std::vector< message_actions::MessageAction > &actions)
Definition: camera.cpp:192
int resolution_
Definition: camera.hpp:59
MessageAction
Definition: message_actions.h:9
sensor_msgs::CameraInfo camera_info_
Definition: camera.hpp:69
Definition: audio.cpp:29
int camera_source_
Definition: camera.hpp:58
void reset()
Definition: camera.cpp:169
std::string msg_frameid_
Definition: camera.hpp:68
~CameraConverter()
Definition: camera.cpp:159
int colorspace_
Definition: camera.hpp:60
Definition: converter_base.hpp:40
int cv_mat_type_
Definition: camera.hpp:66
void registerCallback(const message_actions::MessageAction action, Callback_t cb)
Definition: camera.cpp:187
boost::function< void(sensor_msgs::ImagePtr, sensor_msgs::CameraInfo)> Callback_t
Definition: camera.hpp:40
qi::AnyObject p_video_
Definition: camera.hpp:57
CameraConverter(const std::string &name, const float &frequency, const qi::SessionPtr &session, const int &camera_source, const int &resolution)
Definition: camera.cpp:123
std::string msg_colorspace_
Definition: camera.hpp:65
std::map< message_actions::MessageAction, Callback_t > callbacks_
Definition: camera.hpp:54
std::string handle_
Definition: camera.hpp:61
sensor_msgs::ImagePtr msg_
Definition: camera.hpp:70