AIM
 All Classes Functions Variables Typedefs Enumerations
GeoFencing Class Reference

#include <GeoFencing.h>

Inheritance diagram for GeoFencing:
AIM

Public Member Functions

 GeoFencing (std::string name="geo_fencing")
 
void doTick ()
 
void addData (AIMData data)
 
AIMValue setProperty (const std::string &key, AIMValue value)
 
void setProperties (const std::map< std::string, AIMValue > &properties)
 
- Public Member Functions inherited from AIM
 AIM (std::string name="")
 
 AIM (const AIM &other)
 
AIMoperator= (const AIM &rhs)
 
virtual void addDataSubscriber (const std::string &key, AIM *subscriber)
 
virtual void removeDataSubscriber (const std::string &key)
 
virtual AIMValue getProperty (std::string key) const
 
virtual void sendData ()
 
virtual void addData (const AIMData &data)
 
virtual std::string exportProperties ()
 
virtual std::vector< std::pair
< std::string, AIMValue > > 
getOutputData (bool clear_output=false)
 
virtual std::vector< std::pair
< std::string, AIMValue > > 
getInputData (bool clear_input=false)
 
virtual AIMgetDataSubscriber (std::string subscriber)
 
virtual const std::map
< std::string, AIMValue > & 
getProperties ()
 
virtual std::string getName () const
 
virtual std::vector< AIMValuegetRequirements () const
 
virtual bool requirementsAreUpdated (bool reset=true) const
 

Static Public Attributes

static const std::string PROP_GOAL_POSITION = "goal position"
 
static const std::string PROP_RANGE = "range"
 
static const std::string PROP_OUT_OF_RANGE = "out of range"
 
- Static Public Attributes inherited from AIM
static const std::string VERSION = AIM_VERSION
 

Additional Inherited Members

- Public Types inherited from AIM
typedef std::pair< std::string,
AIMValue
AIMData
 
typedef std::queue< AIMDataAIMDataQueue
 
typedef std::queue< AIMValueAIMValueQueue
 
typedef std::map< std::string,
AIMValueQueue
InputDataQueue
 
- Protected Member Functions inherited from AIM
void setDataSubscribers (const std::map< std::string, AIM * > &subscribers)
 
void setInputDataQueue (const InputDataQueue &inputDataQueue)
 
void setOutputDataQueue (const AIMDataQueue &outputDataQueue)
 
- Protected Attributes inherited from AIM
std::string name
 
std::vector< AIMValuerequirements
 
bool requirementsUpdated
 
std::map< std::string, AIM * > dataSubscribers
 
std::map< std::string, AIMValueproperties
 
InputDataQueue inputDataQueue
 
AIMDataQueue outputDataQueue
 

Detailed Description

GeoFencing.h

Created on: Feb 27, 2013 Author: Ted Schmidt

This GeoFencing module calculates the distance from an incoming latitude, longitude point
to a predefined latitude, longitude position in meters. If the distance is larger then
a predefined range then this module will send an out of range message, it will send an in range
message when position data comes in that lies within the range.
This module will only send output data if there is a change in the value out/in range
This module expects position data input with the following AIMValue structure
{"position":{"latitude", 4.112345, "longitude", 53.322134, "accuracy":100}}
Where position is the AIMData key.
To set the position to compute the distance from property key PROP_GOAL_POSITION should be used with latitude longitude data
{"goal position":{"latitude", 4.112345, "longitude", 53.321134}}
To set the fence, the range in meters from the goal position can b set with the property key PROP_RANGE {"range": 100.10}}
This modules returns a map value with the following data
{"GeoFencing" :{"latitude":4.112345, "longitude":53.321134, "accuracy":100, "out of range": 1, "distance from fence": 10, "distance from goal":110}}
double "latitude" - current position latitude point
double "longitude" - current position longitude point
int "accuracy" - position accuracy
bool "out of range" - is true when the current position is out of the predefined range, false if it is with the range
double "distance from fence" - the distance calculated from the fence to the current position
double "distance from goal" - the distance calculated from the goal to the current position

Member Function Documentation

void GeoFencing::doTick ( )
virtual

Do an AIM tick

This method is called to tick the AI-module to do its processing. During this tick the AI module grabs it's input data, does its processing, and sends the data to its data receivers. This method can be used in combination with AIM priorities, to streamline the data flow and timers for timed AI modules.

Reimplemented from AIM.

void GeoFencing::setProperties ( const std::map< std::string, AIMValue > &  properties)
virtual

Set the module properties

Set the defined properties. Old property values will remain if no new values are specified for a property.

Parameters
mapproperties The properties to set

Set the properties for this module and for each submodule

Reimplemented from AIM.

AIMValue GeoFencing::setProperty ( const std::string &  key,
AIMValue  value 
)
virtual

Set property

This method sets the value of a property. An AIMValue response value is returned and it can have the type EMPTY if no response data is present.

Parameters
stringkey The key of the property
AIMValuevalue The value of the property
Returns
AIMValue An optional response value.

Reimplemented from AIM.

Member Data Documentation

const std::string GeoFencing::PROP_GOAL_POSITION = "goal position"
static

Property key for the goal position

const std::string GeoFencing::PROP_OUT_OF_RANGE = "out of range"
static

Property key for the out of range flag

const std::string GeoFencing::PROP_RANGE = "range"
static

Property key for the range value


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