INTERP(OPCSDEFS)	Optical Printer Control System	     INTERP(OPCSDEFS)

    NAME
        interp - configure channel position interpolations

    SYNOPSIS
        interp [chan] [master] [low] [high] [total] [samples]

    EXAMPLES
	interp d -  0 170 18 0 1500 2500 3200 3900 4500 5080 5620 6130
	                 6670 7120 7630 8110 8550 9010 9470 9930 10340

	interp F E  0 12000 13 0 10 20 30 40 50 60 70 80 90 100 110 120
	         | 
	         Note that 'e' channel the master zoom, and 'f'
	         is the follow focus.

	interp d -  0 0 0       # Disable any previous interp for 'd'

    DESCRIPTION
        INTERP allows a channel to be interpolated into a sampled curve, or
	to slave to another channel using interpolation into a sampled curve.

	    [chan] is the channel that is going to have the 
	    interpolation defined to it.  

	    [master] is channel name of a master channel, such as
	    in a zoom/follow focus relationship where the zoom is the master
	    to the follow focus channel. In such a case, the position of the
	    focus channel is a function of the position of the zoom channel.
	    If mastering is not desired (such as with the fader), specify '-'.

	    [low] [high] These indicate the low and high range of the 
	    'requested' positions that will be asked of this channel. These can
	    be floating point values.
	
	    [total] This indicates how many sample points make up the 
	    interpolation curve.
		      
		      NOTE: If [total] is '0', this will cancel any previous
		      INTERP(OPCSDEFS) specifications for this channel.

	    [samples] are the sample positions..Start with the [low]
	    samples, and work up towards the [high] samples. Each sample
	    position should be separated by white space (tabs, spaces, CRLFs)
	    and there should be as many samples as specified by [total].

    OVERVIEW
	When an INTERP command is set up on a channel, it is like defining
	a look up table through which each position request is converted
	to a new position, according to the value found in the lookup table.

	Requests that fall between values in the lookup table are computed
	as a linear interpolation between the two lookup values. When enough
	points are supplied to the lookup table, very complex functions can
	be defined and approximated (to the point where error is negligable).

	Follow focus curves can be defined quite well with just a few dozen
	sample positions. Non linear mechanics can be compensated for, such
	as faders that have built in logarithmic motion, so the computer can 
	control it in a linear fashion (such as for cross dissolves).

♀
    HOW INTERP WORKS

	===============================================================
	=                                                             =
	=   interp a - 10 30 3 1000 2000 9000                         =
        =               |  | |  |         |                           =
        =               |  | |  |         Last sample position        =
        =               |  | |  First sample position                 =
        =               |  | Total samples                            =
        =               |  High                                       =
        =               Low                                           =
	===============================================================
	Figure A.

	===============================================================
	=  Requested      Clipping           Samples     Resulting    =
	=  Positions       Window                        Positions    =
	=                                                             =
	=                     |                                       =
	=      0 ---------->  |                       ----> 1000      =
	=      5 ---------->  | LOW = 10            /-----> 1000      =
	=     10 ----------------------------> 1000 ------> 1000      =
	=     15 ---------------------------->      ------> 1500      =
	=     20 ----------------------------> 2000 ------> 2000      =
	=     25 ---------------------------->      ------> 5500      =
	=     30 ----------------------------> 9000 ------> 9000      =
	=     35 ---------->  | HIGH = 30           \-----> 9000      =
	=     40 ---------->  |                       ----> 9000      =
	=                     |                                       =
	=                                                             =
	===============================================================
	Figure B.

	The 'Requested Positions' are the positions the operator wants the
	motors to move to. The 'Resulting Positions' are the values that 
	are actually seeked by the motors. What happens in between is 
	caused by the INTERP command (Figure A).

	Requested positions are clipped into the range LOW and HIGH.
	Values less than LOW are made LOW. Values above HIGH are made 
	HIGH.

	Once clipped, the values are stretch-fitted according to the
	samples supplied. Note how linear interpolation is used to
	compute the lookup for '15', which falls between the two samples
	1000 and 2000, translating to 1500.

    FADER INTERPOLATIONS
	The software can be set up to account for weird (non-linear) hardware
	such as in a fader. A sample point is supplied for every 10 degrees
	on the fader. The samples represent the actual motor positions for 
	every 10 degrees in the fader. The following is an actual example for
	a 120 degree fader:

	    interp  D - 0 120 13 0 -260 -365 -450 -515 -585 -645
				  -705  -760  -815  -860  -910  -970

	Note how the LOW and HIGH values are set to 0 and 120. This way a
	request for 120 will actually move the fader to its open position
	which is the actual position of -970, and 0 will move the fader to
	its actual position of zero.

	The samples are non-linear, and represent the number of steps for 
	every 10 degrees in the fader. These points were found by first 
	disabling any INTERPs on the fader, and then moving the motor several
	pulses at a time, taking note of the step position everytime the fader
	hit a 10 degree mark.

    FADER SETUP
       Assuming you have a fader with some sort of logarithmic mechanical
       rig, you need to follow this procedure to set up your fader properly
       to counteract the built in logarithmic movement (for proper dissolves).

       o Make sure there is no INTERP command already set up on the fader
         in the OPCSDEFS.OPC file. If there is, comment it out with '#', and
	 rerun the software, or disable it by typing the following:

		       ldefs  con       
		       interp d - 0 0 0      # cancels interpolations
		       ^Z                    # (control-Z and return)

       o Check for any significant mechanical slop in the fader:
       
            Using the JOG command, move the motor forward. Now change 
	    directions, stepping the motor a small amount at a time. Make 
	    note of how many pulses it takes before the fader actually starts
	    moving in the other direction. If it begins moving immediately, 
	    there is no need to set up slop correction for the fader. If
	    there is a great deal of slop, refer to SLOP(OPCSDEFS) to setup
	    slop correction before continuing with this procedure.

       o Before continuing, you will need to have an accurate idea of the 
         degree positions of the fader. For truely accurate measurement, you
	 should remove the front of your camera, and using a protractor,
	 put scribe marks for every 10 degrees along the outer edge of the 
	 fader's shutter. Using a scribe on the camera body as a pointer,
	 you should be able to find each 10 degree position accurately.
         
       o Use JOG(OPCS) to position the fader to the CLOSED position. Move in 
         small steps until you get the fader properly closed, which usually
	 invloves overlapping the fader/shutter blades a little. Avoid 
	 changing direction when finding the position to minimize slop errors.
	 
	o Now, reset the fader's counter to zero. You can do this from within
	  JOG, or by executing: 
	
		reset d 0

	o Now, slowly JOG the fader shutter to each 10 degree mark (10,20..).
	  Each time the fader hits a 10 degree mark, write down the motor
	  position from the display.
	  
	  Avoid going too far, and especially avoid changing direction. If you
	  screw up by going too far, start over from the beginning with the 
	  shutter CLOSED. 

	o If you have a 170 degree fader, you will have 18 values (including
	  '0' for the 0 degrees position). Using a text editor, make an INTERP
	  command for the fader that contains all the samples you just found:

                interp d - 0 170 18 0 112 153 278 475  ...
                             |   |  ----------------------
                             |   |           |
                             |   |    The samples you found. (include 0)
                             |   |
                             |   Total samples you found. (including 0)
                             |
                             The number of degrees in your fader.

	  If there are more samples then can fit on a line, you can let them
	  wrap around the screen, or embed carriage returns and tabs for
	  readability.

	*  *  *

	 You should now be able to start up the OPCS software, and position
	 the motor to correct positions with the SHU(OPCS) command, ie:
	 shu 50 should send the shutter to the 50 degree position.

	 Dissolves and fades should also work properly now.

	 If your fader mechanics suffers slop, (ie: the fader will be 
	 inaccurate when it changes direction) refer to the SLOP(OPCSDEFS)
	 command for ways to overcome mechanical slop if you haven't already
	 done so.

    BUGS
    	 If you have very few pulses between an OPEN and CLOSED shutter,
	 you may experience 'rounding' problems in the display, ie. executing
	 the command shu 50.5 may actually send the shutter to
	 50.1 or some such deviation because your hardware may not have
	 enough resolution to actually achieve 50.5.
	 

    SEE ALSO
	SHOW(OPCS)  - show current positions for all motors
	JOG(OPCS)   - interactively jog a motor to positions
	GO(OPCS)    - move motors some distance or to new positions
	SHU(OPCS)   - send fader to absolute positions in degrees
	SLOP(OPCSDEFS) - overcome mechanical slop, esp. faders

    ORIGIN
	Gregory Ercolano, Los Feliz California 12/20/90
© Copyright 1997 Greg Ercolano. All rights reserved.