sonar.hpp
Go to the documentation of this file.
00001 /*
00002  * Copyright 2015 Aldebaran
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  *
00016 */
00017 
00018 #ifndef PUBLISHER_SONAR_HPP
00019 #define PUBLISHER_SONAR_HPP
00020 
00021 /*
00022 * ROS includes
00023 */
00024 #include <ros/ros.h>
00025 #include <sensor_msgs/Range.h>
00026 
00027 namespace naoqi
00028 {
00029 namespace publisher
00030 {
00031 
00032 class SonarPublisher
00033 {
00034 public:
00035   SonarPublisher( const std::vector<std::string>& topics );
00036 
00037   inline std::string topic() const
00038   {
00039     return "sonar";
00040   }
00041 
00042   inline bool isInitialized() const
00043   {
00044     return is_initialized_;
00045   }
00046 
00047   void publish( const std::vector<sensor_msgs::Range>& sonar_msgs );
00048 
00049   void reset( ros::NodeHandle& nh );
00050 
00051   inline bool isSubscribed() const
00052   {
00053     if (is_initialized_ == false) return false;
00054     for(std::vector<ros::Publisher>::const_iterator it = pubs_.begin(); it != pubs_.end(); ++it)
00055       if (it->getNumSubscribers())
00056         return true;
00057     return false;
00058   }
00059 
00060 private:
00061   std::vector<std::string> topics_;
00062   std::vector<ros::Publisher> pubs_;
00063   bool is_initialized_;
00064 
00065 };
00066 
00067 } //publisher
00068 } //naoqi
00069 
00070 #endif


naoqi_driver
Author(s): Karsten Knese
autogenerated on Tue Jul 9 2019 03:21:56