迁移分支
This commit is contained in:
211
src/pFaultHandle/FaultHandle.h
Normal file
211
src/pFaultHandle/FaultHandle.h
Normal file
@@ -0,0 +1,211 @@
|
||||
/************************************************************/
|
||||
/* NAME: wade */
|
||||
/* ORGN: MIT */
|
||||
/* FILE: FaultHandle.h */
|
||||
/* DATE: */
|
||||
/************************************************************/
|
||||
|
||||
#ifndef FaultHandle_HEADER
|
||||
#define FaultHandle_HEADER
|
||||
|
||||
#include "MOOS/libMOOS/Thirdparty/AppCasting/AppCastingMOOSApp.h"
|
||||
#include "MOOS/libMOOS/MOOSLib.h"
|
||||
//#include "moos.h"
|
||||
#include <json/json.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
//class FaultHandle : public CMOOSApp
|
||||
class FaultHandle : public AppCastingMOOSApp
|
||||
{
|
||||
public:
|
||||
FaultHandle();
|
||||
~FaultHandle();
|
||||
|
||||
|
||||
protected: // Standard MOOSApp functions to overload
|
||||
bool OnNewMail(MOOSMSG_LIST &NewMail);
|
||||
bool Iterate();
|
||||
bool OnConnectToServer();
|
||||
bool OnStartUp();
|
||||
bool buildReport();
|
||||
|
||||
void RegisterVariables();
|
||||
|
||||
protected:
|
||||
void handleMailNewDBClients();
|
||||
void handleMailStatusUpdate(std::string);
|
||||
|
||||
bool handleConfigWatchList(std::string);
|
||||
bool handleConfigWatchItem(std::string);
|
||||
|
||||
bool handleConfigExcludeList(std::string);
|
||||
bool handleConfigExcludeItem(std::string);
|
||||
|
||||
protected:
|
||||
bool addToWatchList(std::string);
|
||||
|
||||
void checkForIndividualUpdates();
|
||||
void postFullSummary();
|
||||
|
||||
bool isAlive(std::string);
|
||||
void procNotedHere(std::string);
|
||||
void procNotedGone(std::string);
|
||||
void procNotedExcused(std::string);
|
||||
|
||||
void handlePostMapping(std::string);
|
||||
std::string postVar(std::string);
|
||||
|
||||
void populateAntlerList();
|
||||
|
||||
bool processIncluded(const std::string& procname);
|
||||
bool processExcluded(const std::string& procname);
|
||||
|
||||
protected:
|
||||
std::string convertSecondsToString(double);
|
||||
|
||||
void errorMsgInit();
|
||||
|
||||
void MoosAppStatusMonitor();
|
||||
void MoosAppOverloadMonitor();
|
||||
void MissionFaultMonitor();
|
||||
void MotionControlMonitor();
|
||||
void DeviceLeakageMonitor();
|
||||
void BatteryStatusMonitor();
|
||||
void EmergencyBatteryMonitor();
|
||||
void ThrustStatusMonitor();
|
||||
void CPUTempMonitor();
|
||||
void FaultReset();
|
||||
|
||||
|
||||
bool MoosAppMissing();
|
||||
bool MoosAppOverload();
|
||||
|
||||
|
||||
protected: // State Variables
|
||||
bool m_proc_watch_summary_changed;
|
||||
double m_last_posting_time;
|
||||
|
||||
// Clients and Summary stored across iterations
|
||||
std::string m_db_clients;
|
||||
std::string m_proc_watch_summary;
|
||||
|
||||
std::vector<std::string> m_watch_list;
|
||||
std::vector<std::string> m_excused_list;
|
||||
|
||||
// Mapping from proc name to data
|
||||
std::map<std::string, bool> m_map_alive;
|
||||
std::map<std::string, bool> m_map_alive_prev;
|
||||
std::map<std::string, unsigned int> m_map_noted_gone;
|
||||
std::map<std::string, unsigned int> m_map_noted_here;
|
||||
std::map<std::string, double> m_map_now_cpuload;
|
||||
std::map<std::string, double> m_map_max_cpuload;
|
||||
|
||||
std::set<std::string> m_set_db_clients;
|
||||
std::set<std::string> m_set_watch_clients;
|
||||
std::set<std::string> m_set_antler_clients;
|
||||
|
||||
protected: // Configurations Variables
|
||||
bool m_watch_all_db;
|
||||
bool m_watch_all_antler;
|
||||
double m_allow_retractions;
|
||||
double m_min_wait;
|
||||
double m_noted_gone_wait;
|
||||
|
||||
// Include List
|
||||
std::vector<std::string> m_include_list;
|
||||
std::vector<bool> m_include_list_prefix;
|
||||
|
||||
// Exclude List
|
||||
std::vector<std::string> m_exclude_list;
|
||||
std::vector<bool> m_exclude_list_prefix;
|
||||
|
||||
// A dedicated MOOS var for posting when a proc chgs status
|
||||
std::map<std::string, std::string> m_map_proc_post;
|
||||
|
||||
// A map for changing the MOOS variable posted.
|
||||
std::map<std::string, std::string> m_map_chgpost;
|
||||
|
||||
protected:
|
||||
int m_Mission_fault_fb;
|
||||
int m_Motion_fault_fb;
|
||||
double m_CPU_temperature;
|
||||
bool m_resetMsg_fb;
|
||||
|
||||
uint32_t m_faultBattery;
|
||||
uint32_t m_faultEmergencyBattery;
|
||||
uint32_t m_faultLeakSensor;
|
||||
uint32_t m_faultThrust;
|
||||
uint32_t m_batteryLevel;
|
||||
|
||||
Json::Value Device_monitor;
|
||||
Json::Value MoosApp_cpuLoad;
|
||||
Json::Value MoosAppStatus;
|
||||
Json::Value uFH_ErrorMsg_fb;
|
||||
|
||||
Json::Value uFH_errorMsg1_fb;
|
||||
Json::Value uFH_errorMsg2_fb;
|
||||
Json::Value uFH_errorMsg3_fb;
|
||||
|
||||
|
||||
Json::Value msg3_faultID_array;
|
||||
Json::Value msg2_PSfaultID_array;
|
||||
Json::Value msg2_emergencyPS_array;
|
||||
Json::Value msg2_thrust_Status_array;
|
||||
|
||||
Json::Value msg1_faultID_array;
|
||||
|
||||
//--------------------------------------test------------------------------
|
||||
//std::string ODO_StatusStr;
|
||||
|
||||
std::string BSC_StatusStr;
|
||||
std::string DM_StatusStr;
|
||||
std::string MC_StatusStr;
|
||||
std::string SSC_StatusStr;
|
||||
std::string TM_StatusStr;
|
||||
|
||||
|
||||
std::string pOdometryCPUload;
|
||||
std::string BSC_CPUloadStr;
|
||||
std::string DM_CPUloadStr;
|
||||
std::string MC_CPUloadStr;
|
||||
std::string SSC_CPUloadStr;
|
||||
std::string TM_CPUloadStr;
|
||||
|
||||
|
||||
//double ABC;
|
||||
double BSC_cpuload;
|
||||
double DM_cpuload;
|
||||
double MC_cpuload;
|
||||
double SSC_cpuload;
|
||||
double TM_cpuload;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------test------------------------------
|
||||
protected:
|
||||
//Contingency variable
|
||||
|
||||
// bool uSensor_leakage_fb;
|
||||
// bool uMission_deepOut_fb;
|
||||
// bool uMission_timeOut_fb;
|
||||
// bool uDrive_batteryLow_fb;
|
||||
// double uSoftWare_appMiss_fb; //AppID
|
||||
|
||||
//------------------------------------------------
|
||||
//subscribe variables
|
||||
|
||||
|
||||
private: // Configuration variables
|
||||
|
||||
private: // State variables
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user