%    PCTRL - script to plot PID pitch control parameters in current axes
%
%    B. A. Moran, 16-Jun-1995

%    Copyright (C) 1995-1998
%    Massachussetts Institute of Technology
%    Sea Grant AUV Laboratory
%    $Id: pctrl.m,v 1.2 1998/05/15 15:01:41 bamoran Exp $	

plot( time, 180/pi*(data(:,m_pitch) - ...
    data(:,c_pitch))*data(1,uo_control_kpp), 'r' );
line( time, 180/pi*data(:,m_pitch_rate)*data(1,uo_control_kdp), ...
    'Color', [0 .5 0] );

if exist( 'p_integral' ) == 1
    line( time, 180/pi*data(:,p_integral), 'Color', [0 0.75 0.75] )
else
    line( time, 180/pi*(data(:,c_elevator_angle) - ...
	data(:,m_pitch_rate)*data(1,uo_control_kdp) ...
	- (data(:,m_pitch) - data(:,c_pitch))*data(1,uo_control_kpp)), ...
	'Color', [0 0.75 0.75])
end

line( time, 180/pi*data(:,c_elevator_angle), 'Color', 'b' );

zoom on
title( ['PID Pitch (prop r, int c, deriv g, elev b)'] );
xlabel( 'elapsed time (s)' )
ylabel( 'control activity (deg)' )
