Author: Philipp Allgeuer
Version: 1.2.2
Date: 21/11/14
The State Controller Library is a generic platform-independent C++ framework that allows finite state machines and multi-action planning generalisations thereof to be realised. The structure and implementation of this library focuses on the application of finite state machines to real-time control loops, but can be reasonably adapted for virtually any other application, even completely unrelated to control systems. An emphasis has been placed on having very low overhead so as not to hurt overall system performance no matter where this library is used, while still maintaining ease of use. Code size has also been kept to a minimum.
Aside from implementing standard finite state machines and multi-action planning state machines, this library can also be used to implement hierarchical state controllers, or any hybrid of the three. Please refer to the extensive documentation for more information.
This library is implemented as a collection of platform-independent C++ source files. To get started (if you haven't done so already) download the latest ZIP of the library from the SourceForge page, and extract it to the desired location on your computer.
There are three ways of using the library:
1. Directly include the (non-test) source files in your project, and build them with the rest of your project.
2. Build a static library (e.g. *.a
or *.lib
) of the source code and link your project to it.
3. Build a dynamic library (e.g. *.so
or *.dll
) of the source code and link your project to it.
Due to the small and efficient nature of the library, one of the first two options is recommended. Very minimal benefit is expected over the other two options when choosing to build it as a dynamic library.
Note that as at release v1.2.2
, the required (non-test) source files are simply state_controller.h
and state_controller.cpp
.
A sample makefile for building the static and dynamic libraries using gcc
is included in the release. The makefile also demonstrates how the test_state_controller
unit test can be built. As mentioned in the makefile however, the State Controller Library could equivalently be built using any other compiler, such as for example MSVC.
This library depends on the following external libraries (to avoid requiring C++11):
- Boost Smart Ptr
- Boost Static Assert
- Boost Type Traits
For more information, or to download the Boost Libraries, please refer to http://www.boost.org/.
A unit test for the library (test_state_controller
) is included in the release. It is not required to build this executable in order to use the library - it is for demonstration and testing purposes only. The unit test has one additional dependency, namely the Google Test Framework.
The first place to look for help and guidance when trying to use the State Controller Library is the Doxygen documentation. This can be found in the library ZIP archive under:
State Controller Library vX.X.X/doc/State Controller Library.html
Or equivalently:
State Controller Library vX.X.X/doc/out/html/index.html
The Doxygen documentation provides a complete explanation of the entire framework, including all caveats and details, and includes code samples to make the task of learning the framework a lot easier. Complete documentation of all functions, classes and namespaces of the library is also included. As such, the Doxygen documentation is intended to be the primary help resource when working with the library.
If anything is not adequately explained in the Doxygen documentation, or more details as to the inner workings of the library are required, the next place to look would be in the library source code. The code is well-commented and should be fairly self-explanatory. A good starting point is state_controller.h
. A look inside the source code for test_state_controller
should also shed some light on how the library is intended to be used.
If neither the Doxygen documentation nor a look into the source code can resolve your issues for whatever reason, you can contact the author at the email address given in the Bugs and Improvements section.
I welcome all feedback, suggestions and bug reports. If you improve or fix anything about the library then I encourage you to let the author know so that the library can be improved for everyone!
Email: pallgeuer[at]ais.uni-bonn.de
The screenshots below show the output of the test_state_controller
unit test that comes with the library. This should give you a brief idea of what the State Controller Library is about.