⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 playersettings.cpp

📁 2003年RoboCup仿真组世界冠军源代码 足球机器人 仿真组 的源代码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/*Copyright (c) 2000-2003, Jelle Kok, University of AmsterdamAll rights reserved.Redistribution and use in source and binary forms, with or withoutmodification, are permitted provided that the following conditions are met:1. Redistributions of source code must retain the above copyright notice, thislist of conditions and the following disclaimer.2. Redistributions in binary form must reproduce the above copyright notice,this list of conditions and the following disclaimer in the documentationand/or other materials provided with the distribution.3. Neither the name of the University of Amsterdam nor the names of itscontributors may be used to endorse or promote products derived from thissoftware without specific prior written permission.THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THEIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AREDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLEFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIALDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ORSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVERCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USEOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*//*! \file PlayerSettings.cpp<pre><b>File:</b>          PlayerSettings.cpp<b>Project:</b>       Robocup Soccer Simulation Team: UvA Trilearn<b>Authors:</b>       Jelle Kok<b>Created:</b>       28/11/2000<b>Last Revision:</b> $ID$<b>Contents:</b>      Code file for class PlayerSettings. It contains all the               member method implementations of the PlayerSettings class.               This class contains all the settings that are important               for the client (agent) to determine its actions.<hr size=2><h2><b>Changes</b></h2><b>Date</b>             <b>Author</b>          <b>Comment</b>28/11/2000       Jelle Kok       Initial version created</pre>*/#include "PlayerSettings.h"/*****************************************************************************//********************* CLASS PlayerSettings **********************************//*****************************************************************************//*! This method initializes all client settings and adds these to the generic    values class with the effect that they can referenced by their textual    name. */PlayerSettings::PlayerSettings( ) : GenericValues("PlayerSettings", 27){  dPlayerConfThr         = 0.88; // threshold below player info is illegal  dPlayerHighConfThr     = 0.92; // threshold above which player info is high  dBallConfThr           = 0.90; // threshold below which ball info is illegal  dPlayerDistTolerance   = 7.5;  // distance when unknownplayer is mapped  dPlayerWhenToTurnAngle = 7.0;  // angle when to turn when moving  dPlayerWhenToKick      = 0.85; // % of kick power rate when kick is performed  iPlayerWhenToIntercept = 30;   // maximum number of interception cycles  dClearBallDist         = 5.0;  // dist before penalty area to clear ball to  dClearBallOppMaxDist   = 30.0; // radius in which opp in clear ball has to be  dClearBallToSideAngle  = 17.0; // minimum angle for clear ball to side  dConeWidth             = 0.5;  // cone width to check for opponents in pass  dPassEndSpeed          = 1.2;  // end speed for ball when passed to teammate  dFastPassEndSpeed      = 1.8;  // end speed for ball when passed fast  dPassExtraX            = 0.0;  // extra x value added to player passing pos  dFractionWaitNoSee     = 0.61;  // % of cycle to wait in cycle with no see  dFractionWaitSeeBegin  = 0.70; // % to wait in cycle with see in begin  dFractionWaitSeeEnd    = 0.85; // % to wait in cycle with see in 2nd  half  dMarkDistance          = 5.0;  // mark distance to a player  dStratAreaRadius       = 5.0;  // radius around strat pos to find optimal pos  dShootRiskProbability  = 0.88; // prob. of scoring when shooting with risk  iCyclesCatchWait       = 20;   // cycles to wait after a catch  iServerTimeOut         = 9;    // seconds before server is assumed dead  dDribbleAngThr         = 20.0; // angle thr. to turn to ball before dribbling  dTurnWithBallAngThr    = 45.0; // angle threshold to kick ball  dTurnWithBallFreezeThr = 0.2;  // ball speed threshold to freeze ball  iInitialFormation      = 2;    // initial formation number  dMaxYPercentage        = 0.8;  // max y in strat. pos (percentage of field)  // add all the settings and link text string to variable  addSetting( "player_conf_thr"     , &dPlayerConfThr,  GENERIC_VALUE_DOUBLE );  addSetting( "player_high_conf_thr", &dPlayerHighConfThr,                                                        GENERIC_VALUE_DOUBLE );  addSetting( "ball_conf_thr"      ,  &dBallConfThr,    GENERIC_VALUE_DOUBLE );  addSetting( "player_dist_tolerance",&dPlayerDistTolerance,                                                        GENERIC_VALUE_DOUBLE );  addSetting( "player_when_to_turn",  &dPlayerWhenToTurnAngle,                                                        GENERIC_VALUE_DOUBLE );  addSetting( "player_when_to_kick", &dPlayerWhenToKick,GENERIC_VALUE_DOUBLE );  addSetting( "player_when_to_intercept",&iPlayerWhenToIntercept,                                                        GENERIC_VALUE_INTEGER);  addSetting( "clear_ball_dist"    ,  &dClearBallDist,  GENERIC_VALUE_DOUBLE );  addSetting( "clear_ball_opp_max_dist", &dClearBallOppMaxDist,                                                        GENERIC_VALUE_DOUBLE );  addSetting( "clear_ball_side_angle", &dClearBallToSideAngle,                                                        GENERIC_VALUE_DOUBLE );  addSetting( "cone_width"         ,  &dConeWidth,      GENERIC_VALUE_DOUBLE );  addSetting( "pass_end_speed"     ,  &dPassEndSpeed,   GENERIC_VALUE_DOUBLE );  addSetting( "fast_pass_end_speed", &dFastPassEndSpeed,GENERIC_VALUE_DOUBLE );  addSetting( "pass_extra_x"       ,  &dPassExtraX,     GENERIC_VALUE_DOUBLE );  addSetting( "wait_no_see"        ,&dFractionWaitNoSee,GENERIC_VALUE_DOUBLE );  addSetting( "wait_see_begin" , &dFractionWaitSeeBegin,GENERIC_VALUE_DOUBLE );  addSetting( "wait_see_end"    , &dFractionWaitSeeEnd, GENERIC_VALUE_DOUBLE );  addSetting( "mark_distance"      ,  &dMarkDistance,   GENERIC_VALUE_DOUBLE );  addSetting( "strat_area_radius"  ,  &dStratAreaRadius,GENERIC_VALUE_DOUBLE );  addSetting( "shoot_risk_prob", &dShootRiskProbability,GENERIC_VALUE_DOUBLE );  addSetting( "cycles_catch_wait"  ,  &iCyclesCatchWait,GENERIC_VALUE_INTEGER);  addSetting( "server_time_out"    ,  &iServerTimeOut,  GENERIC_VALUE_INTEGER);  addSetting( "dribble_ang_thr"    ,  &dDribbleAngThr,  GENERIC_VALUE_DOUBLE );  addSetting( "turn_with_ball_ang_thr" , &dTurnWithBallAngThr,                                                        GENERIC_VALUE_DOUBLE );  addSetting( "turn_with_ball_freeze_thr" , &dTurnWithBallFreezeThr,                                                        GENERIC_VALUE_DOUBLE );  addSetting( "initial_formation"  , &iInitialFormation,GENERIC_VALUE_INTEGER);  addSetting( "max_y_percentage"   , &dMaxYPercentage,  GENERIC_VALUE_DOUBLE );}/*! This method returns the confidence threshold below which player information    is assumed illegal   \return player confidence threshold */double PlayerSettings::getPlayerConfThr( ) const{  return dPlayerConfThr;}/*! This method sets the confidence threshold below which player information is    assumed illegal    \param d player confidence threshold in range [0..1]    \return boolean indicating whether update was successful */bool PlayerSettings::setPlayerConfThr( double d ){  dPlayerConfThr = d;  return true;}/*! This method returns the confidence threshold above which player information    is assumed very good.    \return player high confidence threshold */double PlayerSettings::getPlayerHighConfThr( ) const{  return dPlayerHighConfThr;}/*! This method sets the confidence threshold above which player information is    assumed very good    \param d player high confidence threshold in range [0..1]    \return boolean indicating whether update was successful */bool PlayerSettings::setPlayerHighConfThr( double d ){  dPlayerHighConfThr = d;  return true;}/*! This method returns the confidence threshold below which ball information    is assumed illegal.    \return ball confidence threshold */double PlayerSettings::getBallConfThr( ) const{  return dBallConfThr;}/*! This method sets the confidence threshold below which ball information is    assumed illegal    \param d ball confidence threshold in range [0..1]    \return boolean indicating whether update was successful */bool PlayerSettings::setBallConfThr( double d ){  dBallConfThr = d;  return true;}/*! This method returns the radius in which a player has to be to be    mapped from unknown to known player    \return radius in which player is assumed same player. */double PlayerSettings::getPlayerDistTolerance( ) const{  return dPlayerDistTolerance;}/*! This method sets the radius in which a player has to be to be    mapped from unknown to known player    \param d radius (>0) in which player is assumed same player    \return boolean indicating whether update was successful */bool PlayerSettings::setPlayerDistTolerance( double d ){  dPlayerDistTolerance = d;  return true;}/*!This method returns the angle when a player determines to turn to a point   first before moving towards it.   \return global angle when player first moves before moving towards point*/double PlayerSettings::getPlayerWhenToTurnAngle( ) const{  return dPlayerWhenToTurnAngle;}/*! This method sets the angle when a player determines to turn to a point    first before moving towards it.    \param d global angle when player turns in move (interval [0..360]).    \return boolean indicating whether update was successful */bool PlayerSettings::setPlayerWhenToTurnAngle( double d ){  dPlayerWhenToTurnAngle = d;  return true;}/*! This method returns the percentage of the maximal acceleration in which    case a kick should still be performed. This value    is needed to determine whether the ball should be better positioned or    should be kicked when the ball should be kicked hard.    If it is possible to accelerate the ball with a higher    percentage than the returned percentage the kick is performed, in all other    cases the ball is positioned better.    \return percentage of ball acceleration when kick should be performed */double PlayerSettings::getPlayerWhenToKick( ) const{  return dPlayerWhenToKick;}/*! This method sets the percentage of the maximal acceleration that defines    in which cases the ball is actually kicked or in which case it is    positioned better when the ball should be given a very high velocity.    \param d percentage in range [0..1]    \return boolean indicating whether update was successful */bool PlayerSettings::setPlayerWhenToKick( double d ){  dPlayerWhenToKick = d;  return true;}/*! This method returns the maximal allowed number of cycles to intercept the    ball. If it takes more cycles to intercept the ball, the ball is not    intercepted.    \return number of intercept cycles */int PlayerSettings::getPlayerWhenToIntercept( ) const{  return iPlayerWhenToIntercept;}/*! This methods sets the maximal allowed number of cycles to intercept the    ball.    \param i new maximal allowed number of cycles (>0)    \return boolean indicating whether update was successful */bool PlayerSettings::setPlayerWhenToIntercept( int i ){  iPlayerWhenToIntercept = i;  return true;}/*! This method returns the clear ball distance. When a clear ball is    performed, the ball is aimed to a point just in front of the penalty area    of the opponent. This method returns the distance before the penalty area    to which the ball is aimed.    \return clear ball distance before opponent penalty area */double PlayerSettings::getClearBallDist( ) const{  return dClearBallDist;}/*! This method sets the clear ball distance.    \param d new clear ball distance before opponent penalty area (>0).    \return boolean indicating whether update was successful */bool PlayerSettings::setClearBallDist( double d ){  dClearBallDist = d;  return true;}/*! This method returns the distance in which opponents are taken into account    when a clear ball is issued.    \return maximum opponent distance for clear ball. */double PlayerSettings::getClearBallOppMaxDist( ) const{  return dClearBallOppMaxDist;}/*! This method sets the distance in which opponents are taken into account    when a clear ball is issued.    \param d maximum opponent distance for clear ball (>0).    \return boolean indicating whether update was successful */bool PlayerSettings::setClearBallOppMaxDist( double d ){  dClearBallOppMaxDist = d;  return true;}/*! This method returns the minimum needed angle for a clear ball to the side.    \return minimum needed angle for clear ball to side */double PlayerSettings::getClearBallToSideAngle( ) const{  return dClearBallToSideAngle;}/*! This method sets the minimum needed angle for a clear ball to the side.    \param d minimum needed angle (>0) for clear ball to side    \return boolean indicating whether update was successful */bool PlayerSettings::setClearBallToSideAngle( double d ){  dClearBallToSideAngle = d;  return true;}/*! This method returns the cone width that is used to check for opponents when    passing to a player. A pass is only performed when no opponents are in the    cone. The cone is specified as the width to one side    after distance 1. So for a value of 0.5 the cone angle equals    45 (22.5 to both sides).    \return cone width in which no opponents are allowed when passing */double PlayerSettings::getConeWidth( ) const{  return dConeWidth;}/*! This method sets the cone width in which no opponents are allowed when the    ball is passed to a teammate. The cone width is specified as the width to    one side after distance 1. So for a value of 0.5 the cone angle    equals 45 (22.5 to both sides).    \param d cone width in which no opponents are allowed when passing (>0)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -