Main Page | Class Hierarchy | Class List | Class Members

SubsMod Class Reference

AFSM : Augmented Finite State Machine core. More...

#include <subsBlocks.h>

List of all members.

Public Member Functions

 SubsMod (const char &pSTATE=0, const char &pPREV_STATE=0)
virtual void step (void)=0
int addInput (OutReg *, char *name=0)
 Connect an output to this module.
int addOutput (const char *outName=0, const float &startVal=0)
 add an output register to the module
OutReggetOutRegPtr (const int &)
 Retrieve a pointer to an output register in this SubsMod.
bool setOutputReg (const int &, const float &)
 Set the value of an output register.
bool getInputReg (const int &, float *)
 get the value of an input 'virtual' register
TextDisplaycreateDisp (QWidget *parent=0, char *name=0)
 create a textView widget to display text during running
void display (char *str)
 append display text
void displaySet (char *str)
 set display text
void display (const QString &)
 append display text
void displaySet (const QString &)
 set display text

Public Attributes

std::vector< VirtualInputRegvInputs
std::vector< OutRegvOutputs

Protected Attributes

char PREVIOUS_STATE


Detailed Description

AFSM : Augmented Finite State Machine core.

This is the core for each AFSM, or subsumption module. SubsMod is a base class which is inherited by a user defined class. This is then wrapped by separate threads or virtual threads, defined by the user, using member functions of RobotControl. The user must override the pure virtual function SubsMod::step(), which will be run by RobotControl repetitively (to simulate concurrency). The data member SubsMod::STATE is used to record the current state of the AFSM, and a switch statement is useful for determining what action is appropriate.


Constructor & Destructor Documentation

SubsMod::SubsMod const char &  pSTATE = 0,
const char &  pPREV_STATE = 0
[inline, explicit]
 

Parameters:
pSTATE initial state of module, default to 0
pPREV_STATE initial 'previous state' of module, default to 0


Member Function Documentation

int SubsMod::addInput OutReg pOutRegPtr,
char *  name = 0
 

Connect an output to this module.

Can be a new input, or can suppress/inhibit an existing input. /*!

Parameters:
pOutRegPtr pointer to the output register (from a connection or other module), to be connected to this input
name a string label for this 'input'
Returns:
the input register number (may be a new one). returns -1 if the output register does not exist, and was unable to connect

int SubsMod::addOutput const char *  outName = 0,
const float &  startVal = 0
 

add an output register to the module

Parameters:
outName a string label for this output.
startVal the starting value for this output
Returns:
int with output number, -1 with unsuccessful.

TextDisplay * SubsMod::createDisp QWidget *  parent = 0,
char *  name = 0
 

create a textView widget to display text during running

Parameters:
parent default is zero. if set otherwise, then the textView widget will be contained in parent.
name a string label to be displayed above the text.
Returns:
a pointer to the TextDisplay widget

void SubsMod::display const QString &  str  ) 
 

append display text

Parameters:
str pointer to the string to be displayed
Returns:
void

void SubsMod::display char *  str  ) 
 

append display text

Parameters:
str pointer to the string to be displayed
Returns:
void

void SubsMod::displaySet const QString &  str  ) 
 

set display text

Parameters:
str pointer to the string to be displayed
Returns:
void

void SubsMod::displaySet char *  str  ) 
 

set display text

Parameters:
str pointer to the string to be displayed
Returns:
void

bool SubsMod::getInputReg const int &  inNum,
float *  retValuePtr
 

get the value of an input 'virtual' register

Parameters:
inNum number of the input register
retValuePtr a pointer to a float that is to be set by this function with the value of the input register
Returns:
indicate success or failure. will fail if the input register does not exist

OutReg * SubsMod::getOutRegPtr const int &  outNum  ) 
 

Retrieve a pointer to an output register in this SubsMod.

Parameters:
outNum the output number
Returns:
a pointer to the output register, zero if none exists for that outNum

bool SubsMod::setOutputReg const int &  outNum,
const float &  value
 

Set the value of an output register.

Parameters:
outNum number of the output register
value the value to assign to this output register
Returns:
indicate success or failure. will fail if the output register does not exist

virtual void SubsMod::step void   )  [pure virtual]
 

pure virtual function that must be defined by the user in the inherited class, which is a subsumption module


Member Data Documentation

char SubsMod::PREVIOUS_STATE [protected]
 

the state of the finite state machine

std::vector< VirtualInputReg > SubsMod::vInputs
 

vector of inputs: each one is a vector of input lines

std::vector< OutReg > SubsMod::vOutputs
 

vector of output registers


The documentation for this class was generated from the following files:
Generated on Wed Nov 10 17:52:35 2004 for SubsuMe by doxygen 1.3.8