AIM
|
#include <FallDetector.h>
Public Member Functions | |
FallDetector (std::string name="fall") | |
void | doTick () |
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 | setProperty (const std::string &key, AIMValue value) |
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 |
virtual void | setProperties (const std::map< std::string, AIMValue > &properties) |
Static Public Attributes | |
static const double | G = 9.81F |
static const double | THRESH_FF = 0.4 * G |
static const double | TIME_FF = 0.03 |
static const double | TIME_FF_SEQUENCE = 0.1 |
static const double | TIME_FF_DEMO = 0.2 |
static const double | THRESH_ACT = 1.7 * G |
static const double | TIME_FF_ACT = 0.2 |
static const double | THRESH_INACT = 0.041*G |
static const double | TIME_INACT = 2 |
static const double | TIME_ACT_INACT = 5 |
static const double | THRESH_INITIAL = 0.7F * G |
static const std::string | PROP_DEMO = "demo" |
static const std::string | PROP_USE_INACTIVITY = "use inactivity" |
static const int | maxLastAccVecSumSize = 100 |
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: April 9, 2013 Author: Ted Schmidt
This module implements a human fall detector which is based on the fall detection algorithm proposed at:
http://www.ecnmag.com/Articles/2009/12/human-fall-detection/
The fall is detected using four stages: free fall, impact, orientation change and inactivity.
As input it expects accelerometer data at 50Hz.
The format for AIMData AIMvalue is:
{"value":{"x-axis":0.9,"y-axis":9.81, "z-axis":0.9}, "date":1366876517.21}
The module returns {"value":{"fall":1}, "date":1366876517.12} when a fall has been detected
The FallDetector can run in two modes, a demo mode and a normal mode.
In the demo mode a fall is triggered when the device has a free fall of 200ms.
In the normal mode a fall is detected using the earlier mentioned four stages methods.
The demo mode boolean can be set by using the property key PROP_DEMO
For detecting a human fall with only the free fall and impact the property with key PROP_USE_INACTIVITY can be set to false.
FallDetector::FallDetector | ( | std::string | name = "fall" | ) |
FallDetector Constructor
By default the demo mode is off and it uses the check for inactivity after an impact.
|
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.
|
static |
Gravity
|
static |
The amount of points to look back for the initial orientation
|
static |
Property for using a demo fall, boolean
|
static |
Property for using inactivity, boolean
|
static |
Threshold for the activity
|
static |
Threshold acceleration for a free fall
|
static |
Threshold for inactivity, default was 0.1875F*G
|
static |
Threshold for the difference between the initial
|
static |
Time between an activity and inactivity
|
static |
Time in msec of the free fall
|
static |
Time between a free fall and activity (msec) 200msec was
|
static |
Time in msec of the free fall
|
static |
Time in sec of the free fall
|
static |
Time of inactivity (msec)