/*
 * @Author: zjk 1553836110@qq.com
 * @Date: 2023-10-12 15:57:27
 * @LastEditors: zjk 1553836110@qq.com
 * @LastEditTime: 2023-11-07 11:33:04
 * @FilePath: /moos-ivp-pi/src/pMotionControler/MotionControler.hpp
 * @Description: 
 * 
 * Copyright (c) 2023 by ${git_name_email}, All Rights Reserved. 
 */
#ifndef TESTAPP
#define TESEAPP
#include"MOOS/libMOOS/Thirdparty/AppCasting/AppCastingMOOSApp.h"
#include <iostream>
#include"pidControl.hpp"
#include<vector>
// #include"MOOS/libMOOS/Comms/XPCUdpSocket.h"
using namespace std;
class MotionControler : public AppCastingMOOSApp
{
  public:
  MotionControler(){};
  ~MotionControler(){};
  bool OnNewMail(MOOSMSG_LIST &NewMail);
  bool Iterate();
  bool OnConnectToServer();
  bool OnStartUp();
  void registerVariables();
  bool buildReport();
  
  void postPenginePostings();
  void postPengineResults();
  void postColVarToBS(int T, int S, int R);
  void postCharStatus();

  const string MSG_FALUT = "uMotion_fault_fb";
  const string MSG_ReadConfig = "uMotion_config_cmd";
  const string MSG_TO_BS = "uMotion_control_cmd";

  private:
  bool ignore_nav_yaw;
  bool allstop_posted;
  bool verbose;
  bool override;
  double ok_skew = 2;
  int faultCode = 0;
  double setFrequency;
  double frequency_delta;
  
  Json::Value RepList;
  Json::StreamWriterBuilder RepJsBuilder;
  Json::Value colVar;

  pidControl pengine;
  string configFilePath;
  int e;


  
};

#endif

//1.读取参数配置错误 faultCode = 10~
//2.信息过时错误 faultCode=1
//3.频率相差过大错误 faultCode=2