%function bstruct = ascend()
%function bstruct = ascend(heading,rpm,startdepth)
%function bstruct = ascend(heading,speed,duration,pitch,enddepth, ...
%	speedmode,horizontalmode, horizontal)
function bstruct = ascend(heading,speed,duration,pitch,enddepth, ...
	speedmode,horizontalmode, horizontal)
[bdefaults,bnames] = behaviorDefaults;
bstruct = bdefaults{indexof(bnames,'ascend')};

if nargin == 0,
	heading = 0;
	speed = 300;
	duration = 10;
end
if nargin == 1 | nargin == 2,
	errorbox('Not enough input arguments to ascend.m')
end
if nargin == 0 | nargin == 3,
	pitch = 20;
	enddepth = 1;
	speedmode = 'rpm';
	horizontalmode = 'heading';
	horizontal = heading;
	startdepth = duration;
	duration = calcDuration(startdepth,enddepth,pitch,speed);
end

bstruct = setfield(bstruct,'enddepth',enddepth);
bstruct = setfield(bstruct,'horizontalmode',horizontalmode);
bstruct = setfield(bstruct,horizontalmode,horizontal);
bstruct = setfield(bstruct,'pitch',pitch);
bstruct = setfield(bstruct,'speedmode',speedmode);
bstruct = setfield(bstruct,speedmode,speed);
if nargin == 2, return, end
bstruct = setfield(bstruct,'duration',duration);
