###############################################################################
#
# PURPOSE: Box mission 300 m offshore of MISO
# AUTHORS: (1) Rob McEwen 03/10/2006
#          (2)
# NOTE:    Sequential behavoirs are bottom-up.  Priorities are top-down.
# MODS:
#
###############################################################################




#
# Precomputed Miso box corners, assuming channel axis is at 334.
#
#iboxSW  = [36.606819 -121.874569]
#iboxNW  = [36.609244 -121.876043]
#iboxNWa = [36.608435 -121.875552]
#iboxSE  = [36.607016 -121.874066]
#iboxNE  = [36.609441 -121.875539]
#oboxNW  = [36.611669 -121.877516]
#oboxNWa = [36.610860 -121.877025]
#oboxNE  = [36.611866 -121.877013]
#
behavior missionTimer
{
  timeOut = 1210;
}
#
# Depth Envelope
#
behavior depthEnvelope
{
  minDepth = 0; #Meters
  maxDepth = 15; #Meters
  minAltitude = 5;#Meters
  abortDepth = 17; #Meters
}

behavior getgps
{
minHits = 10;
duration = 60;
}

behavior ascend
{
  duration = 120; #Seconds
  horizontalMode = rudder; #Mode
  horizontal = -10; #Degrees; 
  pitch = 15; #Degrees
  speed = 1.5; #Meters/sec
  endDepth = 2; #Meters
}
#
# oboxNE  = [36.611866 -121.877013]
#
behavior waypoint
{
latitude = 36.611866;
longitude = -121.877013;
duration = 300;
depth = 15;
speed = 1.5;
}
#
# iboxNE = [36.609441 -121.875539]
#
behavior waypoint
{
latitude = 36.609441;
longitude = -121.875539;
duration = 60;
depth = 15;
speed = 1.5;
}
#
# Transponder location is at iboxNW.  But let's send the vehicle to
# iboxNE, so it will be obvious that it is homing.
# iboxNW = [36.609244 -121.876043]
# iboxNE = [36.609441 -121.875539]
#latitude          = 36.609441;
#longitude         = -121.875539;
#
# Dock:
#latitude          =   36.606685;
#longitude         = -121.874230;
#
# 6 July.  We are not dropping a transponder, but are going to home on the
# Miso transponder and rely on the time-out to terminate the homing behavior.
# We'll set the waypoint to be iboxNW so that if the Usbl never gets Miso,
# the vehicle will still fly a box.
#
behavior waypoint_homing
{
latitude = 36.609244;
longitude = -121.876043;
duration = 140;
depth = 15;
speed = 1.5;
dockBearing = 154.;
}
#
# 525 m at 334 Deg from MISO; oboxNWa
# 36.610860 -121.877025
#
behavior waypoint
{
latitude = 36.610860;
longitude = -121.877025;
duration = 100;
depth = 15;
speed = 1.5;
}
#
# 625 m at 334 Deg from MISO; oboxNW
# 36.611669 -121.877516
behavior waypoint
{
latitude = 36.611669;
longitude = -121.877516;
duration = 300;
depth = 15;
speed = 1.5;
}
#
# descend behavior for launch.  Head towards the NW corner
# of the box.
#
behavior descend
{
duration = 90;
horizontalMode = heading;
horizontal = 244;
pitch = -10;
speed = 1.5;
maxDepth = 12;
minAltitude = 5;
}

# setpoint on surface to accelerate to speed.

behavior setpoint
{
duration = 30;
heading = 244;
speed = 1.5;
verticalMode = pitch;
pitch = 0;
}

behavior getgps
{
minHits = 10;
duration = 60;
abortOnTimeout = True;
}
