AIM
 All Classes Functions Variables Typedefs Enumerations
FallDetector Class Reference

#include <FallDetector.h>

Inheritance diagram for FallDetector:
AIM

Public Member Functions

 FallDetector (std::string name="fall")
 
void doTick ()
 
- 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 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 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
 
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< 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

FallDetector.h

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.

Constructor & Destructor Documentation

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.

Member Function Documentation

void FallDetector::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.

Member Data Documentation

const double FallDetector::G = 9.81F
static

Gravity

const int FallDetector::maxLastAccVecSumSize = 100
static

The amount of points to look back for the initial orientation

const std::string FallDetector::PROP_DEMO = "demo"
static

Property for using a demo fall, boolean

const std::string FallDetector::PROP_USE_INACTIVITY = "use inactivity"
static

Property for using inactivity, boolean

const double FallDetector::THRESH_ACT = 1.7 * G
static

Threshold for the activity

const double FallDetector::THRESH_FF = 0.4 * G
static

Threshold acceleration for a free fall

const double FallDetector::THRESH_INACT = 0.041*G
static

Threshold for inactivity, default was 0.1875F*G

const double FallDetector::THRESH_INITIAL = 0.7F * G
static

Threshold for the difference between the initial

const double FallDetector::TIME_ACT_INACT = 5
static

Time between an activity and inactivity

const double FallDetector::TIME_FF = 0.03
static

Time in msec of the free fall

const double FallDetector::TIME_FF_ACT = 0.2
static

Time between a free fall and activity (msec) 200msec was

const double FallDetector::TIME_FF_DEMO = 0.2
static

Time in msec of the free fall

const double FallDetector::TIME_FF_SEQUENCE = 0.1
static

Time in sec of the free fall

const double FallDetector::TIME_INACT = 2
static

Time of inactivity (msec)


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