ACRIS Software Framework

Links

About

I wanted an object-oriented way to describe an environment of lights and control them based on some set of inputs. So, I designed a client-server kind of deal that allows a developer to design a set of plugins that control some network of lighting controller. Here's how it works.

Overall Architecture

The code is located in /sw/acris in the repo. The idea is that you (the designer) create controllers to describe the lights you've designed and plugins to modify the network of all of those lights. Then, you just need to run the server acris.py, which will load all of your plugins automatically. The interfaces directory has scripts for controlling the server.

Here's a diagram.

Architecture

So, clients connect to the ACRIS server. The server then selects one of many plugins that the developer writes. These plugins send output to a set of controllers that are attached to a serial network. The plugins can take input from external sources (e.g. music).

Example

I've included the code that I use in my lighting system (todo: I need to fork this so that there's a clean base for others to work off of). In the controllers, I specify the wallsconce controller. This controller inherits all the base controller functions and add functions for easily controlling the sconce.

So, after defining this controller type, we can use it in our plugins. To write a plugin, you first need to register it in plugins/__init__.py by including the name of the file (without the .py).

Next, you write a plugin file like the ones in the plugins/ directory. huecycle.py is a great reference. Basically, the plugin (which has the class name Plugin) inherits the base plugin, which defines some basic setup and run routines. Then, you need to override the __init__ and run methods. In __init__, you specify the environment. That is, you specify which controllers exist and what their addresses are. In my case, I have two controllers (one to the left and one to the right of me) so I instantiate the two. 1 is the address of the left one; 0 is the address of the right.

The run method contains the actual algorithm that you use to modify the LEDs. First, you run the base class's method and then you control your LED network however you like.

Demonstration

I haven't written any advanced plugins yet, but this video shows the overall architecture.