/*
 * @Author: zjk 1553836110@qq.com
 * @Date: 2023-10-12 09:52:06
 * @LastEditors: zjk 1553836110@qq.com
 * @LastEditTime: 2023-10-24 15:11:21
 * @FilePath: /moos-ivp-extend/src/pMotionControler/main.cpp
 * @Description: 
 * 
 * Copyright (c) 2023 by ${git_name_email}, All Rights Reserved. 
 */
#include<iostream>
using namespace std;
#include"MOOS/libMOOS/Thirdparty/AppCasting/AppCastingMOOSApp.h"
// #include "VarDataPair.h"
#include"MotionControler.hpp"
#include <iostream>
#include<string>
#include "MBUtils.h"
#include "ColorParse.h"
// #include "MBUtils.h"
// #include "ColorParse.h"

int main(int argc, char *argv[])
{
  string mission_file;
  string run_command = argv[0];

  for(int i=1; i<argc; i++) {
    string argi = argv[i];
    if((argi=="-v") || (argi=="--version") || (argi=="-version"))
      // showReleaseInfoAndExit();
      cout << " Version : 0.01" << endl;
    else if((argi=="-e") || (argi=="--example") || (argi=="-example"))
      // showExampleConfigAndExit();
      cout << " example : NULL" << endl;
    else if((argi=="-h") || (argi == "--help") || (argi=="-help"))
      // showHelpAndExit();
      cout << " Low leave Control for UUV " << endl;
    else if((argi=="-i") || (argi == "--interface"))
      // showInterfaceAndExit();
      cout << " UUV Motion Control " << endl;
    else if(strEnds(argi, ".moos") || strEnds(argi, ".moos++"))
      mission_file = argv[i];
    else if(strBegins(argi, "--alias="))
      run_command = argi.substr(8);
    else if(i == 2)
      run_command = argi;
  }
  
  if(mission_file == "")
      // showHelpAndExit();

  cout << termColor("green");
  cout << "pMarinePIDV22 launching as " << run_command << endl;
  cout << termColor() << endl;

  MotionControler marinePID;
  marinePID.Run(run_command.c_str(), mission_file.c_str(), argc, argv);

  return(0);
}