bool CMOOSNavEngine::Initialise(STRING_LIST sParams) { //make a store for observations.. m_pStore = new CMOOSNavObsStore; //we may be being asked to map thrust to velocity string sVal; if(MOOSGetValueFromToken(sParams,"THRUST2VELOCITY",sVal)) { if(MOOSStrCmp(sVal,"TRUE")) { if(MOOSGetValueFromToken(sParams,"THRUST2VELOCITY_GAIN",sVal)) { m_bThrust2Vel = true; m_dfThrust2VelGain = atof(sVal.c_str()); } } } if(MOOSGetValueFromToken(sParams,"SV",sVal)) { double dfNewSV = atof(sVal.c_str()); if(dfNewSV !=0) { m_dfSV=dfNewSV; } } //set up navigation filter logging.... bool bLog = false; if(MOOSGetValueFromToken(sParams,"NAV_LOG",sVal)) { bLog = MOOSStrCmp(sVal,"TRUE"); } if(bLog) { string sPath=""; //do we have a globally defined path? CProcessConfigReader Reader; Reader.SetFile(m_sMissionFileName); if(!Reader.GetValue("GLOBALLOGPATH",sPath)) { //no..get it locally MOOSGetValueFromToken(sParams,"NAV_LOG_PATH",sPath); } bool bTimeStamp=false; if(MOOSGetValueFromToken(sParams,"NAV_LOG_TIMESTAMP",sVal)) { bTimeStamp = MOOSStrCmp(sVal,"TRUE"); } m_Logger.Initialise(m_sName,sPath,bTimeStamp); } //Allocate Global states.. SetUpGlobalStates(); AddTheVehicle(sParams); //fixed observations are attached to the COG... AddSensor("FIXED","COG", CMOOSNavSensor::FIXED,0,0,0); //set our default start up state... //set in constructor of derived classes SetOnline(m_bInitialOnline); return true; }
bool CMOOSLogger::CopyMissionFile() { //open the original ifstream MissionFile; MissionFile.open(m_sMissionFile.c_str()); if(!MissionFile.is_open()) return MOOSFail("\nWarning:\n\tfailed to open copy of mission file - it can't be backed up\n");; //open a copy file ofstream MissionCopy; if(!OpenFile(MissionCopy,m_sMissionCopyName)) return MOOSFail("Failed to open a destination copy of mission file"); //write a banner DoBanner(MissionCopy,m_sMissionCopyName); //do the copy.. while(!MissionFile.eof()) { char Tmp[10000]; MissionFile.getline(Tmp,sizeof(Tmp)); string sLine = string(Tmp); MissionCopy<<sLine.c_str()<<endl; } MissionCopy.close(); MissionFile.close(); //now look for hoof files! CProcessConfigReader HelmReader; HelmReader.SetFile(m_sMissionFile); HelmReader.SetAppName("pHelm"); string sHoof; if(HelmReader.GetConfigurationParam("TaskFile",sHoof)) { //open a copy file ofstream HoofCopy; if(!OpenFile(HoofCopy,m_sHoofCopyName)) return MOOSFail("Failed to copy of mission file"); //open the original ifstream HoofFile; HoofFile.open(sHoof.c_str()); if(HoofFile.is_open() && HoofCopy.is_open()) { //do the copy.. while(!HoofFile.eof()) { char Tmp[10000]; HoofFile.getline(Tmp,sizeof(Tmp)); string sLine = string(Tmp); HoofCopy<<sLine.c_str()<<endl; } HoofCopy.close(); HoofFile.close(); } } return true; }
bool COdysseyIVActuation::ReadConfig(CProcessConfigReader& Config) { Config.GetConfigurationParam("BowSternRatio", m_dfBowSternRatio); return true; }