subsuMeLib - A Subsumption Architecture library
001
subsuMeLib is a subsumption architecture library written in C++ using free version of QT by Trolltech
It makes implementing a subsumption architecture very easy.
Simply include the static library in you project and include "subsuMeLib.h" in your source files.
subsuMeLib.lib
subsuMeLib.tar.gz
Simply include all the source files in your project and include "subsuMeLib.h" in your project source files.
A subsumption architecture consists of several subsumption modules which are Augmented
Finite State Machines (AFSM's), running concurrently.
Using this library, creating a subsumption architecture follows the process:
-
Instantiate a RobotControl object to manage all your subsumption modules.
-
Create subsumption modules (AFSM's)
-
Define wiring
-
Add inputs and outputs
-
Create connections
-
Add modules to the RobotControl object
-
Start the modules
-
Easily debug your system using the display
This is the container class for your AFSM's.
It is a template class which requires a user defined robot interface object.
This allows the user to create an interface specific to their robot. This is then
used as a template to create a RobotInterface object which is passed to RobotControl.
e.g.
romaIntPtr = new RomaRobotInterface(cmbComPort->currentItem()); // Roma (my robot) interface
robotInterfacePtr = new RobotInterface<RomaRobotInterface>(romaIntPtr); // generic interface
robotControlPtr = new RobotControl<RomaRobotInterface>(robotInterfacePtr); // robot control class, contains the subsumption architecture
Each module in your subsumption architecture should be a class that inherits the SubsMod base class.
This is then wrapped by separate threads or virtual threads, defined by the user, using member functions of RobotControl. See section 4: Add Modules
The user must override the pure virtual function step(), which will be run by RobotControl repetitively (to simulate concurrency). The data member STATE is used to record the current state of the AFSM, and a switch statement is useful for determining what action is appropriate.
Connections are created by: adding output registers to modules, each of which represents a wire, and connecting those wires as inputs to other modules through module inputs.
It is also possible to creating connections between wires, where the output of a connection is another wire. As well as create wires that do not originate from a module.
The inputs and outputs can be set and read respectively from within a module using the functions:
SubsMod::getInputReg(), and SubsMod::setOutputReg()
Inputs and Outputs of modules are added with the simple function calls:
SubsMod::addOutput() and SubsMod::addInput()
As inputs and outputs are identified by integers, it is a good idea to use enumerations defined in a header, so that the they can be referred to symbolically.
Wires can be connected to eachother with the class Connection. Just instantiate a Connection object with the desired construction.
A connection is a type of output register, so is seen by other modules as a 'wire'.
A connections can be of type 'suppress' or 'inhibit', and has a 'time constant' to the length of time that the suppression or inhibition will be active.
It is also possible to use the ExtraReg class to create wires that do not originate from a module. Just instantiate an ExraReg object with the desired construction.
The modules are added as separate threads, or as virtual threads using:
RobotControl::addModAsThread(), and RobotControl::addModAsVirtualThread()
Once added, the memory they use will be properly deallocated automatically.
If they are not added to RobotControl, then their memory must be deallocated by the user.
The modules will only start running after starting them explicitly using:
RobotControl::startThreads(), or RobotControl::startVirtualThreads()
To add a separate display for a module, use the functions:
RobotControl::addToDisplay(), and SubsMod::createDisp()
for example: sModMve->createDisp(0, "Move");
where sModMve is a pointer an AFSM
the 0 indicates that this is to be separate.
To create one window with several displays:
robotControlPtr->addToDisplay(sModMve, "Move");
where robotControlPtr is a pointer to a RobotControl object
Then you can simply add text to the display by using the functions:
SubsMod::display(char* str), and SubsMod::displaySet(char* str)
to append and set the text given by str, respectively.
Generated on Wed Nov 10 17:52:34 2004 for SubsuMe by
1.3.8