00001 /* 00002 Copyright (c) 2000,2001, Jelle Kok, University of Amsterdam 00003 All rights reserved. 00004 00005 Redistribution and use in source and binary forms, with or without 00006 modification, are permitted provided that the following conditions are met: 00007 00008 1. Redistributions of source code must retain the above copyright notice, this 00009 list of conditions and the following disclaimer. 00010 00011 2. Redistributions in binary form must reproduce the above copyright notice, 00012 this list of conditions and the following disclaimer in the documentation 00013 and/or other materials provided with the distribution. 00014 00015 3. Neither the name of the University of Amsterdam nor the names of its 00016 contributors may be used to endorse or promote products derived from this 00017 software without specific prior written permission. 00018 00019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00020 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00021 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00022 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 00023 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00024 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00025 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00026 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00027 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00028 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00029 */ 00049 #ifndef _SERVERSETTINGS_ 00050 #define _SERVERSETTINGS_ 00051 00052 #include "GenericValues.h" 00053 00054 /******************************************************************************/ 00055 /******************** CLASS SERVERSETTINGS ********************************/ 00056 /******************************************************************************/ 00057 00064 class ServerSettings:public GenericValues 00065 { 00066 private: 00067 // private member data 00068 00069 // all the parameters available in server.conf 00070 // NOTE: names in server.conf corresponding with member variables 00071 // are listed between doxygen-tags to enable quick searching 00072 00073 // goal-related parameters 00074 double dGoalWidth; 00077 // player-related parameters 00078 double dPlayerSize; 00079 double dPlayerDecay; 00080 double dPlayerRand; 00081 double dPlayerWeight; 00082 double dPlayerSpeedMax; 00083 double dPlayerAccelMax; 00086 // stamina-related parameters 00087 double dStaminaMax; 00088 double dStaminaIncMax; 00090 double dRecoverDecThr; 00092 double dRecoverDec; 00094 double dRecoverMin; 00095 double dEffortDecThr; 00097 double dEffortDec; 00099 double dEffortIncThr; 00101 double dEffortInc; 00103 double dEffortMin; 00106 // parameters related to auditory perception 00107 int iHearMax; 00110 int iHearInc; 00113 int iHearDecay; 00117 // parameters related to player turn actions 00118 double dInertiaMoment; 00121 // parameters related to sense_body information 00122 int iSenseBodyStep; 00125 // goalkeeper-related parameters 00126 double dCatchableAreaL; 00128 double dCatchableAreaW; 00130 double dCatchProbability; 00132 int iCatchBanCycle; 00134 int iGoalieMaxMoves; 00137 // ball-related parameters 00138 double dBallSize; 00139 double dBallDecay; 00140 double dBallRand; 00141 double dBallWeight; 00142 double dBallSpeedMax; 00143 double dBallAccelMax; 00146 // wind-related parameters 00147 double dWindForce; 00148 double dWindDir; 00149 double dWindRand; 00151 // parameters related to 'dash' and 'kick' commands 00152 double dKickableMargin; 00155 double dCkickMargin; 00158 double dDashPowerRate; 00162 double dKickPowerRate; 00166 double dKickRand; 00168 // parameters related to visual and auditory perception range 00169 double dVisibleAngle; 00171 double dAudioCutDist; 00174 // quantization parameters 00175 double dQuantizeStep; 00177 double dQuantizeStepL; 00180 // range parameters for basic actuator commands 00181 int iMaxPower; 00182 int iMinPower; 00183 int iMaxMoment; 00184 int iMinMoment; 00185 int iMaxNeckMoment; 00186 int iMinNeckMoment; 00187 int iMaxNeckAng; 00188 int iMinNeckAng; 00191 // port-related parameters 00192 int iPort; 00193 int iCoachPort; 00196 // coach-related parameters 00197 int iSayCoachCntMax; 00199 int iSayCoachMsgSize; 00201 int iClangWinSize; 00203 int iClangDefineWin; 00205 int iClangMetaWin; 00207 int iClangAdviceWin; 00209 int iClangInfoWin; 00211 int iClangMessDelay; 00214 int iClangMessPerCycle; 00216 int iSendViStep; 00220 // time-related parameters 00221 int iSimulatorStep; 00223 int iSendStep; 00226 int iRecvStep; 00228 int iHalfTime; 00230 int iDropBallTime; 00234 // speech-related parameters 00235 int iSayMsgSize; 00238 // offside-related parameters 00239 bool bUseOffside; 00241 double dOffsideActiveAreaSize; 00244 bool bForbidKickOffOffside; 00247 double dOffsideKickMargin; 00252 // log-related parameters 00253 bool bVerbose; 00256 int iRecordVersion; 00257 bool bRecordLog; 00259 bool bSendLog; 00261 bool bLogTimes; 00263 char strLogFile[ 256 ]; 00266 // all the parameters available in player.conf (for heterogeneous players) 00267 // NOTE: names in player.conf corresponding with member variables 00268 // are listed between doxygen-tags to enable quick searching 00269 00270 int iPlayerTypes; 00272 int iSubsMax; 00276 double dPlayerSpeedMaxDeltaMin; 00278 double dPlayerSpeedMaxDeltaMax; 00280 double dStaminaIncMaxDeltaFactor; 00283 double dPlayerDecayDeltaMin; 00285 double dPlayerDecayDeltaMax; 00287 double dInertiaMomentDeltaFactor; 00290 double dDashPowerRateDeltaMin; 00292 double dDashPowerRateDeltaMax; 00294 double dPlayerSizeDeltaFactor; 00296 double dKickableMarginDeltaMin; 00298 double dKickableMarginDeltaMax; 00300 double dKickRandDeltaFactor; 00302 double dExtraStaminaDeltaMin; 00304 double dExtraStaminaDeltaMax; 00306 double dEffortMaxDeltaFactor; 00308 double dEffortMinDeltaFactor; 00312 // important server parameters not in server.conf or player.conf 00313 double dEffortMax; 00315 int iSlowDownFactor; 00317 double dVisibleDistance; 00320 double dExtraStamina; 00323 // parameters which depend on other values 00324 double dMaximalKickDist; 00327 // public methods 00328 public: 00329 // constructor for ServerSettings class 00330 ServerSettings( ); 00331 00332 // methods 'setValue' and 'readValues' from superclass 00333 // GenericValues are overridden in this subclass 00334 bool setValue ( const char *strName , const char *strValue ); 00335 bool readValues( char *strFilename, char *Separator ); 00336 00337 // set- and get methods for private member variables 00338 00339 // set- and get methods for goal-related parameters 00340 bool setGoalWidth ( double d ); 00341 double getGoalWidth ( ) const; 00342 00343 // set- and get methods for player-related parameters 00344 bool setPlayerSize ( double d ); 00345 double getPlayerSize ( ) const; 00346 bool setPlayerDecay ( double d ); 00347 double getPlayerDecay ( ) const; 00348 bool setPlayerRand ( double d ); 00349 double getPlayerRand ( ) const; 00350 bool setPlayerWeight ( double d ); 00351 double getPlayerWeight ( ) const; 00352 bool setPlayerSpeedMax ( double d ); 00353 double getPlayerSpeedMax ( ) const; 00354 bool setPlayerAccelMax ( double d ); 00355 double getPlayerAccelMax ( ) const; 00356 00357 // set- and get methods for stamina-related parameters 00358 bool setStaminaMax ( double d ); 00359 double getStaminaMax ( ) const; 00360 bool setStaminaIncMax ( double d ); 00361 double getStaminaIncMax ( ) const; 00362 bool setRecoverDecThr ( double d ); 00363 double getRecoverDecThr ( ) const; 00364 bool setRecoverDec ( double d ); 00365 double getRecoverDec ( ) const; 00366 bool setRecoverMin ( double d ); 00367 double getRecoverMin ( ) const; 00368 bool setEffortDecThr ( double d ); 00369 double getEffortDecThr ( ) const; 00370 bool setEffortDec ( double d ); 00371 double getEffortDec ( ) const; 00372 bool setEffortIncThr ( double d ); 00373 double getEffortIncThr ( ) const; 00374 bool setEffortInc ( double d ); 00375 double getEffortInc ( ) const; 00376 bool setEffortMin ( double d ); 00377 double getEffortMin ( ) const; 00378 00379 // set- and get methods for parameters related to auditory perception 00380 bool setHearMax ( int i ); 00381 int getHearMax ( ) const; 00382 bool setHearInc ( int i ); 00383 int getHearInc ( ) const; 00384 bool setHearDecay ( int i ); 00385 int getHearDecay ( ) const; 00386 00387 // set- and get methods for parameters related to player turn actions 00388 bool setInertiaMoment ( double d ); 00389 double getInertiaMoment ( ) const; 00390 00391 // set- and get methods for parameters related to sense_body information 00392 bool setSenseBodyStep ( int i ) ; 00393 int getSenseBodyStep ( ) const; 00394 00395 // set- and get methods for goalkeeper-related parameters 00396 bool setCatchableAreaL ( double d ); 00397 double getCatchableAreaL ( ) const; 00398 bool setCatchableAreaW ( double d ); 00399 double getCatchableAreaW ( ) const; 00400 bool setCatchProbability ( double d ); 00401 double getCatchProbability ( ) const; 00402 bool setCatchBanCycle ( int i ) ; 00403 int getCatchBanCycle ( ) const; 00404 bool setGoalieMaxMoves ( int i ) ; 00405 int getGoalieMaxMoves ( ) const; 00406 00407 // set- and get methods for ball-related parameters 00408 bool setBallSize ( double d ); 00409 double getBallSize ( ) const; 00410 bool setBallDecay ( double d ); 00411 double getBallDecay ( ) const; 00412 bool setBallRand ( double d ); 00413 double getBallRand ( ) const; 00414 bool setBallWeight ( double d ); 00415 double getBallWeight ( ) const; 00416 bool setBallSpeedMax ( double d ); 00417 double getBallSpeedMax ( ) const; 00418 bool setBallAccelMax ( double d ); 00419 double getBallAccelMax ( ) const; 00420 00421 // set- and get methods for wind-related parameters 00422 bool setWindForce ( double d ); 00423 double getWindForce ( ) const; 00424 bool setWindDir ( double d ); 00425 double getWindDir ( ) const; 00426 bool setWindRand ( double d ); 00427 double getWindRand ( ) const; 00428 00429 // set- and get methods for parameters related to 'dash' and 'kick' commands 00430 bool setKickableMargin ( double d ); 00431 double getKickableMargin ( ) const; 00432 bool setCkickMargin ( double d ); 00433 double getCkickMargin ( ) const; 00434 bool setDashPowerRate ( double d ); 00435 double getDashPowerRate ( ) const; 00436 bool setKickPowerRate ( double d ); 00437 double getKickPowerRate ( ) const; 00438 bool setKickRand ( double d ); 00439 double getKickRand ( ) const; 00440 00441 // set- and get methods for parameters related 00442 // to visual and auditory perception range 00443 bool setVisibleAngle ( double d ); 00444 double getVisibleAngle ( ) const; 00445 bool setAudioCutDist ( double d ); 00446 double getAudioCutDist ( ) const; 00447 00448 // set- and get methods for quantization parameters 00449 bool setQuantizeStep ( double d ); 00450 double getQuantizeStep ( ) const; 00451 bool setQuantizeStepL ( double d ); 00452 double getQuantizeStepL ( ) const; 00453 00454 // set- and get methods for range parameters for basic actuator commands 00455 bool setMaxPower ( int i ) ; 00456 int getMaxPower ( ) const; 00457 bool setMinPower ( int i ) ; 00458 int getMinPower ( ) const; 00459 bool setMaxMoment ( int i ) ; 00460 int getMaxMoment ( ) const; 00461 bool setMinMoment ( int i ) ; 00462 int getMinMoment ( ) const; 00463 bool setMaxNeckMoment ( int i ) ; 00464 int getMaxNeckMoment ( ) const; 00465 bool setMinNeckMoment ( int i ) ; 00466 int getMinNeckMoment ( ) const; 00467 bool setMaxNeckAng ( int i ) ; 00468 int getMaxNeckAng ( ) const; 00469 bool setMinNeckAng ( int i ) ; 00470 int getMinNeckAng ( ) const; 00471 00472 // set- and get methods for port-related parameters 00473 bool setPort ( int i ) ; 00474 int getPort ( ) const; 00475 bool setCoachPort ( int i ) ; 00476 int getCoachPort ( ) const; 00477 00478 // set- and get methods for coach-related parameters 00479 bool setSayCoachCntMax ( int i ) ; 00480 int getSayCoachCntMax ( ) const; 00481 bool setSayCoachMsgSize ( int i ) ; 00482 int getSayCoachMsgSize ( ) const; 00483 bool setClangWinSize ( int i ) ; 00484 int getClangWinSize ( ) const; 00485 bool setClangDefineWin ( int i ) ; 00486 int getClangDefineWin ( ) const; 00487 bool setClangMetaWin ( int i ) ; 00488 int getClangMetaWin ( ) const; 00489 bool setClangAdviceWin ( int i ) ; 00490 int getClangAdviceWin ( ) const; 00491 bool setClangInfoWin ( int i ) ; 00492 int getClangInfoWin ( ) const; 00493 bool setClangMessDelay ( int i ) ; 00494 int getClangMessDelay ( ) const; 00495 bool setClangMessPerCycle ( int i ) ; 00496 int getClangMessPerCycle ( ) const; 00497 bool setSendViStep ( int i ) ; 00498 int getSendViStep ( ) const; 00499 00500 // set- and get methods for time-related parameters 00501 bool setSimulatorStep ( int i ) ; 00502 int getSimulatorStep ( ) const; 00503 bool setSendStep ( int i ) ; 00504 int getSendStep ( ) const; 00505 bool setRecvStep ( int i ) ; 00506 int getRecvStep ( ) const; 00507 bool setHalfTime ( int i ) ; 00508 int getHalfTime ( ) const; 00509 bool setDropBallTime ( int i ) ; 00510 int getDropBallTime ( ) const; 00511 00512 // set- and get methods for speech-related parameters 00513 bool setSayMsgSize ( int i ) ; 00514 int getSayMsgSize ( ) const; 00515 00516 // set- and get methods for offside-related parameters 00517 bool setUseOffside ( bool b ) ; 00518 bool getUseOffside ( ) const; 00519 bool setOffsideActiveAreaSize ( double d ) ; 00520 double getOffsideActiveAreaSize ( ) const; 00521 bool setForbidKickOffOffside ( bool b ) ; 00522 bool getForbidKickOffOffside ( ) const; 00523 bool setOffsideKickMargin ( double d ) ; 00524 double getOffsideKickMargin ( ) const; 00525 00526 // set- and get methods for log-related parameters 00527 bool setVerbose ( bool b ) ; 00528 bool getVerbose ( ) const; 00529 bool setRecordVersion ( int i ) ; 00530 int getRecordVersion ( ) const; 00531 bool setRecordLog ( bool b ) ; 00532 bool getRecordLog ( ) const; 00533 bool setSendLog ( bool b ) ; 00534 bool getSendLog ( ) const; 00535 bool setLogTimes ( bool b ) ; 00536 bool getLogTimes ( ) const; 00537 bool setLogFile ( char *str ) ; 00538 char* getLogFile ( ) ; 00539 00540 // set- and get methods for heterogeneous player parameters from player.conf 00541 bool setPlayerTypes ( int i ) ; 00542 int getPlayerTypes ( ) const; 00543 bool setSubsMax ( int i ) ; 00544 int getSubsMax ( ) const; 00545 bool setPlayerSpeedMaxDeltaMin ( double d ) ; 00546 double getPlayerSpeedMaxDeltaMin ( ) const; 00547 bool setPlayerSpeedMaxDeltaMax ( double d ) ; 00548 double getPlayerSpeedMaxDeltaMax ( ) const; 00549 bool setStaminaIncMaxDeltaFactor( double d ) ; 00550 double getStaminaIncMaxDeltaFactor( ) const; 00551 bool setPlayerDecayDeltaMin ( double d ) ; 00552 double getPlayerDecayDeltaMin ( ) const; 00553 bool setPlayerDecayDeltaMax ( double d ) ; 00554 double getPlayerDecayDeltaMax ( ) const; 00555 bool setInertiaMomentDeltaFactor( double d ) ; 00556 double getInertiaMomentDeltaFactor( ) const; 00557 bool setDashPowerRateDeltaMin ( double d ) ; 00558 double getDashPowerRateDeltaMin ( ) const; 00559 bool setDashPowerRateDeltaMax ( double d ) ; 00560 double getDashPowerRateDeltaMax ( ) const; 00561 bool setPlayerSizeDeltaFactor ( double d ) ; 00562 double getPlayerSizeDeltaFactor ( ) const; 00563 bool setKickableMarginDeltaMin ( double d ) ; 00564 double getKickableMarginDeltaMin ( ) const; 00565 bool setKickableMarginDeltaMax ( double d ) ; 00566 double getKickableMarginDeltaMax ( ) const; 00567 bool setKickRandDeltaFactor ( double d ) ; 00568 double getKickRandDeltaFactor ( ) const; 00569 bool setExtraStaminaDeltaMin ( double d ) ; 00570 double getExtraStaminaDeltaMin ( ) const; 00571 bool setExtraStaminaDeltaMax ( double d ) ; 00572 double getExtraStaminaDeltaMax ( ) const; 00573 bool setEffortMaxDeltaFactor ( double d ) ; 00574 double getEffortMaxDeltaFactor ( ) const; 00575 bool setEffortMinDeltaFactor ( double d ) ; 00576 double getEffortMinDeltaFactor ( ) const; 00577 00578 // set- and get methods for parameters not in server.conf or player.conf 00579 bool setEffortMax ( double d ) ; 00580 double getEffortMax ( ) const; 00581 bool setSlowDownFactor ( int i ) ; 00582 int getSlowDownFactor ( ) const; 00583 bool setVisibleDistance ( double d ) ; 00584 double getVisibleDistance ( ) const; 00585 bool setExtraStamina ( double d ) ; 00586 double getExtraStamina ( ) const; 00587 00588 // set- and get methods for parameters which depend on other values 00589 bool setMaximalKickDist ( double d ) ; 00590 double getMaximalKickDist ( ) const; 00591 }; 00592 00593 /******************************************************************************/ 00594 /******************** CLASS HETEROPLAYERTYPES *****************************/ 00595 /******************************************************************************/ 00596 00600 class HeteroPlayerSettings 00601 { 00602 // public member data 00603 public: 00604 double dPlayerSpeedMax; 00605 double dStaminaIncMax; 00607 double dPlayerDecay; 00608 double dInertiaMoment; 00610 double dDashPowerRate; 00614 double dPlayerSize; 00618 double dKickableMargin; 00621 double dKickRand; 00622 double dExtraStamina; 00624 double dEffortMax; 00625 double dEffortMin; 00627 void show( ostream &os = cout ); 00628 }; 00629 00630 #endif