robot_info.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017, <copyright holder> <email>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * * Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * * Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * * Neither the name of the <organization> nor the
13  * names of its contributors may be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY <copyright holder> <email> ''AS IS'' AND ANY
17  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19  * DISCLAIMED. IN NO EVENT SHALL <copyright holder> <email> BE LIABLE FOR ANY
20  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  */
28 
29 #ifndef TUW_MULTI_ROBOT_ROBOT_ROUTER_INFO_H
30 #define TUW_MULTI_ROBOT_ROBOT_ROUTER_INFO_H
31 
32 //ROS
33 #include <ros/ros.h>
34 #include <tuw_multi_robot_msgs/RobotGoalsArray.h>
35 #include <tuw_multi_robot_msgs/RobotGoals.h>
36 #include <tuw_multi_robot_msgs/RobotInfo.h>
37 #include <nav_msgs/Odometry.h>
38 #include <tuw_multi_robot_msgs/Graph.h>
39 #include <nav_msgs/Path.h>
40 #include <nav_msgs/OccupancyGrid.h>
41 #include <tuw_multi_robot_msgs/RouterStatus.h>
42 #include <dynamic_reconfigure/server.h>
43 #include <tuw_multi_robot_router/routerConfig.h>
44 
47 #include <opencv/cv.hpp>
48 
49 //TODO disable got_map if not used
50 
51 namespace multi_robot_router
52 {
53 class RobotInfo : public tuw_multi_robot_msgs::RobotInfo
54 {
55 public:
57  : tuw_multi_robot_msgs::RobotInfo()
58  , online_(Online::inactive)
59  , activeTime_(1.0)
60  {
61  }
62  RobotInfo (const tuw_multi_robot_msgs::RobotInfo& o)
63  : tuw_multi_robot_msgs::RobotInfo(o)
64  , online_(Online::inactive)
65  , activeTime_(1.0)
66  {
67  }
68  RobotInfo (const std::string &name)
69  : tuw_multi_robot_msgs::RobotInfo()
70  , online_(Online::inactive)
71  , activeTime_(1.0)
72  {
73  robot_name = name;
74  }
75  enum class Online
76  {
77  inactive,
78  active,
79  fixed
80  };
81 
82  void updateInfo(const tuw_multi_robot_msgs::RobotInfo &info);
83 
89  void initTopics(ros::NodeHandle &n);
90 
91  Online getOnlineStatus() const;
92  void updateOnlineStatus ( const float updateTime );
93 
99  float radius() const;
100 
101  Eigen::Vector3d getPose() const;
106  static size_t findIdx(const std::vector<std::shared_ptr<RobotInfo> > &data, const std::string &name);
111  static std::vector<std::shared_ptr<RobotInfo> >::iterator findObj(std::vector<std::shared_ptr<RobotInfo> > &data, const std::string &name);
112 
113  bool compareName(const std::shared_ptr<RobotInfo> data) const;
114 
118  void callback_odom ( const nav_msgs::Odometry &msg);
119  private:
121  float activeTime_;
122 };
123 typedef std::shared_ptr<RobotInfo> RobotInfoPtr;
124 typedef std::vector<std::shared_ptr<RobotInfo> >::iterator RobotInfoPtrIterator;
125 
126 } // namespace multi_robot_router
127 #endif // TUW_MULTI_ROBOT_ROBOT_ROUTER_INFO_H
static std::vector< std::shared_ptr< RobotInfo > >::iterator findObj(std::vector< std::shared_ptr< RobotInfo > > &data, const std::string &name)
Definition: robot_info.cpp:84
void updateOnlineStatus(const float updateTime)
Definition: robot_info.cpp:110
Eigen::Vector3d getPose() const
Definition: robot_info.cpp:90
static size_t findIdx(const std::vector< std::shared_ptr< RobotInfo > > &data, const std::string &name)
Definition: robot_info.cpp:77
std::vector< std::shared_ptr< RobotInfo > >::iterator RobotInfoPtrIterator
Definition: robot_info.h:124
Online getOnlineStatus() const
Definition: robot_info.cpp:106
RobotInfo(const tuw_multi_robot_msgs::RobotInfo &o)
Definition: robot_info.h:62
bool compareName(const std::shared_ptr< RobotInfo > data) const
Definition: robot_info.cpp:49
void callback_odom(const nav_msgs::Odometry &msg)
Definition: robot_info.cpp:45
std::shared_ptr< RobotInfo > RobotInfoPtr
Definition: robot_info.h:123
void initTopics(ros::NodeHandle &n)
Definition: robot_info.cpp:55
RobotInfo(const std::string &name)
Definition: robot_info.h:68
void updateInfo(const tuw_multi_robot_msgs::RobotInfo &info)
Definition: robot_info.cpp:72


tuw_multi_robot_router
Author(s): Benjamin Binder
autogenerated on Mon Jun 10 2019 15:42:49