Personal tools
The Open Lighting Project has moved!

We've launched our new site at www.openlighting.org. This wiki will remain and be updated with more technical information.

OLA DMX Trigger

From wiki.openlighting.org

Revision as of 20:29, 23 December 2011 by Nomis52 (talk | contribs) (Created page with "ola_trigger executes programs based on the values of DMX data. This allows a lighting console to trigger events like music samples, power point presentations etc. ola_trigger su…")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

ola_trigger executes programs based on the values of DMX data. This allows a lighting console to trigger events like music samples, power point presentations etc. ola_trigger supports variable assignment, which offers a flexible way to control the behavior of the

Usage

Once olad is running, you can run ola_trigger as shown:

ola_trigger example.conf

Some useful options include:

  • -l, --log-level <level> Change the logging level, valid values are 0 (minimum logging) to 4 (full logs).
  • -u, --universe <universe> Specifies the universe to use.

Config File Syntax

The config file defines which commands are to be run. The config file is separated into two sections: default variable assignment and action definitions.

Slot Actions

Slot actions are specified one per line, in the following form:

[Slot Offset]    [Slot Values]   [Action]

Each part must be separated by whitespace. Slot offsets range from 0 to 511. Slot values range from 0 to 255.

As an example, the following will run `echo hello world` whenever the value of the first DMX slot changes to 0, 5 or 10.

0    0,5,10    `echo hello world`

Actions are only executed when the value changes. In the example above, if the value of slot 0 in the previous frame was 10, and a frame with slot 0 @ 10 arrived, the action will not be triggered. If a frame with slot 0 @ 5 arrives, the action will execute again.

Value Matching

Values are separated by commas. Ranges can be specified with a hyphen.

1,2,3,4   # Trigger on values 1 through to 4
1-4,10-14 # Trigger on values 1 to 4 and 10 to 14 (inclusive)

The % character the is default match. It triggers for all values that don't have an explicit action configured

0-100  # Values 0 to 100
%         # Triggers for everything else (101 - 255)

Command Execution

Variables

Rather than executing a command, an action can set a variable

Special Variables

The variables ${slot_offset} and ${slot_value}


Comments

The # character comments out the rest of the text until the end of the line. This can be used at any location.

Example

A full example config is provided in the tools/ola_trigger directory.

# Example DMX Trigger Config File                                                                                                                                                               

# Variable definitions
###############################################################################
# The default value of slot 2, this won't ever be used, since the variable is
# only used with slot 3, which implies we already got data for slot 2.
slot_2_value = "nan"  # nan isn't special in any way

# Triggers
###############################################################################
# Slot    Trigger Values   Action

# Slot 0 prints the current value of slot 0
0         %                `echo "Slot ${slot_offset} is at ${slot_value}"`

# Slot 1 runs a different command line tools
1         1                `ls`
1         2                `ps aux`
1         3                `who`

# Slot 2 sets a variable
2         %                slot_2_value="${slot_value}"

# Slot 3 prints the value of slot3 if slot3 is greater than 50%
3         128-255          `echo "Slot 2 is ${slot_2_value}"`