//--------    FILE: alpha.bhv   -------------
initialize RUN = false
initialize TaskNum=t1
initialize SendTask=false
//--------------模式判断------------------------
set MODE = ACTIVE{
  RUN=true
} INACTIVE

set MODE = T1{
  MODE=ACTIVE
  TaskNum = t1
}


//----------路径点任务----------------------------
Behavior = BHV_Waypoint
{
  name      = waypt_survey
  pwt       = 100 //优先权重
  condition = MODE==T1

  //endflag   = START=false
  endflag = END_WayPoint=true

	configflag = CRUISE_SPD = $[SPEED]
	//configflag = OSPOS = $[OSX],$[OSY]

	activeflag = INFO=$[OWNSHIP]
	activeflag = INFO=$[BHVNAME]
	activeflag = INFO=$[BHVTYPE]

	//cycleflag = CINFO=$[OSX],$[OSY]

  wptflag = CurrentPointComplete=true
	wptflag = PREV=$(PX),$(PY)
	wptflag = NEXT=$(NX),$(NY)
	wptflag = TEST=$(X),$(Y)
	wptflag = OSPOS=$(OSX),$(OSY)
	//wptflag_on_start = true
  

  updates    = WPT_UPDATE
  //perpetual  = true

  templating = spawn

	//    speed_alt = 1.2
  //use_alt_speed = true
                lead = 8
         lead_damper = 1
       lead_to_start = false
               speed = 1   // meters per second
        capture_line = true
      capture_radius = 5.0
         slip_radius = 15.0
	efficiency_measure = all

               polygon = 60,-40
               order = normal
             //repeat  = 3

    visual_hints = nextpt_color=yellow
    visual_hints = nextpt_vertex_size=8
    visual_hints = nextpt_lcolor=gray70
    visual_hints = vertex_color=dodger_blue, edge_color=white
    visual_hints = vertex_size=5, edge_size=1
}


//--------------定深任务------------------
Behavior=BHV_ConstantDepth
{
  name = const_depth
  pwt = 100
  //condition = DEPLOY = true
  condition = MODE==T1
  duration = no-time-limit
  updates = DEPTH_UPDATE
  depth = 0
}

//--------------定向任务--------------------

Behavior=BHV_ConstantHeading
{
  name       = const_heading
  pwt        = 100
  //condition  = START_TURN = true
  //condition  = DEPLOY = true
  condition = MODE==T3
  perpetual  = true

  activeflag = TURN = started

  //endflag    = TURN = done
  //endflag    = RETURN = true
  //endflag    = START_TURN = false
  endflag    = START=false

          heading = 225
  complete_thresh = 5
       duration = no-time-limit
 }

//--------------定速任务--------------------
Behavior=BHV_ConstantSpeed
{
  name       = const_speed
  pwt        = 1000
  condition = MODE==T1
  perpetual  = true
  updates    = SPEED_UPDATE
  //endflag    = START=false

  speed = 5

  duration = no-time-limit
  //peakwidth = 0.5
  //basewidth = 0.5

}
//----------------安全模式-----------------------
//----------------计时器---------------------
Behavior = BHV_Timer
{ 
  name      = mtime
  condition = MODE==T1
  pwt = 100
  templating = spawn
	//duration_status = MSTATUS
	//duration = 10
  endflag = TIME_OUT=true

  updates      = TIMER_UPDATES        
  
  //perpetual  = true
}
//-------------最大深度限制--------------------------
Behavior = BHV_MaxDepth
{
  name = maxdepth
  pwt  = 200
  condition = MODE==ACTIVE
  updates = MAXDEEP_UPDATES
  max_depth = 20
  tolerance = 0
  duration = no-time-limit
}
//--------------安全区域设置-----------------------

 Behavior = BHV_OpRegion
 {
   // General Behavior Parameters
   // ---------------------------
   name         = op_region                 // example
   pwt          = 300                       // default
   condition = MODE==T5
   updates      = OPREGION_UPDATES          // example

   // Parameters specific to this behavior
   // ------------------------------------
                  max_time = 20              // default (seconds)
                 max_depth = 25              // default (meters)
              min_altitude = 0              // default (meters)
                 reset_var = OPREGION_RESET // example
        trigger_entry_time = 1              // default (seconds)
         trigger_exit_time = 0.5            // default (seconds) 

                   polygon = pts={-80,-00:-30,-175:150,-100:95,25}

    breached_altitude_flag = TaskFault = AltitudeOut
       breached_depth_flag = TaskFault = DepthOut
        breached_poly_flag = TaskFault = RegionOut
        breached_time_flag = TaskFault = TimeOut

              visual_hints = vertex_color = brown  // default
              visual_hints = vertex_size  = 3      // default
              visual_hints = edge_color   = aqua   // default
              visual_hints = edge_size    = 1      // default
 }