MOOS 0.2375
/home/toby/moos-ivp/MOOS-2375-Oct0611/Tools/Simulation/Ocean/uMVS/SimParams.cpp
Go to the documentation of this file.
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 at MIT 2001-2002 and Oxford 
00010 //   University 2003-2005. email: pnewman@robots.ox.ac.uk. 
00011 //      
00012 //   This file is part of a  MOOS Utility Component. 
00013 //        
00014 //   This program is free software; you can redistribute it and/or 
00015 //   modify it under the terms of the GNU General Public License as 
00016 //   published by the Free Software Foundation; either version 2 of the 
00017 //   License, or (at your option) any later version. 
00018 //          
00019 //   This program is distributed in the hope that it will be useful, 
00020 //   but WITHOUT ANY WARRANTY; without even the implied warranty of 
00021 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
00022 //   General Public License for more details. 
00023 //            
00024 //   You should have received a copy of the GNU General Public License 
00025 //   along with this program; if not, write to the Free Software 
00026 //   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 
00027 //   02111-1307, USA. 
00028 //
00030 
00031 
00032 // SimParams.cpp: implementation of the CSimParams class.
00033 //
00035 #ifdef _WIN32
00036     #pragma warning(disable : 4786)
00037 #endif
00038 
00039 #include "SimParams.h"
00040 
00041 
00043 // Construction/Destruction
00045 
00046 CSimParams::CSimParams()
00047 {
00048     //default of approximately 1m std...
00049     m_dfTOFStd = 0.00066;
00050     m_bImmediateAcousticLog = true;
00051 
00052     m_dfXYStd = 0.1;
00053     m_dfZStd  = 0.03;
00054     m_dfYawStd= MOOSDeg2Rad(0.5);
00055     m_dfXYVelStd = 0.02;
00056 
00057     m_bAddNoise = false;
00058     m_dfYawBias = 0;
00059 
00060 }
00061 
00062 CSimParams::~CSimParams()
00063 {
00064 
00065 }
00066 
00067 bool CSimParams::Load(STRING_LIST &sParams)
00068 {
00069     STRING_LIST::iterator p;
00070 
00071     for(p=sParams.begin();p!=sParams.end();p++)
00072     {
00073         string sLine,sTok,sVal;
00074         sLine=*p;
00075 
00076         if(GetTokenValPair(sLine,sTok,sVal))
00077         {
00078             if(MOOSStrCmp(sTok,"LogFile"))
00079             {
00080                 m_sLogFileName = sVal;
00081             }
00082             else if(MOOSStrCmp(sTok,"AddNoise"))
00083             {
00084                 m_bAddNoise = MOOSStrCmp(sVal,"TRUE");
00085             }
00086             else if(MOOSStrCmp(sTok,"InstantLogAcoustics"))
00087             {
00088                 m_bImmediateAcousticLog = MOOSStrCmp(sVal,"TRUE");
00089             }
00090             else if(MOOSStrCmp(sTok,"MultiPathProbablity"))
00091             {
00092                 m_dfProbMultiPath = atof(sVal.c_str());
00093             }
00094             else if(MOOSStrCmp(sTok,"TOFNoise"))
00095             {
00096                 m_dfTOFStd = atof(sVal.c_str());
00097             }
00098             else if(MOOSStrCmp(sTok,"XYNOISE"))
00099             {
00100                 m_dfXYStd = atof(sVal.c_str());
00101             }
00102             else if(MOOSStrCmp(sTok,"ZNOISE"))
00103             {
00104                 m_dfZStd = atof(sVal.c_str());
00105             }
00106             else if(MOOSStrCmp(sTok,"YAWNOISE"))
00107             {
00108                 m_dfYawStd = atof(sVal.c_str());
00109                 m_dfYawStd = MOOSDeg2Rad(m_dfYawStd);
00110             }
00111             else if(MOOSStrCmp(sTok,"YAWBIAS"))
00112             {
00113                 m_dfYawBias = atof(sVal.c_str());
00114             }
00115             else if(MOOSStrCmp(sTok,"XYVELNOISE"))
00116             {
00117                 m_dfXYVelStd = atof(sVal.c_str());
00118             }
00119 
00120         
00121         }
00122     }
00123 
00124     return true;
00125 }
00126 
00127 bool CSimParams::GetTokenValPair(string sLine, string &sTok, string &sVal)
00128 {
00129     if(sLine.find("=")!=string::npos)
00130     {
00131         MOOSRemoveChars(sLine," \t\r");
00132         sTok = MOOSChomp(sLine,"=");
00133         sVal = sLine;
00134         return true;
00135     }
00136     else
00137     {
00138         return false;
00139     } 
00140 }
00141 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines