AIM
|
#include <GeoFencing.h>
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) | |
AIM & | operator= (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 AIM * | getDataSubscriber (std::string subscriber) |
virtual const std::map < std::string, AIMValue > & | getProperties () |
virtual std::string | getName () const |
virtual std::vector< AIMValue > | getRequirements () 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< AIMData > | AIMDataQueue |
typedef std::queue< AIMValue > | AIMValueQueue |
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< AIMValue > | requirements |
bool | requirementsUpdated |
std::map< std::string, AIM * > | dataSubscribers |
std::map< std::string, AIMValue > | properties |
InputDataQueue | inputDataQueue |
AIMDataQueue | outputDataQueue |
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
|
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.
|
virtual |
Set the module properties
Set the defined properties. Old property values will remain if no new values are specified for a property.
map | properties The properties to set |
Set the properties for this module and for each submodule
Reimplemented from AIM.
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.
string | key The key of the property |
AIMValue | value The value of the property |
Reimplemented from AIM.
|
static |
Property key for the goal position
|
static |
Property key for the out of range flag
|
static |
Property key for the range value