setpoint was tested for its inclusion within the allowable range for joint 2. Following this check, the position error was calculated as the difference between the position setpoint and the actual position of the joint. The position controller for joint 2 was then called as a subroutine as indicated in Figure 8.15. In this subroutine, a lag-lead controller (equation 8-7) was used to calculate a velocity setpoint which was used by the minor velocity control loop. This velocity setpoint was used as the input setpoint to the velocity control subroutine as depicted in Figure 8.8. The valve control signal was output from the velocity controller to the servo amplifier by way of the D/A converter. The position of the sliding joint was sensed by a potentiometer while the velocity was sensed by a tachometer. Both of these values were fedback to the control computer through separate channels of the A/D converter. Variables for the major loop controller are presented in Table 8.3. Valve Control Signal Figure 8.13. Block diagram of the position control feedback loop with velocity feedback in a minor loop. /********************** Position errors ********************/ if(p2sp > p2max) p2sp = p2max; else if(p2sp < p2min) p2sp = p2min; p2erl = p2er; p2er = p2sp p2; e 8. P n e c f *********************************************** Figure 8.14. Position error calculation for joint 2 as accomplished in the ERRORCAL:C routine.