MOOS 0.2375
|
00001 00002 // 00003 // MOOS - Mission Oriented Operating Suite 00004 // 00005 // A suit of Applications and Libraries for Mobile Robotics Research 00006 // Copyright (C) 2001-2005 Massachusetts Institute of Technology and 00007 // Oxford University. 00008 // 00009 // This software was written by Paul Newman and others 00010 // at MIT 2001-2002 and Oxford University 2003-2005. 00011 // email: pnewman@robots.ox.ac.uk. 00012 // 00013 // This file is part of a MOOS Basic (Common) Application. 00014 // 00015 // This program is free software; you can redistribute it and/or 00016 // modify it under the terms of the GNU General Public License as 00017 // published by the Free Software Foundation; either version 2 of the 00018 // License, or (at your option) any later version. 00019 // 00020 // This program is distributed in the hope that it will be useful, 00021 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00023 // General Public License for more details. 00024 // 00025 // You should have received a copy of the GNU General Public License 00026 // along with this program; if not, write to the Free Software 00027 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00028 // 02111-1307, USA. 00029 // 00031 00032 00033 // MOOSRemote.h: interface for the CMOOSRemote class. 00034 // 00036 00037 #if !defined(iRemoteh) 00038 #define iRemoteh 00039 00040 00041 class CMOOSRemote : public CMOOSApp 00042 { 00043 public: 00044 bool MakeHeading(); 00045 bool DoNavSummary(CMOOSMsg & Msg); 00046 class CCustomKey 00047 { 00048 public: 00049 CCustomKey(){bIsNumeric = false;}; 00050 char m_cChar; 00051 std::string m_sKey; 00052 std::string m_sVal; 00053 bool bIsNumeric; 00054 bool bAskToConfirm; 00055 }; 00056 typedef std::map< char ,CCustomKey> CUSTOMKEY_MAP; 00057 00058 class CJournal 00059 { 00060 public: 00061 CJournal(){}; 00062 CJournal(const std::string & sName, int nSize,char cKey) 00063 { 00064 m_nMaxSize=nSize; 00065 m_cKey = cKey; 00066 m_sName = sName; 00067 }; 00068 STRING_LIST m_Entries; 00069 char m_cKey; 00070 unsigned int m_nMaxSize; 00071 std::string m_sName; 00072 void Add(const std::string & sEntry) 00073 { 00074 m_Entries.push_back(sEntry); 00075 while(m_Entries.size()>m_nMaxSize) 00076 { 00077 m_Entries.pop_front(); 00078 } 00079 } 00080 }; 00081 00082 typedef std::map< std::string ,CJournal> CUSTOMJOURNAL_MAP; 00083 00084 00085 class CNavVar 00086 { 00087 public: 00088 CNavVar(){}; 00089 CNavVar(std::string sName,std::string sPrint ,double dfS) 00090 { 00091 m_sMessageName = sName; 00092 m_sPrintName = sPrint; 00093 m_dfScaleBy = dfS; 00094 m_dfVal = 0; 00095 m_dfTime = -1; 00096 } 00097 public: 00098 std::string m_sMessageName; 00099 std::string m_sPrintName; 00100 double m_dfScaleBy; 00101 double m_dfVal; 00102 double m_dfTime; 00103 }; 00104 typedef std::map< std::string ,CNavVar> NAVVAR_MAP; 00105 00106 00107 00108 bool WDLoop(); 00109 bool MailLoop(); 00110 CMOOSRemote(); 00111 virtual ~CMOOSRemote(); 00112 bool Run( const char * sName,const char * sMissionFile); 00113 00114 double m_dfCurrentElevator; 00115 double m_dfCurrentRudder; 00116 double m_dfCurrentThrust; 00117 double m_dfTimeLastSent; 00118 bool m_bManualOveride; 00119 00120 bool m_bRunMailLoop; 00121 00122 00123 00124 protected: 00125 bool PrintCustomSummary(); 00126 bool MakeCustomSummary(); 00127 bool MakeCustomKeys(); 00128 bool MakeCustomJournals(); 00129 00130 00131 bool HandleSAS(); 00132 bool ReStartAll(); 00133 bool MakeWayPoint(); 00134 bool HandleThirdPartyTask(); 00135 bool HandleScheduler(); 00136 bool PrintNavSummary(); 00137 bool EnableMailLoop(bool bEnable); 00138 bool HandleTopDownCal(); 00139 bool DoCustomKey(char cCmd); 00140 bool DoCustomJournal(char cCmd); 00141 bool HitInputWD(); 00142 bool DoWiggle(); 00143 bool SetManualOveride(bool bOveride); 00144 virtual bool OnConnectToServer(); 00145 bool OnStartUp(); 00146 bool StopThreads(); 00147 bool StartThreads(); 00148 bool FetchDB(); 00149 bool m_bQuit; 00150 double m_dfTimeLastAck; 00151 00152 STRING_LIST m_CustomSummaryList; 00153 00155 #ifdef _WIN32 00156 HANDLE m_hWDThread; 00157 #endif 00158 00159 unsigned long m_nWDThreadID; 00160 00162 #ifdef _WIN32 00163 HANDLE m_hMailThread; 00164 #endif 00165 00166 unsigned long m_nMailThreadID; 00167 00168 CMOOSLock m_Lock; 00169 bool SendDesired(); 00170 void PrintHelp( ); 00171 00172 CUSTOMKEY_MAP m_CustomKeys; 00173 00174 // a map of custom journals 00175 CUSTOMJOURNAL_MAP m_CustomJournals; 00176 //a map of nav vars used to keep a record of where 00177 //vehicle is... 00178 NAVVAR_MAP m_NavVars; 00179 00180 }; 00181 00182 #endif