%    O2_THAMP - plots thruster amps and commanded speed
%
%       o2_thamp( time, c_speed, m_current )
%
%    B. A. Moran

%    Copyright (C) 1997-1998
%    Massachussetts Institute of Technology
%    Sea Grant AUV Laboratory
%    $Id: o2_thamp.m,v 1.1 2000/01/10 19:08:20 rob Exp $

function o2_thamp( time, c_speed, m_current )

global run_name;

rows = 1:length(time);
if diff(c_speed(1:2)) > .5
    rows(1) = [];
end

if mean( m_current(find(finite(m_current))) ) > 20
    disp( 'Using pre 11/96 thruster current' );
    m_current = 0.04*m_current;
end

clrs = get( 0, 'defaultaxesColorOrder' );

[xx,yy] = stairs( time(rows), c_speed(rows) );
line( xx, yy, 'color', clrs(2,:) );
ylabel( 'speed (m/s)', 'color', clrs(2,:) );

h1 = gca;
set( h1, 'YColor', clrs(2,:)/2 );

h2 = axes( 'Position', get(h1, 'Position') );
set( h2, 'YAxisLocation', 'right', 'Color', 'none', 'YColor', clrs(3,:)/2 );

line( time(rows), m_current(rows), 'color', clrs(3,:) );
ylabel( 'current (A)', 'Color', clrs(3,:) );

title( ['Command speed (g), current (r): ' run_name] );



