GithubHelp home page GithubHelp logo

ak15199 / rop Goto Github PK

View Code? Open in Web Editor NEW
18.0 6.0 6.0 687 KB

ROP is a simple and extensible framework to display a set of art demos on an LED array (such as FadeCandy) or in ASCII Art on a terminal, and includes a 2D drawing primitive implementation.

License: GNU General Public License v3.0

Python 97.71% HTML 2.29%
art fadecandy leds animation raspberry-pi opc

rop's Introduction

Introduction

This project is designed to generate a number of distinctive animations on a grid of LEDs via OPC, to a FadeCandy board.

Here's a test picture of the plasma art running on a physical array:

example

If you want a quick sample of what ROP can do in a terminal, you can follow this link to Asciinema:

asciicast

Installation

The code has been run on OSX with Python 2.7 and Python 3.6. There are a few extras you'll need before you can start. Typically you'd run something like:

# pip3 install -r requirements.txt

Or maybe - if you prefer - you'd install in a virtualenv. On the off-chance that the installation gets a hiccup:

  • numpy is pretty well documented and you should be able to figure it out. Some distros have a natively installable package to use instead of the pip equivalent. If you do install but get poor performance, then it may be that there are some ancillary packages missing which numpy relies on for optimum performance. Again, the numpy docs are pretty good.

  • Either Pillow or it's predecessor PIL should work just fine, although the former is preferred.

Getting Started

To get started and display on your terminal, make sure that the terminal is at least 35x35 and run:

% python3 art.py

You can also pick a specific subset to render by listing the particular modules in the art directory, for example:

% python3 art.py rain.py fortune.py

Be aware that the down-sampled image when displaying to the terminal is super lossy, since it's reducing 24 bit color to a handful of ascii-art characters... although if your tty has a 256 color mode, then things will look quite a bit better than 16 colors.

If you want higher quality output and can run against a physical LED display, then update config.py to suit your display configuration, and start the OPC service as appropriate.

The config.py file contains tunable parameters relating to the display, such as geometry, as well as configuration options specific to the individual art files.

Most textual logging is delivered to art.log. If something doesn't look right, then check in this file for exceptions and other diagnostics.

It's also possible to limit number of cycles that art.py runs through, adjust the duration that each art is displayed before moving on to the next, or to switch on profiling. Run with --help for more information.

The directories are:

.                  application directory
./art              contains classes for each of the animations.
                   You'll notice a template.py file for the bare
                   bones
./art/utils        helper modules shared between animations
./art/baseclasses  base classes that animations may derive from
./assets           files that are used by the animations
./config.py        various configuration options
./opc              an extended interface for using OPC via python
./opc/utils        various utilities used by the framework

To help get up to speed on the library, you can use pydoc. For example:

% pydoc opc.matrix

Check out the existing animations for use as examples, and please commit back code that you create!

Other People's Work

The opc code is taken from the copy embedded in FadeCandy. If you're not already familiar, go check out FadeCandy for more background on the project.

Hopefully attributions are correct. If you see one missing, then please let me know and I'll fix.

Contributing

There aren't any formal guidelines for contributing. If you'd like to submit a pull request for review, or open an issue, though, then that's awesome.

rop's People

Contributors

ak15199 avatar e4r7hbug avatar mbbx6spp avatar tgerdes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

rop's Issues

Problem with non square arrays and some arts.

Some art have problems with non-square buffers. I'm not sure if this is an issue in buffer, DiamondSquare, or terrian specifically, but here's a trace for you:

This is with a 25x50 pixel array ( https://github.com/zestyping/openpixelcontrol/blob/master/layouts/wall.json )

ERROR:root:Exception: Traceback (most recent call last):
ERROR:root:Exception:   File "art.py", line 159, in <module>
    main()
ERROR:root:Exception:   File "art.py", line 149, in main
    run(arts, args)
ERROR:root:Exception:   File "/Users/tgerdes/rop/opc/utils/prof.py", line 105, in f_timer
    return f(*args, **kwargs)
ERROR:root:Exception:   File "art.py", line 69, in run
    art.refresh(matrix)
ERROR:root:Exception:   File "/Users/tgerdes/rop/art/terrain.py", line 66, in refresh
    matrix.copy(self.matrix, x, y)
ERROR:root:Exception:   File "/Users/tgerdes/rop/opc/utils/prof.py", line 105, in f_timer
    return f(*args, **kwargs)
ERROR:root:Exception:   File "/Users/tgerdes/rop/opc/matrix.py", line 139, in copy
    self.buf.panCopy(source.buf, x, y)
ERROR:root:Exception:   File "/Users/tgerdes/rop/opc/utils/prof.py", line 105, in f_timer
    return f(*args, **kwargs)
ERROR:root:Exception:   File "/Users/tgerdes/rop/opc/buffer.py", line 114, in panCopy
    self.buf[:][:] = window
ERROR:root:Exception: ValueError: could not broadcast input array from shape (26,50,3) into shape (25,50,3)

terminal too small throws a silent exception

Opening up a new terminal window in iTerm2 defaults (for me) to 80x25. When I run art.py in that window the program immediately exits without any feedback. Looking at at art.log

ERROR:root:Exception: Traceback (most recent call last):
ERROR:root:Exception: File "art.py", line 50, in
main()
ERROR:root:Exception: File "art.py", line 46, in main
matrix.show()
ERROR:root:Exception: File "/Users/bkuo/work/rop/opc/matrix.py", line 212, in show
self.ansi.show(pixels)
ERROR:root:Exception: File "/Users/bkuo/work/rop/opc/ansiclient.py", line 149, in show
stdscr.addstr(" | \n")
ERROR:root:Exception: error: addstr() returned ERR

The terminal window needs to be a bit bigger so it can display. Let's get a better error message to the user.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.