GAMS  1.4.0
Greet.h
Go to the documentation of this file.
1 
25 #ifndef _GAMS_ALGORITHMS_GREET_H_
26 #define _GAMS_ALGORITHMS_GREET_H_
27 
28 #include <memory>
29 
31 #include "gams/variables/Sensor.h"
34 #include "gams/variables/Self.h"
37 #include "gams/groups/GroupBase.h"
39 
40 namespace gams
41 {
42  namespace algorithms
43  {
49  {
50  public:
84  const std::string & target, const std::string & target_group,
85  double guard_distance,
86  const std::string & guard_group,
87  const std::vector<double> & guard_location,
88  double guard_max_follow_distance,
89  const std::vector<double> & home_location,
90  bool follow, const std::string & follow_group,
91  int follow_max_agents,
92  madara::knowledge::KnowledgeBase * knowledge = 0,
93  platforms::BasePlatform * platform = 0,
94  variables::Sensors * sensors = 0,
95  variables::Self * self = 0);
96 
101 
106  void operator=(const Greet & rhs);
107 
112  virtual int analyze(void);
113 
118  virtual int execute(void);
119 
124  virtual int plan(void);
125 
126  protected:
129 
131  std::unique_ptr<groups::GroupBase> target_group_ = 0;
132 
134  bool follow_ = false;
135 
137  std::unique_ptr<groups::GroupBase> follow_group_ = 0;
138 
140  std::string follow_group_name_ = "group.{.target}.followers";
141 
143  std::string follow_group_prefix_;
144 
146  std::string follow_group_suffix_;
147 
149  int follow_max_agents_ = 2;
150 
152  double follow_max_distance_ = 1000;
153 
156  double guard_max_follow_distance_ = -1;
157 
160 
162  std::unique_ptr<groups::GroupBase> guard_group_ = 0;
163 
166 
167  // factory for interacting with user-defined groups
169 
172 
174  bool is_following_ = false;
175 
177  bool is_guarding_ = false;
178 
180  bool use_agent_home_ = true;
181  };
182 
187  {
188  public:
189 
206  const madara::knowledge::KnowledgeMap & args,
207  madara::knowledge::KnowledgeBase * knowledge,
208  platforms::BasePlatform * platform,
209  variables::Sensors * sensors,
210  variables::Self * self,
211  variables::Agents * agents);
212  };
213  }
214 }
215 
216 #endif // _GAMS_ALGORITHMS_GREET_H_
Copyright(c) 2014 Carnegie Mellon University.
Copyright(c) 2014 Carnegie Mellon University.
Copyright(c) 2014 Carnegie Mellon University.
#define GAMS_EXPORT
Definition: GamsExport.h:20
Copyright(c) 2016 Carnegie Mellon University.
Copyright(c) 2016 Carnegie Mellon University.
Copyright(c) 2014 Carnegie Mellon University.
Copyright(c) 2014 Carnegie Mellon University.
Base class for algorithm factories that classes derived from.
The base class that algorithms in GAMS use.
Definition: BaseAlgorithm.h:95
A factory class for creating Greet Algorithms.
Definition: Greet.h:187
virtual BaseAlgorithm * create(const madara::knowledge::KnowledgeMap &args, madara::knowledge::KnowledgeBase *knowledge, platforms::BasePlatform *platform, variables::Sensors *sensors, variables::Self *self, variables::Agents *agents)
Creates a Greet Algorithm.
An algorithm for greeting a target if it comes within range and potentially following the target arou...
Definition: Greet.h:49
void operator=(const Greet &rhs)
Assignment operator.
pose::Position guard_location_
the location for the agent to guard
Definition: Greet.h:165
variables::Agent target_
location of agent to follow
Definition: Greet.h:128
std::string follow_group_prefix_
the group name prefix before {.target}
Definition: Greet.h:143
pose::Epsilon guard_epsilon_
the distance from guard location (max of dimensions)
Definition: Greet.h:159
virtual int analyze(void)
Analyzes environment, platform, or other information.
std::string follow_group_suffix_
the group name suffix after {.target}
Definition: Greet.h:146
pose::Position home_location_
the home location to return to if not guarding or following
Definition: Greet.h:171
virtual int execute(void)
Plans the next execution of the algorithm.
Greet(const std::string &target, const std::string &target_group, double guard_distance, const std::string &guard_group, const std::vector< double > &guard_location, double guard_max_follow_distance, const std::vector< double > &home_location, bool follow, const std::string &follow_group, int follow_max_agents, madara::knowledge::KnowledgeBase *knowledge=0, platforms::BasePlatform *platform=0, variables::Sensors *sensors=0, variables::Self *self=0)
Constructor.
virtual int plan(void)
Plans the next execution of the algorithm.
groups::GroupFactoryRepository group_factory_
Definition: Greet.h:168
A repository for group factories.
The base platform for all platforms to use.
Definition: BasePlatform.h:113
A simple bounds checker which tests whether the current position is within the given number of meters...
Definition: Epsilon.h:101
A container for agent information.
Definition: Agent.h:80
A container for self referencing information.
Definition: Self.h:70
std::map< std::string, Sensor * > Sensors
a map of sensor names to the sensor information
Definition: Sensor.h:238
std::vector< Agent > Agents
An array of agent knowledge.
Definition: Agent.h:246
Contains all GAMS-related tools, classes and code.
Copyright (c) 2015 Carnegie Mellon University.