00001 /* 00002 Copyright (c) 2000-2003, 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 */ 00030 00060 #ifndef _SERVERSETTINGS_ 00061 #define _SERVERSETTINGS_ 00062 00063 #include "GenericValues.h" 00064 00065 /*****************************************************************************/ 00066 /******************* CLASS SERVERSETTINGS ********************************/ 00067 /*****************************************************************************/ 00068 00075 class ServerSettings:public GenericValues 00076 { 00077 private: 00078 // private member data 00079 00080 // all the parameters available in server.conf 00081 // NOTE: names in server.conf corresponding with member variables 00082 // are listed between doxygen-tags to enable quick searching 00083 00084 // goal-related parameters 00085 double dGoalWidth; 00087 // player-related parameters 00088 double dPlayerSize; 00089 double dPlayerDecay; 00090 double dPlayerRand; 00091 double dPlayerWeight; 00092 double dPlayerSpeedMax; 00093 double dPlayerAccelMax; 00096 // stamina-related parameters 00097 double dStaminaMax; 00098 double dStaminaIncMax; 00100 double dRecoverDecThr; 00102 double dRecoverDec; 00104 double dRecoverMin; 00105 double dEffortDecThr; 00107 double dEffortDec; 00109 double dEffortIncThr; 00111 double dEffortInc; 00113 double dEffortMin; 00114 double dEffortMax; 00117 // parameters related to auditory perception 00118 int iHearMax; 00121 int iHearInc; 00124 int iHearDecay; 00128 // parameters related to player turn actions 00129 double dInertiaMoment; 00132 // parameters related to sense_body information 00133 int iSenseBodyStep; 00136 // goalkeeper-related parameters 00137 double dCatchableAreaL; 00139 double dCatchableAreaW; 00141 double dCatchProbability; 00143 int iCatchBanCycle; 00145 int iGoalieMaxMoves; 00148 // ball-related parameters 00149 double dBallSize; 00150 double dBallDecay; 00151 double dBallRand; 00152 double dBallWeight; 00153 double dBallSpeedMax; 00154 double dBallAccelMax; 00157 // wind-related parameters 00158 double dWindForce; 00159 double dWindDir; 00160 double dWindRand; 00161 bool bWindRandom; 00163 // parameters related to 'dash' and 'kick' commands 00164 double dKickableMargin; 00167 double dCkickMargin; 00170 double dDashPowerRate; 00174 double dKickPowerRate; 00178 double dKickRand; 00180 // parameters related to visual and auditory perception range 00181 double dVisibleAngle; 00183 double dAudioCutDist; 00186 // quantization parameters 00187 double dQuantizeStep; 00189 double dQuantizeStepL; 00192 // range parameters for basic actuator commands 00193 int iMaxPower; 00194 int iMinPower; 00195 int iMaxMoment; 00196 int iMinMoment; 00197 int iMaxNeckMoment; 00198 int iMinNeckMoment; 00199 int iMaxNeckAng; 00200 int iMinNeckAng; 00202 // port-related parameters 00203 int iPort; 00204 int iCoachPort; 00205 int iOlCoachPort; 00207 // coach-related parameters 00208 int iSayCoachCntMax; 00210 int iSayCoachMsgSize; 00212 int iClangWinSize; 00214 int iClangDefineWin; 00216 int iClangMetaWin; 00218 int iClangAdviceWin; 00220 int iClangInfoWin; 00222 int iClangMessDelay; 00225 int iClangMessPerCycle; 00227 int iSendViStep; 00231 // time-related parameters 00232 int iSimulatorStep; 00234 int iSendStep; 00237 int iRecvStep; 00239 int iHalfTime; 00241 int iDropBallTime; 00245 // speech-related parameters 00246 int iSayMsgSize; 00249 // offside-related parameters 00250 bool bUseOffside; 00252 double dOffsideActiveAreaSize; 00255 bool bForbidKickOffOffside; 00258 double dOffsideKickMargin; 00263 // log-related parameters 00264 bool bVerbose; 00267 int iRecordVersion; 00268 bool bRecordLog; 00270 bool bSendLog; 00272 bool bLogTimes; 00274 char strLogFile[ 256 ]; 00275 bool bSynchMode; 00276 bool bFullStateL; 00277 bool bFullStateR; 00279 // all the parameters available in player.conf (for heterogeneous players) 00280 // NOTE: names in player.conf corresponding with member variables 00281 // are listed between doxygen-tags to enable quick searching 00282 00283 int iPlayerTypes; 00285 int iSubsMax; 00290 double dPlayerSpeedMaxDeltaMin; 00292 double dPlayerSpeedMaxDeltaMax; 00294 double dStaminaIncMaxDeltaFactor; 00297 double dPlayerDecayDeltaMin; 00299 double dPlayerDecayDeltaMax; 00301 double dInertiaMomentDeltaFactor; 00304 double dDashPowerRateDeltaMin; 00306 double dDashPowerRateDeltaMax; 00308 double dPlayerSizeDeltaFactor; 00310 double dKickableMarginDeltaMin; 00312 double dKickableMarginDeltaMax; 00314 double dKickRandDeltaFactor; 00316 double dExtraStaminaDeltaMin; 00318 double dExtraStaminaDeltaMax; 00320 double dEffortMaxDeltaFactor; 00322 double dEffortMinDeltaFactor; 00324 double dNewDashPowerRateDeltaMin; 00327 double dNewDashPowerRateDeltaMax; 00330 double dNewStaminaIncMaxDeltaFactor; 00334 // other parameters 00335 int iSlowDownFactor; 00337 double dVisibleDistance; 00340 double dExtraStamina; 00343 // penalty parameters 00344 double dPenDistX; 00346 double dPenMaxGoalieDistX; 00348 bool bPenAllowMultKicks; 00351 // tackle parameters 00352 double dTackleDist; 00354 double dTackleBackDist; 00356 double dTackleWidth; 00358 double dTackleExponent; 00360 int iTackleCycles; 00362 double dTacklePowerRate; 00364 // parameters which depend on other values 00365 double dMaximalKickDist; 00368 // public methods 00369 public: 00370 // constructor for ServerSettings class 00371 ServerSettings( ); 00372 00373 // methods 'setValue' and 'readValues' from superclass 00374 // GenericValues are overridden in this subclass 00375 bool setValue ( const char *strName , const char *strValue ); 00376 bool readValues( const char *strFilename, const char *Separator ); 00377 00378 // set- and get methods for private member variables 00379 00380 // set- and get methods for goal-related parameters 00381 bool setGoalWidth ( double d ); 00382 double getGoalWidth ( ) const; 00383 00384 // set- and get methods for player-related parameters 00385 bool setPlayerSize ( double d ); 00386 double getPlayerSize ( ) const; 00387 bool setPlayerDecay ( double d ); 00388 double getPlayerDecay ( ) const; 00389 bool setPlayerRand ( double d ); 00390 double getPlayerRand ( ) const; 00391 bool setPlayerWeight ( double d ); 00392 double getPlayerWeight ( ) const; 00393 bool setPlayerSpeedMax ( double d ); 00394 double getPlayerSpeedMax ( ) const; 00395 bool setPlayerAccelMax ( double d ); 00396 double getPlayerAccelMax ( ) const; 00397 00398 // set- and get methods for stamina-related parameters 00399 bool setStaminaMax ( double d ); 00400 double getStaminaMax ( ) const; 00401 bool setStaminaIncMax ( double d ); 00402 double getStaminaIncMax ( ) const; 00403 bool setRecoverDecThr ( double d ); 00404 double getRecoverDecThr ( ) const; 00405 bool setRecoverDec ( double d ); 00406 double getRecoverDec ( ) const; 00407 bool setRecoverMin ( double d ); 00408 double getRecoverMin ( ) const; 00409 bool setEffortDecThr ( double d ); 00410 double getEffortDecThr ( ) const; 00411 bool setEffortDec ( double d ); 00412 double getEffortDec ( ) const; 00413 bool setEffortIncThr ( double d ); 00414 double getEffortIncThr ( ) const; 00415 bool setEffortInc ( double d ); 00416 double getEffortInc ( ) const; 00417 bool setEffortMin ( double d ); 00418 double getEffortMin ( ) const; 00419 00420 // set- and get methods for parameters related to auditory perception 00421 bool setHearMax ( int i ); 00422 int getHearMax ( ) const; 00423 bool setHearInc ( int i ); 00424 int getHearInc ( ) const; 00425 bool setHearDecay ( int i ); 00426 int getHearDecay ( ) const; 00427 00428 // set- and get methods for parameters related to player turn actions 00429 bool setInertiaMoment ( double d ); 00430 double getInertiaMoment ( ) const; 00431 00432 // set- and get methods for parameters related to sense_body information 00433 bool setSenseBodyStep ( int i ) ; 00434 int getSenseBodyStep ( ) const; 00435 00436 // set- and get methods for goalkeeper-related parameters 00437 bool setCatchableAreaL ( double d ); 00438 double getCatchableAreaL ( ) const; 00439 bool setCatchableAreaW ( double d ); 00440 double getCatchableAreaW ( ) const; 00441 bool setCatchProbability ( double d ); 00442 double getCatchProbability ( ) const; 00443 bool setCatchBanCycle ( int i ) ; 00444 int getCatchBanCycle ( ) const; 00445 bool setGoalieMaxMoves ( int i ) ; 00446 int getGoalieMaxMoves ( ) const; 00447 00448 // set- and get methods for ball-related parameters 00449 bool setBallSize ( double d ); 00450 double getBallSize ( ) const; 00451 bool setBallDecay ( double d ); 00452 double getBallDecay ( ) const; 00453 bool setBallRand ( double d ); 00454 double getBallRand ( ) const; 00455 bool setBallWeight ( double d ); 00456 double getBallWeight ( ) const; 00457 bool setBallSpeedMax ( double d ); 00458 double getBallSpeedMax ( ) const; 00459 bool setBallAccelMax ( double d ); 00460 double getBallAccelMax ( ) const; 00461 00462 // set- and get methods for wind-related parameters 00463 bool setWindForce ( double d ); 00464 double getWindForce ( ) const; 00465 bool setWindDir ( double d ); 00466 double getWindDir ( ) const; 00467 bool setWindRand ( double d ); 00468 double getWindRand ( ) const; 00469 bool setWindRandom ( bool b ); 00470 bool getWindRandom ( ) const; 00471 00472 // set- and get methods for parameters related to 'dash' and 'kick' commands 00473 bool setKickableMargin ( double d ); 00474 double getKickableMargin ( ) const; 00475 bool setCkickMargin ( double d ); 00476 double getCkickMargin ( ) const; 00477 bool setDashPowerRate ( double d ); 00478 double getDashPowerRate ( ) const; 00479 bool setKickPowerRate ( double d ); 00480 double getKickPowerRate ( ) const; 00481 bool setKickRand ( double d ); 00482 double getKickRand ( ) const; 00483 00484 // set- and get methods for parameters related 00485 // to visual and auditory perception range 00486 bool setVisibleAngle ( double d ); 00487 double getVisibleAngle ( ) const; 00488 bool setAudioCutDist ( double d ); 00489 double getAudioCutDist ( ) const; 00490 00491 // set- and get methods for quantization parameters 00492 bool setQuantizeStep ( double d ); 00493 double getQuantizeStep ( ) const; 00494 bool setQuantizeStepL ( double d ); 00495 double getQuantizeStepL ( ) const; 00496 00497 // set- and get methods for range parameters for basic actuator commands 00498 bool setMaxPower ( int i ) ; 00499 int getMaxPower ( ) const; 00500 bool setMinPower ( int i ) ; 00501 int getMinPower ( ) const; 00502 bool setMaxMoment ( int i ) ; 00503 int getMaxMoment ( ) const; 00504 bool setMinMoment ( int i ) ; 00505 int getMinMoment ( ) const; 00506 bool setMaxNeckMoment ( int i ) ; 00507 int getMaxNeckMoment ( ) const; 00508 bool setMinNeckMoment ( int i ) ; 00509 int getMinNeckMoment ( ) const; 00510 bool setMaxNeckAng ( int i ) ; 00511 int getMaxNeckAng ( ) const; 00512 bool setMinNeckAng ( int i ) ; 00513 int getMinNeckAng ( ) const; 00514 00515 // set- and get methods for port-related parameters 00516 bool setPort ( int i ) ; 00517 int getPort ( ) const; 00518 bool setCoachPort ( int i ) ; 00519 int getCoachPort ( ) const; 00520 bool setOlCoachPort ( int i ) ; 00521 int getOlCoachPort ( ) const; 00522 00523 // set- and get methods for coach-related parameters 00524 bool setSayCoachCntMax ( int i ) ; 00525 int getSayCoachCntMax ( ) const; 00526 bool setSayCoachMsgSize ( int i ) ; 00527 int getSayCoachMsgSize ( ) const; 00528 bool setClangWinSize ( int i ) ; 00529 int getClangWinSize ( ) const; 00530 bool setClangDefineWin ( int i ) ; 00531 int getClangDefineWin ( ) const; 00532 bool setClangMetaWin ( int i ) ; 00533 int getClangMetaWin ( ) const; 00534 bool setClangAdviceWin ( int i ) ; 00535 int getClangAdviceWin ( ) const; 00536 bool setClangInfoWin ( int i ) ; 00537 int getClangInfoWin ( ) const; 00538 bool setClangMessDelay ( int i ) ; 00539 int getClangMessDelay ( ) const; 00540 bool setClangMessPerCycle ( int i ) ; 00541 int getClangMessPerCycle ( ) const; 00542 bool setSendViStep ( int i ) ; 00543 int getSendViStep ( ) const; 00544 00545 // set- and get methods for time-related parameters 00546 bool setSimulatorStep ( int i ) ; 00547 int getSimulatorStep ( ) const; 00548 bool setSendStep ( int i ) ; 00549 int getSendStep ( ) const; 00550 bool setRecvStep ( int i ) ; 00551 int getRecvStep ( ) const; 00552 bool setHalfTime ( int i ) ; 00553 int getHalfTime ( ) const; 00554 bool setDropBallTime ( int i ) ; 00555 int getDropBallTime ( ) const; 00556 00557 // set- and get methods for speech-related parameters 00558 bool setSayMsgSize ( int i ) ; 00559 int getSayMsgSize ( ) const; 00560 00561 // set- and get methods for offside-related parameters 00562 bool setUseOffside ( bool b ) ; 00563 bool getUseOffside ( ) const; 00564 bool setOffsideActiveAreaSize ( double d ) ; 00565 double getOffsideActiveAreaSize ( ) const; 00566 bool setForbidKickOffOffside ( bool b ) ; 00567 bool getForbidKickOffOffside ( ) const; 00568 bool setOffsideKickMargin ( double d ) ; 00569 double getOffsideKickMargin ( ) const; 00570 00571 // set- and get methods for log-related parameters 00572 bool setVerbose ( bool b ) ; 00573 bool getVerbose ( ) const; 00574 bool setRecordVersion ( int i ) ; 00575 int getRecordVersion ( ) const; 00576 bool setRecordLog ( bool b ) ; 00577 bool getRecordLog ( ) const; 00578 bool setSendLog ( bool b ) ; 00579 bool getSendLog ( ) const; 00580 bool setLogTimes ( bool b ) ; 00581 bool getLogTimes ( ) const; 00582 bool setLogFile ( char *str ) ; 00583 char* getLogFile ( ) ; 00584 bool setSynchMode ( bool b ) ; 00585 bool getSynchMode ( ) const; 00586 bool setFullStateLeft ( bool b ) ; 00587 bool getFullStateLeft ( ) const; 00588 bool setFullStateRight ( bool b ) ; 00589 bool getFullStateRight ( ) const; 00590 00591 // set- and get methods for heterogeneous player parameters from player.conf 00592 bool setPlayerTypes ( int i ) ; 00593 int getPlayerTypes ( ) const; 00594 bool setSubsMax ( int i ) ; 00595 int getSubsMax ( ) const; 00596 bool setPlayerSpeedMaxDeltaMin ( double d ) ; 00597 double getPlayerSpeedMaxDeltaMin ( ) const; 00598 bool setPlayerSpeedMaxDeltaMax ( double d ) ; 00599 double getPlayerSpeedMaxDeltaMax ( ) const; 00600 bool setStaminaIncMaxDeltaFactor ( double d ) ; 00601 double getStaminaIncMaxDeltaFactor ( ) const; 00602 bool setPlayerDecayDeltaMin ( double d ) ; 00603 double getPlayerDecayDeltaMin ( ) const; 00604 bool setPlayerDecayDeltaMax ( double d ) ; 00605 double getPlayerDecayDeltaMax ( ) const; 00606 bool setInertiaMomentDeltaFactor ( double d ) ; 00607 double getInertiaMomentDeltaFactor ( ) const; 00608 bool setDashPowerRateDeltaMin ( double d ) ; 00609 double getDashPowerRateDeltaMin ( ) const; 00610 bool setDashPowerRateDeltaMax ( double d ) ; 00611 double getDashPowerRateDeltaMax ( ) const; 00612 bool setPlayerSizeDeltaFactor ( double d ) ; 00613 double getPlayerSizeDeltaFactor ( ) const; 00614 bool setKickableMarginDeltaMin ( double d ) ; 00615 double getKickableMarginDeltaMin ( ) const; 00616 bool setKickableMarginDeltaMax ( double d ) ; 00617 double getKickableMarginDeltaMax ( ) const; 00618 bool setKickRandDeltaFactor ( double d ) ; 00619 double getKickRandDeltaFactor ( ) const; 00620 bool setExtraStaminaDeltaMin ( double d ) ; 00621 double getExtraStaminaDeltaMin ( ) const; 00622 bool setExtraStaminaDeltaMax ( double d ) ; 00623 double getExtraStaminaDeltaMax ( ) const; 00624 bool setEffortMaxDeltaFactor ( double d ) ; 00625 double getEffortMaxDeltaFactor ( ) const; 00626 bool setEffortMinDeltaFactor ( double d ) ; 00627 double getEffortMinDeltaFactor ( ) const; 00628 bool setNewDashPowerRateDeltaMin ( double d ) ; 00629 double getNewDashPowerRateDeltaMin ( ) const; 00630 bool setNewDashPowerRateDeltaMax ( double d ) ; 00631 double getNewDashPowerRateDeltaMax ( ) const; 00632 bool setNewStaminaIncMaxDeltaFactor( double d ) ; 00633 double getNewStaminaIncMaxDeltaFactor( ) const; 00634 00635 // penalty parameters 00636 bool setPenDistX ( double d ) ; 00637 double getPenDistX ( ) const; 00638 bool setPenMaxGoalieDistX ( double d ) ; 00639 double getPenMaxGoalieDistX ( ) const; 00640 bool setPenAllowMultKicks ( bool b ) ; 00641 bool getPenAllowMultKicks ( ) const; 00642 00643 // tackle parameters 00644 bool setTackleDist ( double d ) ; 00645 double getTackleDist ( ) const; 00646 bool setTackleBackDist ( double d ) ; 00647 double getTackleBackDist ( ) const; 00648 bool setTackleWidth ( double d ) ; 00649 double getTackleWidth ( ) const; 00650 bool setTackleExponent ( double d ) ; 00651 double getTackleExponent ( ) const; 00652 bool setTackleCycles ( int i ) ; 00653 int getTackleCycles ( ) const; 00654 bool setTacklePowerRate ( double d ) ; 00655 double getTacklePowerRate ( ) const; 00656 00657 // set- and get methods for parameters not in server.conf or player.conf 00658 bool setEffortMax ( double d ) ; 00659 double getEffortMax ( ) const; 00660 bool setSlowDownFactor ( int i ) ; 00661 int getSlowDownFactor ( ) const; 00662 bool setVisibleDistance ( double d ) ; 00663 double getVisibleDistance ( ) const; 00664 bool setExtraStamina ( double d ) ; 00665 double getExtraStamina ( ) const; 00666 00667 // set- and get methods for parameters which depend on other values 00668 bool setMaximalKickDist ( double d ) ; 00669 double getMaximalKickDist ( ) const; 00670 }; 00671 00672 /******************************************************************************/ 00673 /******************** CLASS HETEROPLAYERTYPES *****************************/ 00674 /******************************************************************************/ 00675 00679 class HeteroPlayerSettings 00680 { 00681 // public member data 00682 public: 00683 double dPlayerSpeedMax; 00684 double dStaminaIncMax; 00686 double dPlayerDecay; 00687 double dInertiaMoment; 00689 double dDashPowerRate; 00693 double dPlayerSize; 00697 double dKickableMargin; 00700 double dKickRand; 00701 double dExtraStamina; 00703 double dEffortMax; 00704 double dEffortMin; 00706 double dMaximalKickDist; 00710 void show( ostream &os = cout ); 00711 }; 00712 00713 #endif