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

initialize   DEPLOY = false
initialize   RETURN = false
initialize   AVOIDING = idle
initialize   ZIGGING = false
//initialize   DRIFT_X = 0.5
//initialize   DRIFT_Y = 0.7

//----------------------------------------------
Behavior = BHV_LegRun
{ 
  name      = legs
  pwt       = 100
  condition = RETURN = false
  condition = DEPLOY = true
  condition = ZIGGING = false
	endflag   = RETURN = true
	endflag   = EFLAG  = endings=$[CTR2]

  updates    = LEG_UPDATE
  perpetual  = true

            lead = 5
     lead_damper = 1
           speed = 4.0   // meters per second
    capture_line = true
  capture_radius = 2
     slip_radius = 15

     	   vx1 = 70, -35
	       vx2 = -35, -85

         //vx1 = 100, -25
	       //vx2 = -70, -95

         //vx2 = -50, -120
	       //vx1 = 150, -120
	
          //points = 60,-40 : -40,-80
					repeat = 1

	legflag = PCT_TO_NEXT=$[PCT_NP]
	
	turn1_dir = port
	turn2_dir = star
	turn1_rad = 20
	turn2_rad = 20
	turn1_bias = 100
	turn2_bias = 100

	mid_pct = 10
	//midflag = ZIGGING=true
	
   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=6, edge_size=1
   visual_hints = turn_edge_color=white
   visual_hints = turn_vertext_color=green
   visual_hints = turn_label_color=off
}

//----------------------------------------------
Behavior = BHV_ZigZag
{ 
  name      = zig
  pwt       = 100
  condition = RETURN = false
  condition = DEPLOY = true
  condition = ZIGGING = true
	endflag   = ZIGGING = false

  updates    = ZIG_UPDATE
  perpetual  = true

           speed = 3.0   // meters per second

	stem_on_active = true
       zig_first = star
    max_zig_zags = 1
	     zig_angle = 55

      hdg_thresh = 2
	fierce_zigging = true
	}

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

	endflag   = EFLAG  = r_endings=$[CTR_02]
	cycleflag = CFLAG  = r_cyles=$[CTR_01]
	wptflag   = WFLAG  = r_waypoints=$[CTR]

      lead_condition = AVOIDING != active

                lead = 8
         lead_damper = 1
       lead_to_start = true

           speed = 2.0
  capture_radius = 2.0
     slip_radius = 8.0
          point = 0,-20
 }