Theater Show Demos

Each theater performance is defined by a single control script. Several samples are shown below. Each uses modules from the stage package which provide common configuration and communication support to interface to the theater servers.

Theater Show Demo Script

The following script demonstrates a basic action sequence representing one iteration of a show. Each action sends commands as OSC messages and then waits. The script must exit to allow other shows or idle time between performances.

#!/usr/bin/env python3
"""demo-show.py : demonstration of scripting action across all theater units
"""
import argparse, time, logging
import numpy as np

from pythonosc import osc_message_builder
from pythonosc import udp_client

import stage.config
import stage.network

# import common logging functions
import stage.logconfig

# initialize logging for this module
log = logging.getLogger('demo')

#================================================================
if __name__ == "__main__":

    # set up logging
    stage.logconfig.open_log_file('logs/demo-show.log')
    log.info("Starting demo-show.py")

    parser = argparse.ArgumentParser( description = "Simple scripted show.")
    parser.add_argument("--ip", default=stage.config.theater_IP,
                        help="IP address of the OSC receiver (default: %(default)s).")
    stage.logconfig.add_logging_args(parser)
    args = parser.parse_args()

    # Modify logging settings as per common arguments.
    stage.logconfig.configure_logging(args)

    # create OSC clients to send messages to the theater system
    network = stage.network.TheaterNetwork(args)

    # pulse each RGBA fixture with a specific color
    color_table = {'rgba1' : [0, 0, 255, 0],
                   'rgba2' : [255, 0, 0, 0],
                   'rgba3' : [0, 0, 0, 255],
                   'rgba4' : [0, 255, 0, 255],}

    for fixture in ['rgba1', 'rgba2', 'rgba3', 'rgba4']:
        network.lights.send_message("/fixture", [fixture] + color_table[fixture])
        log.debug("Lighting fixture %s", fixture)
        time.sleep(2)
        network.lights.send_message("/fixture", [fixture, 0, 0, 0, 0])

    # activate each mono light
    for fixture in ['lamp1', 'lamp2', 'lamp3', 'lamp4']:
        network.lights.send_message("/fixture", [fixture, 255])
        log.debug("Lighting fixture %s", fixture)
        time.sleep(1)

    # activate each fan one at a time
    for fixture in ['fan1', 'fan2', 'fan3', 'fan4']:
        network.lights.send_message("/fixture", [fixture, 255])
        log.debug("Lighting fixture %s", fixture)
        time.sleep(2)

    # deactivate each fan one at a time
    for fixture in ['fan1', 'fan2', 'fan3', 'fan4']:
        network.lights.send_message("/fixture", [fixture, 0])
        log.debug("Lighting fixture %s", fixture)
        time.sleep(2)

    # deactivate mono lights
    for fixture in ['lamp1', 'lamp2', 'lamp3', 'lamp4']:
        network.lights.send_message("/fixture", [fixture, 0])
        log.debug("Lighting fixture %s", fixture)
        time.sleep(1)

    # pulse each RGBA fixture full on
    for fixture in ['rgba1', 'rgba2', 'rgba3', 'rgba4']:
        network.lights.send_message("/fixture", [fixture, 255, 255, 255, 255])
        log.debug("Lighting fixture %s", fixture)
        time.sleep(2)
        network.lights.send_message("/fixture", [fixture, 0, 0, 0, 0])

    log.info("Exiting demo-show.py")

Theater Motion Demo Script

The following script demonstrates issuing motion commands to a capstan winch set providing four stepper-motor capstan drives. Each action sends commands as OSC messages and then waits. The script must exit to allow other shows or idle time between performances.

#!/usr/bin/env python3
"""winch-demo.py : demonstration of scripting theater actions
"""
import argparse, time, logging
import numpy as np

from pythonosc import osc_message_builder
from pythonosc import udp_client

import stage.config
import stage.network

# import common logging functions
import stage.logconfig

# initialize logging for this module
show_name = 'winch-demo'
log = logging.getLogger(show_name)

#================================================================
if __name__ == "__main__":

    # set up logging
    stage.logconfig.open_log_file('logs/' + show_name + '.log')
    log.info("Starting %s", show_name)

    parser = argparse.ArgumentParser( description = "Simple scripted show.")
    parser.add_argument("--ip", default=stage.config.theater_IP,
                        help="IP address of the OSC receiver (default: %(default)s).")
    stage.logconfig.add_logging_args(parser)
    args = parser.parse_args()

    # Modify logging settings as per common arguments.
    stage.logconfig.configure_logging(args)

    # create OSC clients to send messages to the theater system
    network = stage.network.TheaterNetwork(args)

    # select a single motion unit; each winch set has a separate server
    winch1 = network.motion_server_by_name('winch1')
    winch2 = network.motion_server_by_name('winch2')

    # move each winch axis in turn
    for axis in ['x', 'y', 'z', 'a']:
        winch1.send_message("/spline", [axis, 0.0, 180.0, 180.0])
        time.sleep(0.5)

    # reverse back to start; each spline is relative to current position
    for axis in ['x', 'y', 'z', 'a']:
        winch1.send_message("/spline", [axis, 0.0, -180.0, -180.0])
        time.sleep(0.5)

    # Similar, but with a multi-segment cubic Beizer spline.  Each segment
    # requires three knot values.
    for axis in ['x', 'y', 'z', 'a']:
        winch1.send_message("/spline", [axis, 0.0, 180.0, 180.0,  90.0, -45.0, 0.0])
        time.sleep(0.5)

    # coordinated movement across different winch sets
    for axis in ['x', 'y', 'z', 'a']:
        winch1.send_message("/spline", [axis, 0.0, -180.0, -180.0])
        winch2.send_message("/spline", [axis, 0.0, -180.0, -180.0])
        time.sleep(0.5)

    log.info("Exiting %s", show_name)

stage.network

The network module supplies a common infrastructure for performance control clients to communicate with the theater systems.

network.py

OSC UDP messaging network support common to several scripts.

class stage.network.TheaterNetwork(args)[source]

Manage the UDP sockets for sending data to the theater system.

lighting_server(unit=0)[source]

Return an OSC client for communicating with the lighting system.

motion_server_by_name(name)[source]

Return an OSC client for communicating with a unit of the stepper motor control system.

start_vision_client()[source]

Create the vision client socket and start a server thread.

valve_server_by_name(name)[source]

Return an OSC client for communicating with a unit of the pneumatic valve control system.