/*****************************************************************/
/*    NAME: Michael Benjamin                                     */
/*    ORGN: Dept of Mechanical Eng / CSAIL, MIT Cambridge MA     */
/*    FILE: HazardMetric_Info.cpp                                */
/*    DATE: Mar 12th 2012                                        */
/*                                                               */
/* This file is part of MOOS-IvP                                 */
/*                                                               */
/* MOOS-IvP is free software: you can redistribute it and/or     */
/* modify it under the terms of the GNU General Public License   */
/* as published by the Free Software Foundation, either version  */
/* 3 of the License, or (at your option) any later version.      */
/*                                                               */
/* MOOS-IvP is distributed in the hope that it will be useful,   */
/* but WITHOUT ANY WARRANTY; without even the implied warranty   */
/* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See  */
/* the GNU General Public License for more details.              */
/*                                                               */
/* You should have received a copy of the GNU General Public     */
/* License along with MOOS-IvP.  If not, see                     */
/* <http://www.gnu.org/licenses/>.                               */
/*****************************************************************/

#include <cstdlib>
#include <iostream>
#include "HazardMetric_Info.h"
#include "ColorParse.h"
#include "ReleaseInfo.h"

using namespace std;

//----------------------------------------------------------------
// Procedure: showSynopsis

void showSynopsis()
{
  blk("SYNOPSIS:                                                       ");
  blk("------------------------------------                            ");
  blk("  The uFldHazardMetric application is used for grading incoming ");
  blk("  hazard reports, presumably generated by users of the          ");
  blk("  uFldHazardSensor after exploring a simulated hazard field.    ");
}

//----------------------------------------------------------------
// Procedure: showHelpAndExit

void showHelpAndExit()
{
  blk("                                                                ");
  blu("=============================================================== ");
  blu("Usage: uFldHazardMetric file.moos [OPTIONS]                     ");
  blu("=============================================================== ");
  blk("                                                                ");
  showSynopsis();
  blk("                                                                ");
  blk("Options:                                                        ");
  mag("  --alias","=<ProcessName>                                      ");
  blk("      Launch uFldHazardMetric with the given process name       ");
  blk("      rather than uFldHazardMetric.                             ");
  mag("  --example, -e                                                 ");
  blk("      Display example MOOS configuration block.                 ");
  mag("  --help, -h                                                    ");
  blk("      Display this help message.                                ");
  mag("  --interface, -i                                               ");
  blk("      Display MOOS publications and subscriptions.              ");
  mag("  --version,-v                                                  ");
  blk("      Display the release version of uFldHazardMetric.          ");
  blk("                                                                ");
  blk("Note: If argv[2] does not otherwise match a known option,       ");
  blk("      then it will be interpreted as a run alias. This is       ");
  blk("      to support pAntler launching conventions.                 ");
  blk("                                                                ");
  exit(0);
}

//----------------------------------------------------------------
// Procedure: showExampleConfigAndExit

void showExampleConfigAndExit()
{
  blk("                                                                ");
  blu("=============================================================== ");
  blu("uFldHazardMetric Example MOOS Configuration                     ");
  blu("=============================================================== ");
  blk("                                                                ");
  blk("ProcessConfig = uFldHazardMetric                                ");
  blk("{                                                               ");
  blk("  AppTick   = 4                                                 ");
  blk("  CommsTick = 4                                                 ");
  blk("                                                                ");
  blk("  penalty_missed_hazard = 100    // default                     ");
  blk("  penalty_false_alarm   = 10     // default                     ");
  blk("  penalty_max_time_over = 0      // default                     ");
  blk("  penalty_max_time_rate = 0      // default                     ");
  blk("                                                                ");
  blk("  max_time      = 0              // default (no time limit)     ");
  blk("  hazard_file   = hazards.txt                                   ");
  blk("}                                                               ");
  blk("                                                                ");
  exit(0);
}


//----------------------------------------------------------------
// Procedure: showInterfaceAndExit

void showInterfaceAndExit()
{
  blk("                                                                ");
  blu("=============================================================== ");
  blu("uFldHazardMetric INTERFACE                                      ");
  blu("=============================================================== ");
  blk("                                                                ");
  showSynopsis();
  blk("                                                                ");
  blk("SUBSCRIPTIONS:                                                  ");
  blk("------------------------------------                            ");
  blk("  APPCAST_REQ = (standard appcast request format)               ");
  blk("  HAZARDSET_REPORT = source=archie#                             ");
  blk("                     x=-151,y=-217.3,label=01#                  ");
  blk("                     x=-178.8,y=-234,label=15#                  ");
  blk("                     x=-59.8,y=-294.1,label=13                  ");
  blk("  HAZARD_SEARCH_START = true                                    ");
  blk("                                                                ");
  blk("PUBLICATIONS:                                                   ");
  blk("------------------------------------                            ");
  blk("  APPCAST = (standard appcast format)                           ");
  blk("  HAZARDSET_EVAL_VNAME      = (see below HAZARDSET_EVAL)        ");
  blk("  HAZARDSET_EVAL_FULL_VNAME = (see below HAZARDSET_EVAL_FULL)   ");
  blk("  HAZARDSET_EVAL  = vname=archie,                               ");
  blk("             report_name=BillandJoe,                            ");
  blk("             total_score=675,                                   ");
  blk("             norm_score=37.5,                                   ");
  blk("             score_missed_hazards=500,                          ");
  blk("             score_false_alarms=175,                            ");
  blk("             score_time_overage=0,                              ");
  blk("             total_objects=10,                                  ");
  blk("             total_time=1284.91,                                ");
  blk("             received_time=1314.05,                             ");
  blk("             start_time=29.14,                                  ");
  blk("             missed_hazards=5,                                  ");
  blk("             correct_hazards=5,                                 ");
  blk("             false_alarms=5,                                    ");
  blk("             penalty_false_alarm=35,                            ");
  blk("             penalty_missed_hazard=100,                         ");
  blk("             penalty_max_time_over=100,                         ");
  blk("             penalty_max_time_rate=0.05,                        ");
  blk("             max_time=1800                                      ");
  blk("  HAZARDSET_EVAL_FULL = (HAZARDSET_EVAL),object_report={        ");
  blk("             label=01,truth=hazard,report=hazard#               ");
  blk("             label=02,truth=hazard,report=nothing,penalty=100#  ");
  blk("             ...                                                ");
  blk("             label=17,truth=benign,report=nothing#              ");
  blk("             label=18,truth=benign,report=hazard,penalty=35}    ");
  blk("  UHZ_MISSION_PARAMS = penalty_missed_hazard=100,               ");
  blk("             penalty_nonopt_hazard=55,                          ");
  blk("             penalty_false_alarm=35,                            ");
  blk("             penalty_max_time_over=200,                         ");
  blk("             max_time=600,                                      ");
  blk("             penalty_max_time_rate=0.45,                        ");
  blk("             transit_path_width=25,                             ");
  blk("             search_region = pts={-150,-75:-150,-50:40,-50:40,-75}");
  blk("                                                                ");
  exit(0);
}

//----------------------------------------------------------------
// Procedure: showReleaseInfoAndExit

void showReleaseInfoAndExit()
{
  showReleaseInfo("uFldHazardMetric", "gpl");
  exit(0);
}









