00001 /* 00002 Copyright (c) 2000-2002, 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 */ 00059 #ifndef _SERVERSETTINGS_ 00060 #define _SERVERSETTINGS_ 00061 00062 #include "GenericValues.h" 00063 00064 /******************************************************************************/ 00065 /******************** CLASS SERVERSETTINGS ********************************/ 00066 /******************************************************************************/ 00067 00074 class ServerSettings:public GenericValues 00075 { 00076 private: 00077 // private member data 00078 00079 // all the parameters available in server.conf 00080 // NOTE: names in server.conf corresponding with member variables 00081 // are listed between doxygen-tags to enable quick searching 00082 00083 // goal-related parameters 00084 double dGoalWidth; 00086 // player-related parameters 00087 double dPlayerSize; 00088 double dPlayerDecay; 00089 double dPlayerRand; 00090 double dPlayerWeight; 00091 double dPlayerSpeedMax; 00092 double dPlayerAccelMax; 00095 // stamina-related parameters 00096 double dStaminaMax; 00097 double dStaminaIncMax; 00099 double dRecoverDecThr; 00101 double dRecoverDec; 00103 double dRecoverMin; 00104 double dEffortDecThr; 00106 double dEffortDec; 00108 double dEffortIncThr; 00110 double dEffortInc; 00112 double dEffortMin; 00113 double dEffortMax; 00116 // parameters related to auditory perception 00117 int iHearMax; 00120 int iHearInc; 00123 int iHearDecay; 00127 // parameters related to player turn actions 00128 double dInertiaMoment; 00131 // parameters related to sense_body information 00132 int iSenseBodyStep; 00135 // goalkeeper-related parameters 00136 double dCatchableAreaL; 00138 double dCatchableAreaW; 00140 double dCatchProbability; 00142 int iCatchBanCycle; 00144 int iGoalieMaxMoves; 00147 // ball-related parameters 00148 double dBallSize; 00149 double dBallDecay; 00150 double dBallRand; 00151 double dBallWeight; 00152 double dBallSpeedMax; 00153 double dBallAccelMax; 00156 // wind-related parameters 00157 double dWindForce; 00158 double dWindDir; 00159 double dWindRand; 00160 bool bWindRandom; 00162 // parameters related to 'dash' and 'kick' commands 00163 double dKickableMargin; 00166 double dCkickMargin; 00169 double dDashPowerRate; 00173 double dKickPowerRate; 00177 double dKickRand; 00179 // parameters related to visual and auditory perception range 00180 double dVisibleAngle; 00182 double dAudioCutDist; 00185 // quantization parameters 00186 double dQuantizeStep; 00188 double dQuantizeStepL; 00191 // range parameters for basic actuator commands 00192 int iMaxPower; 00193 int iMinPower; 00194 int iMaxMoment; 00195 int iMinMoment; 00196 int iMaxNeckMoment; 00197 int iMinNeckMoment; 00198 int iMaxNeckAng; 00199 int iMinNeckAng; 00201 // port-related parameters 00202 int iPort; 00203 int iCoachPort; 00204 int iOlCoachPort; 00206 // coach-related parameters 00207 int iSayCoachCntMax; 00209 int iSayCoachMsgSize; 00211 int iClangWinSize; 00213 int iClangDefineWin; 00215 int iClangMetaWin; 00217 int iClangAdviceWin; 00219 int iClangInfoWin; 00221 int iClangMessDelay; 00224 int iClangMessPerCycle; 00226 int iSendViStep; 00230 // time-related parameters 00231 int iSimulatorStep; 00233 int iSendStep; 00236 int iRecvStep; 00238 int iHalfTime; 00240 int iDropBallTime; 00244 // speech-related parameters 00245 int iSayMsgSize; 00248 // offside-related parameters 00249 bool bUseOffside; 00251 double dOffsideActiveAreaSize; 00254 bool bForbidKickOffOffside; 00257 double dOffsideKickMargin; 00262 // log-related parameters 00263 bool bVerbose; 00266 int iRecordVersion; 00267 bool bRecordLog; 00269 bool bSendLog; 00271 bool bLogTimes; 00273 char strLogFile[ 256 ]; 00276 // all the parameters available in player.conf (for heterogeneous players) 00277 // NOTE: names in player.conf corresponding with member variables 00278 // are listed between doxygen-tags to enable quick searching 00279 00280 int iPlayerTypes; 00282 int iSubsMax; 00286 double dPlayerSpeedMaxDeltaMin; 00288 double dPlayerSpeedMaxDeltaMax; 00290 double dStaminaIncMaxDeltaFactor; 00293 double dPlayerDecayDeltaMin; 00295 double dPlayerDecayDeltaMax; 00297 double dInertiaMomentDeltaFactor; 00300 double dDashPowerRateDeltaMin; 00302 double dDashPowerRateDeltaMax; 00304 double dPlayerSizeDeltaFactor; 00306 double dKickableMarginDeltaMin; 00308 double dKickableMarginDeltaMax; 00310 double dKickRandDeltaFactor; 00312 double dExtraStaminaDeltaMin; 00314 double dExtraStaminaDeltaMax; 00316 double dEffortMaxDeltaFactor; 00318 double dEffortMinDeltaFactor; 00320 double dNewDashPowerRateDeltaMin; 00323 double dNewDashPowerRateDeltaMax; 00326 double dNewStaminaIncMaxDeltaFactor; 00331 // other parameters 00332 int iSlowDownFactor; 00334 double dVisibleDistance; 00337 double dExtraStamina; 00340 // parameters which depend on other values 00341 double dMaximalKickDist; 00344 // public methods 00345 public: 00346 // constructor for ServerSettings class 00347 ServerSettings( ); 00348 00349 // methods 'setValue' and 'readValues' from superclass 00350 // GenericValues are overridden in this subclass 00351 bool setValue ( const char *strName , const char *strValue ); 00352 bool readValues( char *strFilename, char *Separator ); 00353 00354 // set- and get methods for private member variables 00355 00356 // set- and get methods for goal-related parameters 00357 bool setGoalWidth ( double d ); 00358 double getGoalWidth ( ) const; 00359 00360 // set- and get methods for player-related parameters 00361 bool setPlayerSize ( double d ); 00362 double getPlayerSize ( ) const; 00363 bool setPlayerDecay ( double d ); 00364 double getPlayerDecay ( ) const; 00365 bool setPlayerRand ( double d ); 00366 double getPlayerRand ( ) const; 00367 bool setPlayerWeight ( double d ); 00368 double getPlayerWeight ( ) const; 00369 bool setPlayerSpeedMax ( double d ); 00370 double getPlayerSpeedMax ( ) const; 00371 bool setPlayerAccelMax ( double d ); 00372 double getPlayerAccelMax ( ) const; 00373 00374 // set- and get methods for stamina-related parameters 00375 bool setStaminaMax ( double d ); 00376 double getStaminaMax ( ) const; 00377 bool setStaminaIncMax ( double d ); 00378 double getStaminaIncMax ( ) const; 00379 bool setRecoverDecThr ( double d ); 00380 double getRecoverDecThr ( ) const; 00381 bool setRecoverDec ( double d ); 00382 double getRecoverDec ( ) const; 00383 bool setRecoverMin ( double d ); 00384 double getRecoverMin ( ) const; 00385 bool setEffortDecThr ( double d ); 00386 double getEffortDecThr ( ) const; 00387 bool setEffortDec ( double d ); 00388 double getEffortDec ( ) const; 00389 bool setEffortIncThr ( double d ); 00390 double getEffortIncThr ( ) const; 00391 bool setEffortInc ( double d ); 00392 double getEffortInc ( ) const; 00393 bool setEffortMin ( double d ); 00394 double getEffortMin ( ) const; 00395 00396 // set- and get methods for parameters related to auditory perception 00397 bool setHearMax ( int i ); 00398 int getHearMax ( ) const; 00399 bool setHearInc ( int i ); 00400 int getHearInc ( ) const; 00401 bool setHearDecay ( int i ); 00402 int getHearDecay ( ) const; 00403 00404 // set- and get methods for parameters related to player turn actions 00405 bool setInertiaMoment ( double d ); 00406 double getInertiaMoment ( ) const; 00407 00408 // set- and get methods for parameters related to sense_body information 00409 bool setSenseBodyStep ( int i ) ; 00410 int getSenseBodyStep ( ) const; 00411 00412 // set- and get methods for goalke eper-related parameters 00413 bool setCatchableAreaL ( double d ); 00414 double getCatchableAreaL ( ) const; 00415 bool setCatchableAreaW ( double d ); 00416 double getCatchableAreaW ( ) const; 00417 bool setCatchProbability ( double d ); 00418 double getCatchProbability ( ) const; 00419 bool setCatchBanCycle ( int i ) ; 00420 int getCatchBanCycle ( ) const; 00421 bool setGoalieMaxMoves ( int i ) ; 00422 int getGoalieMaxMoves ( ) const; 00423 00424 // set- and get methods for ball-related parameters 00425 bool setBallSize ( double d ); 00426 double getBallSize ( ) const; 00427 bool setBallDecay ( double d ); 00428 double getBallDecay ( ) const; 00429 bool setBallRand ( double d ); 00430 double getBallRand ( ) const; 00431 bool setBallWeight ( double d ); 00432 double getBallWeight ( ) const; 00433 bool setBallSpeedMax ( double d ); 00434 double getBallSpeedMax ( ) const; 00435 bool setBallAccelMax ( double d ); 00436 double getBallAccelMax ( ) const; 00437 00438 // set- and get methods for wind-related parameters 00439 bool setWindForce ( double d ); 00440 double getWindForce ( ) const; 00441 bool setWindDir ( double d ); 00442 double getWindDir ( ) const; 00443 bool setWindRand ( double d ); 00444 double getWindRand ( ) const; 00445 bool setWindRandom ( bool b ); 00446 bool getWindRandom ( ) const; 00447 00448 // set- and get methods for parameters related to 'dash' and 'kick' commands 00449 bool setKickableMargin ( double d ); 00450 double getKickableMargin ( ) const; 00451 bool setCkickMargin ( double d ); 00452 double getCkickMargin ( ) const; 00453 bool setDashPowerRate ( double d ); 00454 double getDashPowerRate ( ) const; 00455 bool setKickPowerRate ( double d ); 00456 double getKickPowerRate ( ) const; 00457 bool setKickRand ( double d ); 00458 double getKickRand ( ) const; 00459 00460 // set- and get methods for parameters related 00461 // to visual and auditory perception range 00462 bool setVisibleAngle ( double d ); 00463 double getVisibleAngle ( ) const; 00464 bool setAudioCutDist ( double d ); 00465 double getAudioCutDist ( ) const; 00466 00467 // set- and get methods for quantization parameters 00468 bool setQuantizeStep ( double d ); 00469 double getQuantizeStep ( ) const; 00470 bool setQuantizeStepL ( double d ); 00471 double getQuantizeStepL ( ) const; 00472 00473 // set- and get methods for range parameters for basic actuator commands 00474 bool setMaxPower ( int i ) ; 00475 int getMaxPower ( ) const; 00476 bool setMinPower ( int i ) ; 00477 int getMinPower ( ) const; 00478 bool setMaxMoment ( int i ) ; 00479 int getMaxMoment ( ) const; 00480 bool setMinMoment ( int i ) ; 00481 int getMinMoment ( ) const; 00482 bool setMaxNeckMoment ( int i ) ; 00483 int getMaxNeckMoment ( ) const; 00484 bool setMinNeckMoment ( int i ) ; 00485 int getMinNeckMoment ( ) const; 00486 bool setMaxNeckAng ( int i ) ; 00487 int getMaxNeckAng ( ) const; 00488 bool setMinNeckAng ( int i ) ; 00489 int getMinNeckAng ( ) const; 00490 00491 // set- and get methods for port-related parameters 00492 bool setPort ( int i ) ; 00493 int getPort ( ) const; 00494 bool setCoachPort ( int i ) ; 00495 int getCoachPort ( ) const; 00496 bool setOlCoachPort ( int i ) ; 00497 int getOlCoachPort ( ) const; 00498 00499 // set- and get methods for coach-related parameters 00500 bool setSayCoachCntMax ( int i ) ; 00501 int getSayCoachCntMax ( ) const; 00502 bool setSayCoachMsgSize ( int i ) ; 00503 int getSayCoachMsgSize ( ) const; 00504 bool setClangWinSize ( int i ) ; 00505 int getClangWinSize ( ) const; 00506 bool setClangDefineWin ( int i ) ; 00507 int getClangDefineWin ( ) const; 00508 bool setClangMetaWin ( int i ) ; 00509 int getClangMetaWin ( ) const; 00510 bool setClangAdviceWin ( int i ) ; 00511 int getClangAdviceWin ( ) const; 00512 bool setClangInfoWin ( int i ) ; 00513 int getClangInfoWin ( ) const; 00514 bool setClangMessDelay ( int i ) ; 00515 int getClangMessDelay ( ) const; 00516 bool setClangMessPerCycle ( int i ) ; 00517 int getClangMessPerCycle ( ) const; 00518 bool setSendViStep ( int i ) ; 00519 int getSendViStep ( ) const; 00520 00521 // set- and get methods for time-related parameters 00522 bool setSimulatorStep ( int i ) ; 00523 int getSimulatorStep ( ) const; 00524 bool setSendStep ( int i ) ; 00525 int getSendStep ( ) const; 00526 bool setRecvStep ( int i ) ; 00527 int getRecvStep ( ) const; 00528 bool setHalfTime ( int i ) ; 00529 int getHalfTime ( ) const; 00530 bool setDropBallTime ( int i ) ; 00531 int getDropBallTime ( ) const; 00532 00533 // set- and get methods for speech-related parameters 00534 bool setSayMsgSize ( int i ) ; 00535 int getSayMsgSize ( ) const; 00536 00537 // set- and get methods for offside-related parameters 00538 bool setUseOffside ( bool b ) ; 00539 bool getUseOffside ( ) const; 00540 bool setOffsideActiveAreaSize ( double d ) ; 00541 double getOffsideActiveAreaSize ( ) const; 00542 bool setForbidKickOffOffside ( bool b ) ; 00543 bool getForbidKickOffOffside ( ) const; 00544 bool setOffsideKickMargin ( double d ) ; 00545 double getOffsideKickMargin ( ) const; 00546 00547 // set- and get methods for log-related parameters 00548 bool setVerbose ( bool b ) ; 00549 bool getVerbose ( ) const; 00550 bool setRecordVersion ( int i ) ; 00551 int getRecordVersion ( ) const; 00552 bool setRecordLog ( bool b ) ; 00553 bool getRecordLog ( ) const; 00554 bool setSendLog ( bool b ) ; 00555 bool getSendLog ( ) const; 00556 bool setLogTimes ( bool b ) ; 00557 bool getLogTimes ( ) const; 00558 bool setLogFile ( char *str ) ; 00559 char* getLogFile ( ) ; 00560 00561 // set- and get methods for heterogeneous player parameters from player.conf 00562 bool setPlayerTypes ( int i ) ; 00563 int getPlayerTypes ( ) const; 00564 bool setSubsMax ( int i ) ; 00565 int getSubsMax ( ) const; 00566 bool setPlayerSpeedMaxDeltaMin ( double d ) ; 00567 double getPlayerSpeedMaxDeltaMin ( ) const; 00568 bool setPlayerSpeedMaxDeltaMax ( double d ) ; 00569 double getPlayerSpeedMaxDeltaMax ( ) const; 00570 bool setStaminaIncMaxDeltaFactor ( double d ) ; 00571 double getStaminaIncMaxDeltaFactor ( ) const; 00572 bool setPlayerDecayDeltaMin ( double d ) ; 00573 double getPlayerDecayDeltaMin ( ) const; 00574 bool setPlayerDecayDeltaMax ( double d ) ; 00575 double getPlayerDecayDeltaMax ( ) const; 00576 bool setInertiaMomentDeltaFactor ( double d ) ; 00577 double getInertiaMomentDeltaFactor ( ) const; 00578 bool setDashPowerRateDeltaMin ( double d ) ; 00579 double getDashPowerRateDeltaMin ( ) const; 00580 bool setDashPowerRateDeltaMax ( double d ) ; 00581 double getDashPowerRateDeltaMax ( ) const; 00582 bool setPlayerSizeDeltaFactor ( double d ) ; 00583 double getPlayerSizeDeltaFactor ( ) const; 00584 bool setKickableMarginDeltaMin ( double d ) ; 00585 double getKickableMarginDeltaMin ( ) const; 00586 bool setKickableMarginDeltaMax ( double d ) ; 00587 double getKickableMarginDeltaMax ( ) const; 00588 bool setKickRandDeltaFactor ( double d ) ; 00589 double getKickRandDeltaFactor ( ) const; 00590 bool setExtraStaminaDeltaMin ( double d ) ; 00591 double getExtraStaminaDeltaMin ( ) const; 00592 bool setExtraStaminaDeltaMax ( double d ) ; 00593 double getExtraStaminaDeltaMax ( ) const; 00594 bool setEffortMaxDeltaFactor ( double d ) ; 00595 double getEffortMaxDeltaFactor ( ) const; 00596 bool setEffortMinDeltaFactor ( double d ) ; 00597 double getEffortMinDeltaFactor ( ) const; 00598 bool setNewDashPowerRateDeltaMin ( double d ) ; 00599 double getNewDashPowerRateDeltaMin ( ) const; 00600 bool setNewDashPowerRateDeltaMax ( double d ) ; 00601 double getNewDashPowerRateDeltaMax ( ) const; 00602 bool setNewStaminaIncMaxDeltaFactor( double d ) ; 00603 double getNewStaminaIncMaxDeltaFactor( ) const; 00604 00605 // set- and get methods for parameters not in server.conf or player.conf 00606 bool setEffortMax ( double d ) ; 00607 double getEffortMax ( ) const; 00608 bool setSlowDownFactor ( int i ) ; 00609 int getSlowDownFactor ( ) const; 00610 bool setVisibleDistance ( double d ) ; 00611 double getVisibleDistance ( ) const; 00612 bool setExtraStamina ( double d ) ; 00613 double getExtraStamina ( ) const; 00614 00615 // set- and get methods for parameters which depend on other values 00616 bool setMaximalKickDist ( double d ) ; 00617 double getMaximalKickDist ( ) const; 00618 }; 00619 00620 /******************************************************************************/ 00621 /******************** CLASS HETEROPLAYERTYPES *****************************/ 00622 /******************************************************************************/ 00623 00627 class HeteroPlayerSettings 00628 { 00629 // public member data 00630 public: 00631 double dPlayerSpeedMax; 00632 double dStaminaIncMax; 00634 double dPlayerDecay; 00635 double dInertiaMoment; 00637 double dDashPowerRate; 00641 double dPlayerSize; 00645 double dKickableMargin; 00648 double dKickRand; 00649 double dExtraStamina; 00651 double dEffortMax; 00652 double dEffortMin; 00654 void show( ostream &os = cout ); 00655 }; 00656 00657 #endif