//--------    FILE: alpha.bhv   -------------

initialize  DEPLOY = false
initialize  RETURN = false
initialize  OPREGION =true
initialize  STATION_KEEP = false
initialize  SURVEY  = true
initialize  AVOID   = true
initialize  SURVEY_UNDERWAY = false

set MODE = ACTIVE {
  DEPLOY = true
} INACTIVE

set MODE = STATION-KEEPING {
  MODE = ACTIVE
  STATION_KEEP = true
}                       

set MODE = RETURNING {
  MODE = ACTIVE
  RETURN = true
} SURVEYING


//----------------------------------------------
Behavior = BHV_Waypoint
{
  name         = waypt_survey
  pwt          = 100
  condition    = MODE==SURVEYING
  perpetual    = true
  updates      = SURVEY_UPDATES
  activeflag   = SURVEY_UNDERWAY = true
  inactiveflag = SURVEY_UNDERWAY = false
  endflag      = RETURN = true

         speed = 2   // meters per second
        radius = 5.0
   slip_radius = 15.0
          lead = 8
	  lead_damper=1
	points = format=lawnmower, label=survey, x=$(SURVEY_X), y=$(SURVEY_Y), width=$(WIDTH), height=$(HEIGHT),lane_width=$(LANE_WIDTH), rows=north-south, degs=$(DEGREES)

        repeat = 0
  visual_hints = nextpt_color=red, nextpt_lcolor=green
  visual_hints = vertex_color=yellow, edge_color=gray25
  visual_hints = vertex_size=1, edge_size=1
}

//----------------------------------------------
Behavior=BHV_Waypoint
{
  name       = waypt_return
  pwt        = 100
  condition  = MODE==RETURNING
  perpetual  = true
  updates    = RETURN_UPDATE
  endflag    = RETURN = false
  endflag    = STATION_KEEP = true
  endflag    = MISSION = complete

           speed = 2.0
  capture_radius = 2.0
     slip_radius = 8.0
          points = 0,-10
 }

//----------------------------------------------
Behavior = BHV_OpRegion
{
  name       = opregion
  pwt        = 100
  condition  = MODE==ACTIVE
  condition  = OPREGION=true
 

  // Polygon for testing polygon breach in alpha mission	   
  // polygon = pts={-35,-23 : -22,-53 : 86,-3   : 74,26}

  // Polygon for the alpha mission	   
  //polygon = pts={-35,-23 : -8,-86 : 102,-38 : 74,26}

  // Polygon for the 2.680 Front Estimation lab
  polygon = pts={-50,-40 : 100,20 : 180,20 : 180,-200 : -50,-200 : -100,-75}


    soft_poly_breach = true
  trigger_entry_time = 1
  trigger_exit_time  = 1
        visual_hints = edge_size=1, vertex_size=2
}


//----------------------------------------------
Behavior = BHV_StationKeep
{
  name         = station-keep
  pwt          = 100
  condition    = MODE==STATION-KEEPING
  activeflag   = OPREGION=false
  inactiveflag = OPREGION=true

     center_activate = true
        inner_radius = 5
        outer_radius = 10 
         outer_speed = 1.0

       transit_speed = 1.3
          swing_time = 7
        visual_hints = vertex_size=0, edge_color=gray50
}