GECKO 1.0
Human-computer interface based on hand gesture recognition
Public Member Functions | Private Attributes
StateMachine Class Reference

Simple state machine for value tracking and event recognition. More...

#include <StateMachine.h>

List of all members.

Public Member Functions

 StateMachine (int value_to_track, unsigned int min_positive_matches, unsigned int max_negative_matches)
 StateMachine constructor.
void update (int current_value)
 Update the state of the state machine according to the current value passed to it.
void reset ()
 Reset the state of the state machine ( 0 positive matches and 0 negative matches )
int getValue_to_track () const
 Returns the current value set to track.
void setValue_to_track (const int &value)
 Changes the current value to track.
float getPercentageMatches ()
 Returns the current number of positive matches as a percentage.
bool getFound ()
 Gets the current state of the state machine.

Private Attributes

int value_to_track
 Value to track.
unsigned int min_positive_matches
 Minimum number of positive matches needed to consider a value found.
unsigned int current_positive_matches
 Current number of positive matches.
unsigned int max_negative_matches
 Maximum number of negative matches needed to reset the state/counter.
unsigned int current_negative_matches
 Current number of negative matches.
bool found
 State of the state machine, true if current number of positive matches is equal that the minimum needed.

Detailed Description

Simple state machine for value tracking and event recognition.

It has internally two counters, one counts the number of positive matches with the value to track, and the other the number of consecutive negative matches.

If the number of consecutive negative matches is equal to the maximum value allowed, it resets the positive matches counter. If the the number of positive matches equals the minimum value of positive matches needed, it sets the found variable true, until it is reseted (either by the user or by the arrival of negative matches).


The documentation for this class was generated from the following files:
 All Classes Functions Variables