function [mission,notransit] = surveyRaw()
global lastWaypoint
geoid = selectGeoid;
% coordinates of the northwest to southwest corners of a square to survey
lat = 36.560;
lon = 27.560;

tracklead = 50;
legLength = 300;

depth = 5;
rpm = 300;
transittime = 1200;
az = 35;
turn = 135;	
nLegs = 4;
getLegs('set',nLegs);
getGpsLegs('clear');
transitDepth = min(5,depth);
lastWaypoint = [lat lon];

% create transit to start and turn on sonar
transit{1} = getgps;
duration = calcDuration(0,depth,15,rpm);
transit{2} = waypointgeo(lat,lon,depth,rpm,duration);

transit{2}.depth = min(depth,3);
transit{2}.duration = 1200;
transit{3} = ascend(0,rpm,depth);
transit{4} = getgps;
transit{5} = controlsonar('pingOn');

% add transit
mission = [transit];

n = 10; %number of behaviours in a leg
h = waitbar(0,'Calculating Mission, Please wait...');
for i=1:nLegs,
    
    leg = [];
    [lat,lon] = reckonTrackline(lastWaypoint(1),lastWaypoint(2),tracklead,legLength,az);
    
    duration = calcDuration(lat(1),lon(1),lastWaypoint(1),lastWaypoint(2),rpm);
    leg{1} = waypointgeo(lat(1),lon(1),depth,rpm,duration);

    leg{2} = tracklinegeo(lat(1),lon(1),lat(2),lon(2),depth,rpm);
    leg{3} = controlsonar('on');
    leg{4} = tracklinegeo(lat(2),lon(2),lat(3),lon(3),depth,rpm);
    leg{5} = controlsonar('off');
    leg{6} = tracklinegeo(lat(3),lon(3),lat(4),lon(4),depth,rpm);
    
    az = mod(az+90,360);
    [templat,templon] = reckon('rh',lat(4), lon(4),tracklead,az,geoid);
    
    
    duration = calcDuration(lat(4),lon(4),templat,templon,rpm);
    leg{7} = waypointgeo(templat,templon,depth,rpm,duration);
    
    az = mod(az+90,360);
    [templat,templon] = reckon('rh',templat, templon,tracklead,az,geoid);
    
    duration = calcDuration(lat(4),lon(4),templat,templon,rpm);
    leg{8} = waypointgeo(templat,templon,depth,rpm,duration);
    
    leg{9} = ascend(az,rpm,depth);
    leg{10} = getgps;
    
    mission = [mission leg];
    
    az = mod(az+90,360);
    lastWaypoint = [lat(3) lon(3)];
    getGpsLegs('set',1);
    %[lat,lon] = reckon('rh',lat(end),lon(end),sqrt(tracklead*tracklead),az+turn,geoid);
    waitbar(i/nLegs,h)    
end
close(h)

% power down sonar
mission{end+1} = controlsonar('pingOff');

notransit = mission(6:size(mission));

% delete empties
ind = [];
for ii=1:length(mission),
	if isempty(mission{ii}), ind = [ind ii]; end
end
mission(ind) = [];

% reverse order
mission = fliplr(mission);
