//-------------------------------------------------
// NAME: M. Benjamin, MIT MechE
// FILE: alpha.moos
//-------------------------------------------------

ServerHost = localhost
ServerPort = 9005
Community  = alpha

MOOSTimeWarp = 1

// Forest Lake
//LatOrigin  = 43.825300 
//LongOrigin = -70.330400 

// MIT Sailing Pavilion (use this one)
LatOrigin  = 42.358456 
LongOrigin = -71.087589


//------------------------------------------
// Antler configuration  block

ProcessConfig = ANTLER
{
  MSBetweenLaunches = 200

  Run = MOOSDB		     @ NewConsole = false
  Run = pMarineViewer	 @ NewConsole = false
  Run = uSimMarineX	   @ NewConsole = false
  Run = pNodeReporter	 @ NewConsole = false
  Run = pMarinePID	   @ NewConsole = false
  Run = pHelmIvP	     @ NewConsole = false
  Run = uProcessWatch	 @ NewConsole = false
  Run = pOdometry      @ NewConsole = false
	Run = pLogger        @ NewConsole = false
  Run = pRealm         @ NewConsole = false
  Run = uFldRescueMgr  @ NewConsole = false
  Run = uTimerScript   @ NewConsole = false
}

//------------------------------------------
// uTimerScript config block

ProcessConfig = uTimerScript
{
  reset_max  = unlimited
	reset_time = end
  event      = var=RESCUE_REQUEST, val=vname=alpha, time=1
}

	
//------------------------------------------
// uFldRescueMgr config block

ProcessConfig = uFldRescueMgr
{
  AppTick   = 4
  CommsTick = 4

	app_logging = true

	swim_file = mit_01.txt
	
	rescue_rng_min = 10
	rescue_rng_max = 20
	rescue_rng_pd  = 0.05
	
	show_rescue_rng = true
	rescue_rng_transparency = 0.2
}

//------------------------------------------
// pOdometry config block

ProcessConfig = pOdometry
{
  AppTick   = 4
  CommsTick = 4

	app_logging = true
}

	
//------------------------------------------
// pRealm config block

ProcessConfig = pRealm
{
  AppTick   = 4
  CommsTick = 4

	hist_var = FEEDBACK_MSG

	msg_max_hist = 20
	
	scope_set = name=events, vars=NEXT_POINT:PREV_POINT:RF_NEXT:RF_PREV:CURR_TIME
	scope_set = name=events, vars=CYCLE_STATUS:INDEX
}

	
//------------------------------------------
// uProcessWatch config block

ProcessConfig = uProcessWatch
{
  AppTick   = 4
  CommsTick = 4

  summary_wait = 5

  nowatch   = uXMS*
  nowatch   = uMAC*
  nowatch   = uPokeDB*
  nowatch   = uTermCommand*
  watch_all = true
}


//------------------------------------------
// pLogger config block

ProcessConfig = pLogger
{
  AppTick   = 8
  CommsTick = 8

  AsyncLog = true

  // For variables that are published in a bundle on their first post,
  // explicitly declare their logging request

  Log = IVPHELM_LIFE_EVENT @ 0 NOSYNC
  Log = APP_LOG @ 0 NOSYNC

  file = alpha

  LogAuxSrc = true
  WildCardLogging = true
  WildCardOmitPattern = *_STATUS
  WildCardOmitPattern = DB_VARSUMMARY
  WildCardOmitPattern = DB_RWSUMMARY
  WildCardOmitPattern = APPCAST
  WildCardExclusionLog = true
}

//------------------------------------------
// uSimMarine config block

ProcessConfig = uSimMarineX
{
  AppTick	  = 8
  CommsTick	= 8
 
	app_logging = true
	
  start_x       = 95
  start_y       = -30
  start_speed   = 0
  start_heading = 180

	max_acceleration = 0.25

	turn_spd_map_full_speed = 4
	turn_spd_map_null_speed = 0.5
	turn_spd_map_full_rate  = 100
	turn_spd_map_null_rate  = 2
	
  prefix        = NAV
  turn_rate     = 40
  thrust_map    = 0:0, 20:1, 40:2, 60:3, 80:4, 100:5
}

//------------------------------------------
// pHelmIvP config block

ProcessConfig = pHelmIvP
{
  MaxAppTick = 10
  AppTick    = 4
  CommsTick  = 4

  term_report_interval = 0

	app_logging = log
	
  bhv_dir_not_found_ok = true
  //ivp_behavior_dir = /Users/ddmikerb

	verbose = terse
	
  behaviors  = alpha.bhv
  domain     = course:0:359:360
  domain     = speed:0:4:21
}

//------------------------------------------
// pMarinePID config block

ProcessConfig = pMarinePID
{
  AppTick    = 10
  CommsTick  = 10

  max_sat_hdg_debug = false
  max_sat_spd_debug = true

  verbose       = true
  depth_control = false

  // SIM_INSTABILITY = 20

  // Yaw PID controller
  yaw_pid_kp		 = 1.2
  yaw_pid_kd		 = 0.0
  yaw_pid_ki		 = 0.3
  yaw_pid_integral_limit = 0.07

  // Speed PID controller
  speed_pid_kp		 = 1.0
  speed_pid_kd		 = 0.0
  speed_pid_ki		 = 0.0
  speed_pid_integral_limit = 0.07

  //MAXIMUMS
  maxrudder    = 100
  maxthrust    = 100

  // A non-zero SPEED_FACTOR overrides use of SPEED_PID
  // Will set DESIRED_THRUST = DESIRED_SPEED * SPEED_FACTOR
  speed_factor = 20
}

//------------------------------------------
// pMarineViewer config block

ProcessConfig = pMarineViewer
{
  AppTick    = 4
  CommsTick  = 4

	app_logging = true
	
  //tiff_file            = forrest19.tif
	tiff_file            = MIT_SP.tif
	
	vehicles_name_mode   = names
	
  set_pan_x            = -90
  set_pan_y            = -280
  zoom                 = 0.95
  vehicle_shape_scale  = 1.5
  hash_delta           = 50
  hash_shade           = 0.4
  hash_viewable        = true

  trails_point_size   = 1

  stale_report_thresh = 10
  stale_remove_thresh = 20

  // Appcast configuration
  appcast_height       = 75
  appcast_width        = 30
  appcast_viewable     = true
  appcast_color_scheme = indigo
  nodes_font_size      = xlarge
  procs_font_size      = xlarge
  appcast_font_size    = large
  
  scope = PHELMIVP_PID
  scope = DB_UPTIME
	
  left_context[vehicle_pick] = PROX_POLY_VIEW_$[UP_VNAME_CLOSEST]=toggle

	action = USM_ENABLED=false
	action = USM_TURN_RATE = 70
	action = USM_TURN_RATE = 50
	action = USM_TURN_RATE = 30
	action = USM_TURN_RATE = 10
	action = USM_TURN_RATE = 5
	action = USM_TURN_RATE = 2
	
  button_one = DEPLOY # DEPLOY=true
  button_one = MOOS_MANUAL_OVERRIDE=false # RETURN=false
  button_two = RETURN:T # RETURN=true
  button_three = RETURN:F # RETURN=false

  button_four = REVERSE # WPT_UPDATE=order=toggle

  //button_5 = ARROW # VIEW_ARROW="ctrx=20,ctry=-40,ang=135,bwid=10,blen=30,hwid=20,hlen=10,label=a,fill_color=yellow,fill_transparency=0.2,edge_color=off"
  button_5 = ARROW # VIEW_ARROW="ctrx=20,ctry=-40,ang=135,bwid=10,blen=30,hwid=20,hlen=10,label=a"
  button_6 = ARROW # VIEW_ARROW="ctrx=20,ctry=-40,ang=270,bwid=10,blen=30,hwid=20,hlen=10,label=a,fill_color=white,fill_transparency=0.1,edge_color=off"


	button_7 = DEPLOY:F # DEPLOY=false 

	button_8 = FOUND1 # FOUND_SWIMMER=swimmer_name=s2, finder=abe

	}

//------------------------------------------
// pNodeReporter config block

ProcessConfig = pNodeReporter
{
  MaxAppTick = 2
  AppTick  	 = 2
  CommsTick	 = 2

  platform_type   = kayak
  platform_length = 4
}