Pages

August 10, 2013

PSI: System Architecture

In my first post, I presented the requirements and features I hope to include on PSI, my component-based system for robotics. In this post, I will show how I'm organizing the code and files. Here I'll present just an introduction to the architecture of the system and in next posts I'll show all the details of each part.

My first choice in architecture is to keep some global variables working as a registry for parts of the system, this kind of solution for communication among parts is very common in games and other complex systems, see this tutorial to see other perspective over registries. I keep these globals variables as interfaces to theirs respective packages, which are divided into 3 packages:
  • core: the core package stores: i) the component manager, which is a kind of list of components; ii) the components definition and properties; iii) other structures such map grids.
  • engine: the engine package is the interface to OpenGL, I'll keep all access to the graphic card into it, such the render batches, camera control and display control.
  • gui: this package stores the GUI system, with windows, widgets, and dialogs.
These packages are encapsulated into different folders, so that, I have the following directories:

    psi/
        core/
        engine/
        gui/
        resources/
        tools/

The resources folder stores the static resources of the project, such as images and icons, while tools folder is an auxiliary package with utilities for all other packages.

Back to the global variables, I choose to create a class App which will control all the system. The app global variable is the main object of the system is responsible for either control the system execution and acting as an interface among all packages, thus, the cited packages do not call directly each other. The classes Graphics, Manager, and MainWindow are the interface to the engine, core, and gui packages, respectively. I encapsulated these classes in different files and each one in its respectively folders. The current file structure of the project is as follow:

    psi/
        core/
            manager.py
            (...)
        engine/
            graphics.py
            (...)
        gui/
            main_window.py
            (...)

        app.py
        (...)

and the complete list of global variables is:

    app
    graphics
    window
    manager
    log

Notice the addition of log, this variable of class Log, is the interface to the debug, info, error, and warning messages. When the user clicks on the button to run the simulation, the app sends an info message to the log and it directs the message to the status bar, log files and/or any other kind of structure to receive these messages. And finally, the following figure shows the dependence among global variables:


This is the main points on the architecture. The next posts I will describe each package presented here in details.

No comments:

Post a Comment