ola icon indicating copy to clipboard operation
ola copied to clipboard

feature request: "higher" level python API

Open cavoknosig opened this issue 12 years ago • 8 comments

first of all, congratulations on the efforts working on the direct / low-level raspberry pi UART output!

related to this, it would be great if OLA offered a "higher level" python API to be used for typical applications. this is what i mean: in our new build house, half of the lighting is going to be controlled via DMX and through a raspi, triggered by commands sent through ethernet (from a central control, and/or button interface).

the individual lights are either a single channel (LED - Spots) or 3- or 4-channel (RGB /RGBW LED-Strips) groups. typical applications are color fades and dims in the RGB spectrum, instant on-off, or softstart/off. as the current python API, the way i understand it, "only" allows low-level access to dmx frames, none of this can be taken over by OLA yet and has to be implemented individually. for smooth operation it would almost have to be a multihreaded/server type setup, exactly what OLA is, so new commands can be received during fades, and fades on each group run independently of other groups. command input would be either directly through udp or http rest, or then as a more open option through a python api (as the title suggests) essentially giving the target brightness / color and how to get there, either step/immediate or smoothly. the python script would then only have to take care of translating the network commands into the proper OLA actions. would be great if that could be added to OLA.

cavoknosig avatar May 03 '14 10:05 cavoknosig

Higher level control would be great. Do you have a proposed mechanism for determining the channels from fixtures or are you basicly wanting a programmatic version of a console? On May 3, 2014 6:55 AM, "cavoknosig" [email protected] wrote:

first of all, congratulations on the efforts working on the direct / low-level raspberry pi UART output!

related to this, it would be great if OLA offered a "higher level" python API to be used for typical applications. this is what i mean: in our new build house, half of the lighting is going to be controlled via DMX and through a raspi, triggered by commands sent through ethernet (from a central control, and/or button interface).

the individual lights are either a single channel (LED - Spots) or 3- or 4-channel (RGB /RGBW LED-Strips) groups. typical applications are color fades and dims in the RGB spectrum, instant on-off, or softstart/off. as the current python API, the way i understand it, "only" allows low-level access to dmx frames, none of this can be taken over by OLA yet and has to be implemented individually. for smooth operation it would almost have to be a multihreaded/server type setup, exactly what OLA is, so new commands can be received during fades, and fades on each group run independently of other groups. command input would be either through udp or http rest, essentially giving the target brightness / color and how to get there, either step/immediate or smoothly. would be great if that could be added to OLA.

— Reply to this email directly or view it on GitHubhttps://github.com/OpenLightingProject/ola/issues/388 .

nightrune avatar May 03 '14 11:05 nightrune

a programmatic version of the console would certainly be a great start.

it would be great if typical architectural lighting "realtime" stuff / dynamic fades could be offloaded to ola. so that it handles e.g. three slow transitions that were previously triggered on 3 channels (color) while a new command for a quick fade from 0 to a value x on another channel can be processed. without requiring constant network traffic/processing in the control software to come up with intermediate values in high succession. ola would take care of processing the current dmx frame contionously while the inputs trigger a "target frame" by modifying channel target values. and interactive / flexible in that, if there is a new command contradicting a transition already in progress, say it's halfway trough the fade-in and the new command requests a fade back to 0, ola should smoothly reverse the fade when requested.

sought for functions would be:

  • set channel x to value y.
  • toggle channel x on/off (keep previous positive "on" value in memory and revert to when toggling, with instant change, default on value 255)
  • toggle fade channel x on/off (over time y in ms, optional) (keep previous positive "on" value in memory and revert to when toggling, but with a softstart/off, default on value 255, default fade over 1000ms
  • (mathematical) fade channel x from present value to value y over time z in ms

whether you needed to group channels from fixtures already is debatable, that would be even higher level and could even include some more color-space type stuff, something all the led software/hardware is quite lacking at the moment (true color wheel/pallette type calculations and dimming and not just 0-255 direct value interpolation/fades) noone seems to do color calculations/presets in a user friendly way (and pleasing to the eye). it's either very technical and much left to the operator or simple interpolation. there would even be an opportunity for "themeing" / default styles of different transitions. e.g. "romantic pink" or "cool blue", i know, i'm getting far ahead ;-) normally you would then want to group 3 channels to one colorspace RGB. sample functions then would be:

  • fade channelgroup X to value RGB (in r,g,b or hex #html format) over time z in ms (most direct way on the rgb color wheel)
  • contionous loop channelgroup X in direction Y (left or right around the color wheel) over time z in ms
  • dim channelgroup X to value 0-255 (affecting all channels in parallel)

and really advanced:

  • fade channelgoup X to value RGB via values RGB1, RGB2, RGB3... over time z in ms (most direct way on the rgb color wheel)
  • contionous loop channelgroup X via values RGB1, RGB2, RGB3... over time z in ms
  • choose linear or logarithmic fades on dimming channels or come up with an individual 0%-100% calibration that can be set per channel and then the dimming commands would be in percent.

that would more than cover most needs. further functions i could imagine would be some type of interval blinking (christmas lights / led feedback type stuff)

all of this would make the life of the command/control head easier and nothing is better suited than ola to make the smoothest / finest transitions.

cavoknosig avatar May 03 '14 13:05 cavoknosig

I think @nightrune means a full lighting console, well the core of it. What console do you mean @cavoknosig?

It strikes me this probably wants to be a separate bit of code in python or C++ or whatever that uses the OLA API, i.e. an OLA client. As there will be a lot of people who won't want that functionality, so won't want it to risk affecting their show. But when that second core is written, you could either plumb into it via it's APIs (HTTP/UDP as you suggested) or stick a third layer on top that's more of a lighting desk and understands fixtures (RGB groups etc).

peternewman avatar May 03 '14 16:05 peternewman

olad is the wrong place for this. Generation of the DMX data should be done by the clients rather than the core daemon.

I don't have any interest in writing a console, but I'm happy to setup a new repo for a higher level Python API if you'd like to contribute.

nomis52 avatar May 03 '14 18:05 nomis52

What Simon proposed is exactly what I was thinking. Ola and Olad are built for transport and that's it. We'll likely support merging and patching data later on but olad itself will not do generation.

Past that, we'd love to have a project like this stick around and grow. On May 3, 2014 2:15 PM, "Simon Newton" [email protected] wrote:

olad is the wrong place for this. Generation of the DMX data should be done by the clients rather than the core daemon.

I don't have any interest in writing a console, but I'm happy to setup a new repo for a higher level Python API if you'd like to contribute.

— Reply to this email directly or view it on GitHubhttps://github.com/OpenLightingProject/ola/issues/388#issuecomment-42112340 .

nightrune avatar May 03 '14 18:05 nightrune

i certainly would love to contribute. however i'm mostly a visual basic / asp / php guy and only recently got into linux, python etc... mainly due to the raspis. also busy building the house right now, requiring setting priorities. building such a project from scratch, let alone one to be published ;-) is beyond my experience level unfortunately...

cavoknosig avatar May 03 '14 21:05 cavoknosig

New to OLA and aware this is off-topic but I have google'd and not yet found - are there OLA clients out there? Would be keen to contribute to appropriate python code - you c/++ guys are well above my pay grade(!)

cmd08 avatar May 08 '14 21:05 cmd08

We do have a python api supplied with dev and source. On May 8, 2014 5:52 PM, "Chris Darby" [email protected] wrote:

New to OLA and aware this is off-topic but I have google'd and not yet found - are there OLA clients out there? Would be keen to contribute to appropriate python code - you c/++ guys are well above my pay grade(!)

— Reply to this email directly or view it on GitHubhttps://github.com/OpenLightingProject/ola/issues/388#issuecomment-42611067 .

nightrune avatar May 08 '14 23:05 nightrune