publishers/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 PUBLISHER_SONAR_HPP
19 #define PUBLISHER_SONAR_HPP
20 
21 /*
22 * ROS includes
23 */
24 #include <ros/ros.h>
25 #include <sensor_msgs/Range.h>
26 
27 namespace naoqi
28 {
29 namespace publisher
30 {
31 
33 {
34 public:
35  SonarPublisher( const std::vector<std::string>& topics );
36 
37  inline std::string topic() const
38  {
39  return "sonar";
40  }
41 
42  inline bool isInitialized() const
43  {
44  return is_initialized_;
45  }
46 
47  void publish( const std::vector<sensor_msgs::Range>& sonar_msgs );
48 
49  void reset( ros::NodeHandle& nh );
50 
51  inline bool isSubscribed() const
52  {
53  if (is_initialized_ == false) return false;
54  for(std::vector<ros::Publisher>::const_iterator it = pubs_.begin(); it != pubs_.end(); ++it)
55  if (it->getNumSubscribers())
56  return true;
57  return false;
58  }
59 
60 private:
61  std::vector<std::string> topics_;
62  std::vector<ros::Publisher> pubs_;
64 
65 };
66 
67 } //publisher
68 } //naoqi
69 
70 #endif
std::vector< ros::Publisher > pubs_
void reset(ros::NodeHandle &nh)
SonarPublisher(const std::vector< std::string > &topics)
void publish(const std::vector< sensor_msgs::Range > &sonar_msgs)
std::vector< std::string > topics_


naoqi_driver
Author(s): Karsten Knese
autogenerated on Sat Feb 15 2020 03:24:26