GAMS  1.4.0
gams::algorithms::Greet Class Reference

An algorithm for greeting a target if it comes within range and potentially following the target around. More...

#include <Greet.h>

Inheritance diagram for gams::algorithms::Greet:
gams::algorithms::BaseAlgorithm

Public Member Functions

 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. More...
 
 ~Greet ()
 Destructor. More...
 
virtual int analyze (void)
 Analyzes environment, platform, or other information. More...
 
virtual int execute (void)
 Plans the next execution of the algorithm. More...
 
variables::Agentsget_agents (void)
 Gets the list of agents. More...
 
variables::AlgorithmStatusget_algorithm_status (void)
 Gets algorithm status variables. More...
 
madara::knowledge::KnowledgeBase * get_knowledge_base (void)
 Gets the knowledge base. More...
 
platforms::BasePlatformget_platform (void)
 Gets the platform. More...
 
variables::Selfget_self (void)
 Gets self-defined variables. More...
 
variables::Sensorsget_sensors (void)
 Gets the available sensor information. More...
 
void operator= (const Greet &rhs)
 Assignment operator. More...
 
virtual int plan (void)
 Plans the next execution of the algorithm. More...
 
virtual void set_agents (variables::Agents *agents)
 Sets the list of agents in the swarm. More...
 
virtual void set_platform (platforms::BasePlatform *platform)
 Sets the platform. More...
 
virtual void set_self (variables::Self *self)
 Sets the map of sensor names to sensor information. More...
 
virtual void set_sensors (variables::Sensors *sensors)
 Sets the map of sensor names to sensor information. More...
 

Protected Attributes

variables::Agentsagents_
 the list of agents potentially participating in the algorithm More...
 
unsigned int executions_
 number of executions More...
 
bool follow_ = false
 if true, indicates to follow targets that enter guard area More...
 
std::unique_ptr< groups::GroupBasefollow_group_ = 0
 a group of agents following to watch More...
 
std::string follow_group_name_ = "group.{.target}.followers"
 name of the group that is following target More...
 
std::string follow_group_prefix_
 the group name prefix before {.target} More...
 
std::string follow_group_suffix_
 the group name suffix after {.target} More...
 
int follow_max_agents_ = 2
 maximum number of agents that should follow a target More...
 
double follow_max_distance_ = 1000
 maximum follow distance from guard location More...
 
groups::GroupFactoryRepository group_factory_
 
pose::Epsilon guard_epsilon_
 the distance from guard location (max of dimensions) More...
 
std::unique_ptr< groups::GroupBaseguard_group_ = 0
 a group of agents guarding More...
 
pose::Position guard_location_
 the location for the agent to guard More...
 
double guard_max_follow_distance_ = -1
 maximum distance a guard can be displaced from guard location before it returns to its guard area (prevents infinite follow) More...
 
pose::Position home_location_
 the home location to return to if not guarding or following More...
 
bool is_following_ = false
 indicates whether or not the agent is following a target More...
 
bool is_guarding_ = false
 indicates whether or not the agent is moving to guard More...
 
madara::knowledge::KnowledgeBase * knowledge_
 provides access to the knowledge base More...
 
platforms::BasePlatformplatform_
 provides access to the platform More...
 
variables::Selfself_
 the algorithm's concept of self More...
 
variables::Sensorssensors_
 provides access to sensor information More...
 
variables::AlgorithmStatus status_
 provides access to status information for this platform More...
 
variables::Agent target_
 location of agent to follow More...
 
std::unique_ptr< groups::GroupBasetarget_group_ = 0
 a group of targets to watch More...
 
bool use_agent_home_ = true
 if no custom home location is specified, use the agent's home More...
 

Detailed Description

An algorithm for greeting a target if it comes within range and potentially following the target around.

Definition at line 48 of file Greet.h.

Constructor & Destructor Documentation

◆ Greet()

gams::algorithms::Greet::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.

Parameters
targetfull agent name the agent should follow
target_groupgroup name for agents in the target group
guard_distancedistance in meters to guard from guard guard location
guard_locationlocation to consider guard territory for this agent
guard_max_follow_distancedistance that a guard can reach from its guard location before it returns back to its area. During following, this can prevent infinite following. -1 means do not rubberband but follow indefinitely
home_locationlocation to perch or home at if not guarding or following
followif true, follow up to follow_max_agents in the specified follow group
follow_groupgroup name for agents following a target. This is a special group name that will allow expansion if you use the .target variable in the name. By default this, variable is group.{.target}.follow, which would expand to something like: group.agent.0.follow for agents following agent.0
follow_max_agentsmaximum agents to follow a target at any instantaneous time
knowledgethe context containing variables and values
platformthe underlying platform the algorithm will use
sensorsmap of sensor names to sensor information
selfself-referencing variables

◆ ~Greet()

gams::algorithms::Greet::~Greet ( )

Destructor.

Member Function Documentation

◆ analyze()

virtual int gams::algorithms::Greet::analyze ( void  )
virtual

Analyzes environment, platform, or other information.

Returns
bitmask status of the platform.
See also
Status.

Implements gams::algorithms::BaseAlgorithm.

◆ execute()

virtual int gams::algorithms::Greet::execute ( void  )
virtual

Plans the next execution of the algorithm.

Returns
bitmask status of the platform.
See also
Status.

Implements gams::algorithms::BaseAlgorithm.

◆ get_agents()

variables::Agents* gams::algorithms::BaseAlgorithm::get_agents ( void  )
inherited

Gets the list of agents.

◆ get_algorithm_status()

variables::AlgorithmStatus* gams::algorithms::BaseAlgorithm::get_algorithm_status ( void  )
inherited

Gets algorithm status variables.

◆ get_knowledge_base()

madara::knowledge::KnowledgeBase* gams::algorithms::BaseAlgorithm::get_knowledge_base ( void  )
inherited

Gets the knowledge base.

◆ get_platform()

platforms::BasePlatform* gams::algorithms::BaseAlgorithm::get_platform ( void  )
inherited

Gets the platform.

◆ get_self()

variables::Self* gams::algorithms::BaseAlgorithm::get_self ( void  )
inherited

Gets self-defined variables.

◆ get_sensors()

variables::Sensors* gams::algorithms::BaseAlgorithm::get_sensors ( void  )
inherited

Gets the available sensor information.

◆ operator=()

void gams::algorithms::Greet::operator= ( const Greet rhs)

Assignment operator.

Parameters
rhsvalues to copy

◆ plan()

virtual int gams::algorithms::Greet::plan ( void  )
virtual

Plans the next execution of the algorithm.

Returns
bitmask status of the platform.
See also
Status.

Implements gams::algorithms::BaseAlgorithm.

◆ set_agents()

virtual void gams::algorithms::BaseAlgorithm::set_agents ( variables::Agents agents)
virtualinherited

Sets the list of agents in the swarm.

Parameters
agentslist of agents

◆ set_platform()

virtual void gams::algorithms::BaseAlgorithm::set_platform ( platforms::BasePlatform platform)
virtualinherited

Sets the platform.

Parameters
platformthe underlying platform the algorithm will use

◆ set_self()

virtual void gams::algorithms::BaseAlgorithm::set_self ( variables::Self self)
virtualinherited

Sets the map of sensor names to sensor information.

Parameters
selfpointer to self-referencing variables container

◆ set_sensors()

virtual void gams::algorithms::BaseAlgorithm::set_sensors ( variables::Sensors sensors)
virtualinherited

Sets the map of sensor names to sensor information.

Parameters
sensorsmap of sensor names to sensor information

Member Data Documentation

◆ agents_

variables::Agents* gams::algorithms::BaseAlgorithm::agents_
protectedinherited

the list of agents potentially participating in the algorithm

Definition at line 201 of file BaseAlgorithm.h.

◆ executions_

unsigned int gams::algorithms::BaseAlgorithm::executions_
protectedinherited

number of executions

Definition at line 204 of file BaseAlgorithm.h.

◆ follow_

bool gams::algorithms::Greet::follow_ = false
protected

if true, indicates to follow targets that enter guard area

Definition at line 134 of file Greet.h.

◆ follow_group_

std::unique_ptr<groups::GroupBase> gams::algorithms::Greet::follow_group_ = 0
protected

a group of agents following to watch

Definition at line 137 of file Greet.h.

◆ follow_group_name_

std::string gams::algorithms::Greet::follow_group_name_ = "group.{.target}.followers"
protected

name of the group that is following target

Definition at line 140 of file Greet.h.

◆ follow_group_prefix_

std::string gams::algorithms::Greet::follow_group_prefix_
protected

the group name prefix before {.target}

Definition at line 143 of file Greet.h.

◆ follow_group_suffix_

std::string gams::algorithms::Greet::follow_group_suffix_
protected

the group name suffix after {.target}

Definition at line 146 of file Greet.h.

◆ follow_max_agents_

int gams::algorithms::Greet::follow_max_agents_ = 2
protected

maximum number of agents that should follow a target

Definition at line 149 of file Greet.h.

◆ follow_max_distance_

double gams::algorithms::Greet::follow_max_distance_ = 1000
protected

maximum follow distance from guard location

Definition at line 152 of file Greet.h.

◆ group_factory_

groups::GroupFactoryRepository gams::algorithms::Greet::group_factory_
protected

Definition at line 168 of file Greet.h.

◆ guard_epsilon_

pose::Epsilon gams::algorithms::Greet::guard_epsilon_
protected

the distance from guard location (max of dimensions)

Definition at line 159 of file Greet.h.

◆ guard_group_

std::unique_ptr<groups::GroupBase> gams::algorithms::Greet::guard_group_ = 0
protected

a group of agents guarding

Definition at line 162 of file Greet.h.

◆ guard_location_

pose::Position gams::algorithms::Greet::guard_location_
protected

the location for the agent to guard

Definition at line 165 of file Greet.h.

◆ guard_max_follow_distance_

double gams::algorithms::Greet::guard_max_follow_distance_ = -1
protected

maximum distance a guard can be displaced from guard location before it returns to its guard area (prevents infinite follow)

Definition at line 156 of file Greet.h.

◆ home_location_

pose::Position gams::algorithms::Greet::home_location_
protected

the home location to return to if not guarding or following

Definition at line 171 of file Greet.h.

◆ is_following_

bool gams::algorithms::Greet::is_following_ = false
protected

indicates whether or not the agent is following a target

Definition at line 174 of file Greet.h.

◆ is_guarding_

bool gams::algorithms::Greet::is_guarding_ = false
protected

indicates whether or not the agent is moving to guard

Definition at line 177 of file Greet.h.

◆ knowledge_

madara::knowledge::KnowledgeBase* gams::algorithms::BaseAlgorithm::knowledge_
protectedinherited

provides access to the knowledge base

Definition at line 207 of file BaseAlgorithm.h.

◆ platform_

platforms::BasePlatform* gams::algorithms::BaseAlgorithm::platform_
protectedinherited

provides access to the platform

Definition at line 210 of file BaseAlgorithm.h.

◆ self_

variables::Self* gams::algorithms::BaseAlgorithm::self_
protectedinherited

the algorithm's concept of self

Definition at line 213 of file BaseAlgorithm.h.

◆ sensors_

variables::Sensors* gams::algorithms::BaseAlgorithm::sensors_
protectedinherited

provides access to sensor information

Definition at line 216 of file BaseAlgorithm.h.

◆ status_

variables::AlgorithmStatus gams::algorithms::BaseAlgorithm::status_
protectedinherited

provides access to status information for this platform

Definition at line 219 of file BaseAlgorithm.h.

◆ target_

variables::Agent gams::algorithms::Greet::target_
protected

location of agent to follow

Definition at line 128 of file Greet.h.

◆ target_group_

std::unique_ptr<groups::GroupBase> gams::algorithms::Greet::target_group_ = 0
protected

a group of targets to watch

Definition at line 131 of file Greet.h.

◆ use_agent_home_

bool gams::algorithms::Greet::use_agent_home_ = true
protected

if no custom home location is specified, use the agent's home

Definition at line 180 of file Greet.h.


The documentation for this class was generated from the following file: