OPCSHARD(DOCS)      Optical Printer Control System       OPCSHARD(DOCS)

NAME
    opcshard - notes on rigging the OPCS hardware

OPCSK100 and OPCSK200 Software
------------------------------
    The OPCS system uses either the A800 or one of the Kuper Controls
    cards (RTMC16, RTMC48, Kuper Industrial) to generate pulse streams
    to run the steps/direction inputs on the microstepper motor drives.

           PULSE GENERATOR ISA CARDS
	   -------------------------
	   RTMC16 -- Kuper 16 axis 'full size' card using discrete
	   RTMC48 -- Kuper 48 axis 'full size' card using FPGAs
	   Kuper Industrial -- Kuper 16 axis 'half size' card using FPGAs
	   A800             -- OPCS 8 axis 'half size' card using PICs

    A variety of stepper motor drives can be used with the above cards:

           STEPPER MOTOR DRIVES
	   --------------------
           Centent (CNO-142, CNO-143, CNO-162, CNO-165)
           Gecko (201 and 201X)
           Leadshine (DM-542)
           Sanyo (FMD2740C)

    Although not required, the following OPCS interface boards can be
    used to simplify wiring to the motors and digital sensors:

           ANCILLARY CARDS
	   ---------------
           PIO-100  - Parallel I/O interface board (see 'man pio-100')
           SD-800   - Stepper Distribution board (see 'man sd-800')

    The PIO-100 board is connected to the computer's parallel port,
    and breaks the signals out to individual RJ-45 ports, allowing
    RJ-45 patch cables to run out to each digital sensor, e.g.
    home sensors, buckle/viewer switches, deenergize on the step drives,
    tension motor controls, etc. This simplifies wiring, and allows
    sensors to be easily reassigned.

    The SD-800 board is connected to the computer's step pulse generator
    (e.g. RTMC16, RTMC48, Kuper Industrial, OPCS 'A800' board..), and
    fans out the step/direction signals for each channel to individual
    RJ-45 ports, allowing RJ-45 patch cables to run out to each channel's
    stepper drive. This simplifies wiring, and allows motor channels to
    be easily reassigned.

OPCS SOFTWARE REQUIREMENTS/LIMITATIONS
--------------------------------------
    In order to run the optical printer effectively, the first 4 channels
    (a,b,c,d) are pre-assigned in the software for specific purposes:

        KUPER       OPCS
        CHANNEL     CHANNEL     DEVICE EXPECTED TO DRIVE
        -------     -------     -------------------------------
           0            A       Aerial Projector
           1            B       Main Projector
           2            C       Camera
           3            D       Fader

    Other channels (E, F, etc) have no requirements, and can be assigned
    to any purposes, such as zoom, focus, east/west and north/south pan,
    filter wheels, capping shutters, etc.

    The OPCS software was originally designed to control a maximum of 12
    motors. Even though the Kuper card can control up to 16 axes, the OPCS
    software can only drive a maximum of 12.

    OPCSk1.00 does NOT use the Kuper card's encoder feedback.  Under normal
    use, motors should never stall or loose position unless there is some
    hardware problem (e.g. stuck gears, bad connections, frozen equipment,
    bad pulley and/or gearing ratios), or the ramping values were not set
    properly (see RAMP(OPCSDEFS), SPD(OPCSDEFS), etc).

    The software provides for inverting the direction of a motor if it runs
    in the wrong direction. See DIRXOR(OPCSDEFS) to correct this. Normally,
    if the DIRXOR bit for a motor is 0, the motor will turn clockwise when
    told to run 'forward' from the software. By changing the DIRXOR bit to 
    a 1, telling the motor to run 'forward' will make it run counter-clockwise.

    The OPCS software's definition file (OPCSDEFS.OPC file) can program
    any of the IBM's hardware ports to control/monitor the following
    functions. Usually the parallel port is used for this, though 3rd
    party digital I/O boards (such as the 8255 based I/O boards) can be
    used as well:

        Function                        DEFS command
        ------------------              ---------------------
        Film buckle                     buckle
        Viewer Open                     viewer
        Deenergize (unlock motors)      deenergize
        Allstop                         allstop
        Motor Direction Inversion       dirxor
        Home Sense                      (see HOME SENSING below)
        Set a bit on a port             setbit
        Clear a bit on a port           clrbit
        Invert a bit on a port          xorbit
        Tension motors                  tension

    The software currently requires at LEAST a 25Mhz machine, or faster
    to properly update the motors. The software will display the error:

        FATAL ERROR: Sync Fault (probably lost positions)

    ...accompanied by some disagnostics data if it finds the CPU cannot
    keep up with the motors.

    The software relies on the Kuper card's timebase to compute accurate
    camera exposures. Therefore, the software will have exposures
    consistent from machine to machine, regardless of the CPU's speed.

HOME SENSORS
------------
    "Home sensors" or "optical sensors" allow the software to find
    each channel's "zero position" automatically from software.

         > Camera shutter needs to home in the "closed" position
         > Projector shutters needs to home in the "seated" position
         > Fader should be homed in the CLOSE position
         > Pan and zoom should home in the 1:1 center position
         > Filter wheels should be home in the full open (no filter) position
         > Capping shutters should home in the open position
    
    Home sensing is handled by the external 'home' program. It has its
    own setup file, HOMEDEFS.HOM that defines which computer port bits
    are associated with which home sensor, and which home sensor with which
    motor channel. This file also defines the motor homing routines;
    a simple 'scripting langauge' the defines how each motor channel should
    find home.

    Typically when OPCS first starts up, all motors are homed automatically
    via commands near the bottom of the OPCSDEFS.OPC file that sends each
    channel home, and zeroes the software counters. e.g.

          ! home a b c d      # home the a/b/c/d channels
          reset abcd 0        # reset the software counters to zero

    See 'man home' and the HOMEDEFS.HOM file for examples of how the
    home program can be customized.

    Users can define their own OPCS commands to home the motors, using
    either RUNCMD(OPCSDEFS) or DOSCMD(OPCSDEFS) to run external programs
    such as the 'home' program.

    Home sensors usually manage either rotational or linear motion
    oriented channels:

        > Rotational sensors usually sense a slot in a disk to find home

        > Linear sensors usually sense the edge of a bar of metal running
          half the length of linear motion to find home. See "PAN CHANNELS"
          (below) for more info.


AERIAL & MAIN PROJECTOR
-----------------------
    The projector(s) usually have an M0-63 type motor to run the film
    movements, and Bodine tension motors to keep feed and takeup tension
    on the film. Home sensors on the movement ensure when the software
    starts up, the film movement is in the proper, fully seated position.

    There's usually one pair of tension motors for the regular film path,
    and a separate pair of tension motors for a secondary film path,
    such as when bipacking in the projector.

    The home position for projectors should be in the fully seated
    position, so that looking through the camera viewer will see a fully
    seated projector image.

    Typically motors are geared 1:1 to the film movements, which is to say
    one turn of the motor moves the film movement one full cycle, which is
    usually a full frame advance (for 35mm film), or sometimes a fraction
    of a frame for the larger format film (e.g. IMAX, Vistavision).

    For larger format films that involve several pulldown cycles of the
    film movement to expose a single frame, a capping shutter is utilized
    to expose only on one of the cycles that is the film exposure, and
    caps out the intermediate pulldown motions involved in advancing to
    the next frame in fractional steps.

    Usually it's best to run the projectors at their maximum safe speed,
    which is usually around 20 feet per minute, which is usually around
    0.25 to 0.18 exposure speed (around 5 frames per second).

CAMERA
------
    The camera film movememnt ususally uses an M0-63 type motor to run
    the film movements, and Bodine tension motors to keep feed and takeup
    tension on the film, a separate pair of tension motors for raw stock
    and optional bipack.

    The home position for the camera should be in the fully CLOSED
    position, so that the camera is NOT exposing film when sitting idle.


FADER
-----
    The fader on optical printers is often difficult to configure
    for stepper motor control, especially cameras that need linear
    movement to rotate the shutter blade.

    Also many faders have a built in logarithmic movement that has
    to be counteracted for proper computer controlled dissolves.
    It's therefore often the case an interpolation curve is needed
    to undo the logarithmic motion. This can be done with the
    INTERP(OPCSDEFS) command. (See 'man interp' for more info)

    Faders are typically 170 degrees, which is the number of
    degrees the fader shutter's opening is. This is 10 degrees
    less than 180, which allows 5 degrees of overlap on either
    end of the fader with the camera's shutter, to ensure no
    light leaks around the fader shutter when it's fully closed.

    The home sensor for the fader is usually positioned such that
    the fader homes in the closed position.

    The fader is often used as a cap, to wind off black frames,
    and then moved to full open to do normal shooting.

    There are three camera operator commands that directly move
    the fader shutter:

        opn    -- open the fader
        cls    -- close the fader
        shu 50 -- move the fader to specific positions in degrees

    Normally the 'interp d ..' OPCSDEFS command is configured to
    convert degrees into actual step positions. For a linear shutter,
    this would be a simple command such as:

        interp d - 0 170 2 0 12000
               | | |  |  | |   |
               | | |  |  | |   End step position (open)
               | | |  |  | Start step position (closed)
               | | |  |  Number of step positions in the interpolation
               | | |  End position in degrees (open)
               | | Start position in degrees (closed)
               | (No slaving channel)
               The fader channel

    Finding Fader 10 Degree Positions
    ---------------------------------
    For logarithmic faders, setup involves removing the camera
    face plate to expose the actual fader and camera shutters
    so that one can mark 10 degree positions on the camera body.

    1) Remove the camera's face plate, exposing the camera/fader
       shutters

    2) Make sure there is no interpolation already configured
       for the fader channel by running:

           ldefs -c interp d - 0 0 0

    3) Home the camera and fader, and reset the fader's software
       counter to zero:

           ! home c d
           reset d 0

       The fader should now be fully closed, and the camera shutter
       should be in the closed position, where the center of the
       camera's shutter is covering the light path to the film.

    4) Jog the fader using:

           jog d

       ..until the fader is in the full open position. Make note of the
       fader's step counter, as that will be the 'full open' position.
       For the purposes of an example, let's say 'full open' is 54100.

       Use the ESC or 'q' key to break out of jog mode.

    5) Send the fader to the closed position using:

            go d >0

       Using a protractor, mark on the front of the camera the degree
       positions, starting with "0" for the leading edge of the fader
       in the fully closed position, then using the protractor, mark
       every 10 degrees with a fine line on the front of the camera body.

       Label each mark in degrees: 0, 10, 20, etc. until you reach the
       full open position which should be 170.

       There should be 18 marks total, including zero.

    6) Make a table on a piece of paper for all the 0 to 170 degree
       positions. You'll fill out this table in the next steps:

               DEGREES    POSITION
               -------    --------
                  0          0       <-- usually always zero
                  10
                  20
                  30
                  40
                  50
                  60
                  70
                  80
                  90
                  100
                  110
                  120
                  130
                  140
                  150
                  160
                  170       54100     <-- this value from step #4

    7) Send the fader to the closed position using:

            go d >0

    8) Now using 'jog d', move the fader to find each 10 degree
       position, moving always in the same direction (to prevent slop).

       Write down the step count shown for each 10 degree position.

    9) Repeat step 8 for every 10 degree mark until you reach 170.

       You should now have a table of numbers that can be plugged
       into an interp command for testing:

               DEGREES    POSITION
               -------    --------
                  0          0
                  10         8200
                  20         11600
                  30         14100
                  40         16800
                  50         19100
                  60         21400
                  70         23600
                  80         25600
                  90         27850
                  100        30350
                  110        32600
                  120        35100
                  130        37500
                  140        40100
                  150        43600
                  160        47850
                  170        54100

    10) Using the table you've prepared in step #9, create an interp
        command for the 'd' channel by editing the OPCSDEFS.OPC file,
        and add the command near the bottom of the file in the 'FADER
        AND FOCUS' section. For the above example that would be:

            interp d - 0 170 18 
                       0 8200 11600 14100 16800 19100 21400 
                       23600 25600 27850 30350 32600 35100 37500 
                       40100 43600 47850 54100 

        Refer to the manual page for the INTERP(OPCSDEFS) command
        ('man interp')

    11) Now reload the OPCSDEFS.OPC file so that the new interp command
        is configured by running:

            ldefs opcsdefs.opc

    12) Home the 'd' channel and reset the counters using:

           ! home d
           reset d 0

        NOTE: You may want this to be automatic on startup by adding
              the following commands to the OPCSDEFS.OPC file:

                    ! home d
                    opcscmd reset d 0

    13) Check the degree positions work by using the SHU(OPCS) command
        to go to every 10 degree mark:

            shu 10
            shu 20
            shu 30
            ..
            shu 170

        Make sure the fader's leading edge reaches each of the 10 degree
        marks accurately.

        If slop in the fader is a problem, configure slop correction for the
        'd' channel using the SLOP(OPCSDEFS) command. This sets the number
        of steps for "slop correction". Refer to the man page for more info.

    14) Once verified, using 'opn' and 'cls' should also reach the 170
        and 0 marks respectively.

    That's it.

    You should now be able to do lap dissolve tests to check for problems.
    When properly configured, cross dissolves between two gray fields should
    not get brighter or darker during the dissolve.

    If you do see pulsation, try to track down the problem by more carefully
    monitoring the 10 degree marks on the front of the camera.


FILTER WHEELS
-------------
    Filter wheels are large disks that hold a variety of filters
    in front of the film path, allowing for doing quick wedges
    of a set group of filters on different scenes, or allowing
    computer controlled filter changes during shoots, where filters
    are preloaded into the wheel, and OPCS scripts are devised to
    move to different filters for different scenes automatically.

    Filter wheels should have a single position with NO FILTER,
    and that position should be the 'home' position, so that the
    camera operator can look through the viewer and see the projector
    footage without a filter in the way.

    Filter wheels come in different sizes, from 4 position on up to
    many 10s of filter positions.

    For printers doing YCM printing, a 4 position filter wheel is
    essential to handle the three yellow/cyan/magenta filters needed
    to either combine or split out a color image into 3 separate
    black&white separations.

    Special YCM shooting files can be used to run the shutters
    in such a way that the film can be moving as fast as possible
    for the 3 separate YCM exposures. See 'man velrep' for creating
    custom motor velocity files that can run the camera/projector/
    filter wheel/capping shutter all in sync for the fastest YCM
    shooting possible.

CAPPING SHUTTERS
----------------
    Capping shutters are often used when working with film movements
    that involve several seat/unseat operations per frame, such as
    YCM footage, or large format film such as Vista or IMAX where the
    film movements need to cycle several times to move one frame.

    Capping shutters should be *rotational* shutters: a 1/2 disk such
    that 1/2 the disk blocks the light (acting as a cap), and the other
    1/2 exposes light.

    Non-rotational shutters should be avoided, such as:

        CAPPING SHUTTERS TO AVOID
        -------------------------
        Solenoid driven caps
        Aperture oriented caps (blade shutters, e.g. Uniblitz)

    These wear out prematurely, as motion picture work involves tens of
    thousands of exposures per day, which is easy to wear out devices
    with MTBF rating of only a million cycles. (If the average use is
    10,000 frames per day, a million cycle limited shutter would wear out
    in 100 days)

    It is advised capping shutters home in the open position, so that
    the camera operator can always look through the viewer to see the
    image in the projectors when the system is idle.

PAN CHANNELS
------------
    Pan channels for the lenses are typically small motors (M0-61 or M0-62),
    that do simple linear motions.

    A stationary home sensor for the pan channel(s) should be configured
    such that the sensor is mounted to the stationary base of the printer
    if possible (avoiding cable movement which can fatigue the cable and
    connection to the sensor) and a bar of thin metal mounted to the moving
    pan head that acts as the "sensor flag", blocking the sensor whenever
    the pan head is to one side of the center (zero) position.

        

    For example, an east-west pan head where "home" is the center position,
    and the pan head can be moved east or west of that position.

    If the "sensor flag" blocks the sensor whenever the head is positioned
    west of center, this makes it easy to know which direction to move the
    motor to find home during motor homing:

    > If the sensor is blocked, we're WEST of home and need to move east
    > If the sensor is unblocked, we're EAST of home and need to move west

     |                                                                     |
     |<------------------------ pan distance ----------------------------->|
     |                                                                     |

                 _________________________________________
                |              PAN HEAD BASE              |
                |  _____________________________________  |     AT ZERO (HOME)
                |_| o                o                o |_|     Sensor resting
                  |____________________   SENSOR FLAG   |       on the left EDGE
                                      _|_               |       of sensor flag.
                                     |   |______________|
                                     |   |
                                     |___|
                                      Home
                                     Sensor

     |                                                                     |
     |<------------------------ pan distance ----------------------------->|
     |                                                                     |

       _________________________________________
      |              PAN HEAD BASE              |
      |  _____________________________________  |     PANNED WEST OF ZERO
      |_| o                o                o |_|     Sensor blocked by flag
        |____________________   SENSOR FLAG   |       indicates west of zero.
                             |        ___     |
                             |_______|   |____|
                                     |   |
                                     |___|
                                      Home
                                     Sensor

     |                                                                     |
     |<------------------------ pan distance ----------------------------->|
     |                                                                     |

                                 _________________________________________
       PANNED EAST OF ZERO      |              PAN HEAD BASE              |
       Sensor unblocked by      |  _____________________________________  |
       flag indicates east      |_| o                o                o |_|
       of zero position.          |____________________   SENSOR FLAG   |
                                      ___              |                |
                                     |   |             |________________|
                                     |   |
                                     |___|
                                      Home
                                     Sensor

    "Home" would be finding the "edge" of the bar, where it transitions from
    one state to another.

    To prevent hardware slop from causing a variance in the home position,
    it's always best to always find home from moving in the SAME DIRECTION.
    Example: we decide to always find home moving EAST. To home the channel:

             > If we're WEST of home, move EAST until we see a transition
               and then stop. This is the home position.

             > If we're EAST of home:
                    1) Move WEST until we see a transition and stop.
                    2) Move a little more (*) WEST until we're past home.
                    3) Now run EAST until we see a transition and stop

    (*) In step #2 when EAST of home, the extra west movement should be
    a little more than the amount of slop known for this hardware. So if
    the slop amount is approx. 800 steps, use 1200 steps for that extra
    movement.

    Note that the most common situation when homing a motor will be
    when the motor is already at the home position (resting on the edge),
    it might be wise to assume this case, and first move the pan head
    off the edge of the sensor by the slop offset (described above),
    so that we can then approach the home sensor in the proper direction
    with any slop removed.

ZOOM/FOCUS CHANNELS
-------------------
    The configuration of the home sensor for zoom/focus should be similar
    to the PAN CHANNELS (described above).

    For zoom there are two special considerations for setup:

        o Follow focus
        o Exposure compensation

    FOLLOW FOCUS
    In OPCS, follow focus is implemented by using interpolation between
    empirically determined focus points. Which is to say, during setup,
    you pick a fixed number of steps between interpolation points, and
    move the zoom channel to each position, and find focus, recording the
    focus positions for each fixed zoom position.

    Example: Let's say the zoom's entire travel is from step position
    -40000 to +20000, and 0 (zero) is the 1:1 home position. This means
    the total zoom distance is 60000 steps.

    And we decide finding focus positions for every 10000 steps works
    best. So that means there will be 7 focus positions (including zero)
    to find. (60000 / 10000 = 6), then plus one for the zero position.

    Let's say our channel assignments are 'e' for zoom (camera lens),
    and 'f' for focus (camera base). 

    Make a small table showing all the zoom positions from -40000 to
    20000 in increments of 10000, and a separate column for the focus
    positions we're going to find:

             ZOOM(E)    FOCUS(F)
             -------    --------
             -40000     
             -30000     
             -20000     
             -10000     
             0          0           <-- we know this is zero already
             10000     
             20000     

    We now go through the repeating process of finding the focus
    positions for each of the zoom positions:

    Finding Focus Positions
    -----------------------
    1) Start by making sure there are no interpolations already
       configured for the zoom and focus channels by disabling any
       existing interpolations by running:

           ldefs -c interp e - 0 0 0
           ldefs -c interp f - 0 0 0

    2) Home the two channels, and reset the software counters
       for these two channels to zero:

           ! home e f
           reset ef 0

    3) Load a focus chart in the projector.

    4) Use the viewer in the camera to verify sharp focus for the
       zero position. 

       If it's not in focus at zero, you better find out why by
       fixing the HOMEDEFS.HOM file, so that zero for the zoom
       is also zero for the focus channel.
    
    5) Now we move the zoom (e) to the extreme negative position:

           go e >-40000

    6) Use 'jog f' to jog the f channel until the focus chart is in focus.
       Write this focus position down for the current zoom position in
       the little table (described above).

    7) Move the zoom (e) channel forward 10000 steps, and repeat
       steps 6 and 7 until you fill the table with focus positions
       for each zoom position.

    8) Using your table of numbers, which is let's say:

             ZOOM(E)    FOCUS(F)
             -------    --------
             -40000     -212900
             -30000     -153500
             -20000     -96050
             -10000     -43150
             0          0           <-- we know this is zero already
             10000      7800
             20000      13375

    9) Now edit the OPCSDEFS.OPC file, and create an 'interp' command
       down in the FADER AND FOCUS section that will configure these
       focus positions, so that moving the zoom will cause
       the focus channel to try to keep the projector in focus:

         interp f e -40000 20000 7  -212900 -153500 -96050 -43150 0 7800 13375
                - - ------ ----- -  ------------------------------------------
                | |   |      |   |  These are focus positions from your table
                | |   |      |   |  
                | |   |      |   |
                | |   |      |   The number of focus positions
                | |   |      |
                | |   |      End zoom position
                | |   |
                | |   Start zoom position
                | |
                | Zoom channel (lens)
                |
                Focus channel (camera base)

        Make sure there's no other 'interp f e' command in the file..
        if there is, remove it to prevent confusion.

    10) Now reload the OPCSDEFS.OPC file so that the new interp command
        is configured by running: ldefs opcsdefs.opc

    11) Check that focus is maintained by moving the zoom to various
        positions, and check focus. e.g.

                go ef >25000
                go ef >18000

        Note you need to specify both channels for follow focus to work.
        If you just use 'go e >25000', that will just move the zoom without
        doing follow focus.

    That's it.

    If focus seems dodgy for the inbetween positions, you may need to
    double the number of focus positions by adjusting your zoom increment
    and repeating the above procedure.

    So in the above example, instead of using 10000, use 5000 increments
    on the zoom, which will double the number of focus positions to find,
    making a tighter curve.

    In many cases, I've seen needing 30 or 40 interpolation positions
    for accurate follow focus.

ORIGIN
    Gregory Ercolano, Topanga, California 04/12/00
© Copyright 1997 Greg Ercolano. All rights reserved.