naoqidriver
sonar.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 SONAR_CONVERTER_HPP
19 #define SONAR_CONVERTER_HPP
20 
21 /*
22 * LOCAL includes
23 */
24 #include "converter_base.hpp"
26 
27 /*
28 * ROS includes
29 */
30 #include <sensor_msgs/Range.h>
31 
32 namespace naoqi
33 {
34 namespace converter
35 {
36 
37 class SonarConverter : public BaseConverter<SonarConverter>
38 {
39 
40  typedef boost::function<void(std::vector<sensor_msgs::Range>&)> Callback_t;
41 
42 
43 public:
44  SonarConverter( const std::string& name, const float& frequency, const qi::SessionPtr& session );
45 
47 
48  void reset( );
49 
51 
52  void callAll( const std::vector<message_actions::MessageAction>& actions );
53 
54 
55 private:
56  std::map<message_actions::MessageAction, Callback_t> callbacks_;
57 
59  qi::AnyObject p_sonar_;
61  qi::AnyObject p_memory_;
64 
66  std::vector<std::string> keys_;
68  std::vector<std::string> frames_;
70  std::vector<sensor_msgs::Range> msgs_;
71 };
72 
73 } //publisher
74 } //naoqi
75 
76 #endif
std::string name() const
Definition: converter_base.hpp:54
qi::AnyObject p_sonar_
Definition: sonar.hpp:59
float frequency() const
Definition: converter_base.hpp:59
qi::AnyObject p_memory_
Definition: sonar.hpp:61
MessageAction
Definition: message_actions.h:9
SonarConverter(const std::string &name, const float &frequency, const qi::SessionPtr &session)
Definition: sonar.cpp:35
std::vector< std::string > frames_
Definition: sonar.hpp:68
void registerCallback(message_actions::MessageAction action, Callback_t cb)
Definition: sonar.cpp:84
Definition: audio.cpp:29
bool is_subscribed_
Definition: sonar.hpp:63
~SonarConverter()
Definition: sonar.cpp:75
boost::function< void(std::vector< sensor_msgs::Range > &)> Callback_t
Definition: sonar.hpp:40
void callAll(const std::vector< message_actions::MessageAction > &actions)
Definition: sonar.cpp:89
void reset()
Definition: sonar.cpp:118
Definition: converter_base.hpp:40
std::vector< std::string > keys_
Definition: sonar.hpp:66
Definition: sonar.hpp:37
std::map< message_actions::MessageAction, Callback_t > callbacks_
Definition: sonar.hpp:56
std::vector< sensor_msgs::Range > msgs_
Definition: sonar.hpp:70