CConnectionManager.h
Go to the documentation of this file.
00001 /* +---------------------------------------------------------------------------+
00002          |                     Mobile Robot Programming Toolkit (MRPT)               |
00003          |                          http://www.mrpt.org/                             |
00004          |                                                                           |
00005          | Copyright (c) 2005-2016, Individual contributors, see AUTHORS file        |
00006          | See: http://www.mrpt.org/Authors - All rights reserved.                   |
00007          | Released under BSD License. See details in http://www.mrpt.org/License    |
00008          +---------------------------------------------------------------------------+ */
00009 
00010 #pragma once
00011 
00012 #include <ros/ros.h>
00013 #include <multimaster_msgs_fkie/DiscoverMasters.h>
00014 #include <mrpt_msgs/GraphSlamAgent.h>
00015 #include <mrpt_msgs/GraphSlamAgents.h>
00016 #include <mrpt_bridge/mrpt_bridge.h>
00017 
00018 #include <mrpt/utils/COutputLogger.h>
00019 #include <mrpt/system/datetime.h>
00020 #include <mrpt/system/os.h>
00021 #include <mrpt/system/string_utils.h>
00022 #include <mrpt/math/utils.h>
00023 
00024 #include <algorithm>
00025 #include <iterator>
00026 #include <iostream>
00027 #include <string>
00028 #include <vector>
00029 
00030 #include <cstdlib>
00031 
00032 namespace mrpt { namespace graphslam { namespace detail {
00033 
00037 class CConnectionManager
00038 {
00039 public:
00040         //typedef std::vector<mrpt_msgs::GraphSlamAgent>::iterator agents_it;
00041         //typedef std::vector<mrpt_msgs::GraphSlamAgent>::const_iterator agents_cit;
00042         typedef mrpt_msgs::GraphSlamAgents::_list_type::iterator agents_it;
00043         typedef mrpt_msgs::GraphSlamAgents::_list_type::const_iterator agents_cit;
00044 
00046         CConnectionManager(
00047                         mrpt::utils::COutputLogger* logger,
00048                         ros::NodeHandle* nh_in);
00050         ~CConnectionManager();
00060         void getNearbySlamAgents(mrpt_msgs::GraphSlamAgents* agents_vec,
00061                         bool ignore_self=true);
00064         const mrpt_msgs::GraphSlamAgents&  getNearbySlamAgents();
00069         const mrpt_msgs::GraphSlamAgents&  getNearbySlamAgentsCached() const;
00070 
00077         void setupComm();
00079         const std::string& getTrimmedNs() const;
00080 
00081 private:
00085         std::string own_ns;
00090         void updateNearbySlamAgents();
00098         void setupSubs();
00099         void setupPubs();
00100         void setupSrvs();
00114         static bool convert(
00115                         const multimaster_msgs_fkie::ROSMaster& ros_master,
00116                         mrpt_msgs::GraphSlamAgent* slam_agent);
00118         static void convert(
00119                         const mrpt_msgs::GraphSlamAgent& slam_agent,
00120                         multimaster_msgs_fkie::ROSMaster* ros_master);
00126         static std::string extractHostnameOrIP(const std::string& str,
00127                         unsigned short* agent_port=NULL);
00128 
00130         mrpt::utils::COutputLogger* m_logger;
00132         ros::NodeHandle* m_nh;
00133 
00134         ros::ServiceClient m_DiscoverMasters_client;
00140         mrpt_msgs::GraphSlamAgents m_nearby_slam_agents;
00141 
00142         bool has_setup_comm;
00143 
00144 };
00145 
00146 } } } // end of namespaces
00147 
00152 bool operator==(
00153                 const multimaster_msgs_fkie::ROSMaster& master1,
00154                 const multimaster_msgs_fkie::ROSMaster& master2);
00155 bool operator!=(
00156                 const multimaster_msgs_fkie::ROSMaster& master1,
00157                 const multimaster_msgs_fkie::ROSMaster& master2);
00164 bool operator==(
00165                 const mrpt_msgs::GraphSlamAgent& agent1,
00166                 const mrpt_msgs::GraphSlamAgent& agent2);
00167 bool operator!=(
00168                 const mrpt_msgs::GraphSlamAgent& agent1,
00169                 const mrpt_msgs::GraphSlamAgent& agent2);
00170 bool operator<(
00171                 const mrpt_msgs::GraphSlamAgent& agent1,
00172                 const mrpt_msgs::GraphSlamAgent& agent2);
00179 bool operator==(
00180                 const multimaster_msgs_fkie::ROSMaster& master,
00181                 const mrpt_msgs::GraphSlamAgent& agent);
00182 bool operator==(
00183                 const mrpt_msgs::GraphSlamAgent& agent,
00184                 const multimaster_msgs_fkie::ROSMaster& master);
00185 bool operator!=(
00186                 const multimaster_msgs_fkie::ROSMaster& master,
00187                 const mrpt_msgs::GraphSlamAgent& agent);
00188 bool operator!=(
00189                 const mrpt_msgs::GraphSlamAgent& agent,
00190                 const multimaster_msgs_fkie::ROSMaster& master);
00191 


mrpt_graphslam_2d
Author(s): Nikos Koukis
autogenerated on Thu Jun 6 2019 21:40:26