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

📄 serversettings.cpp

📁 自己写的robocup-2d程序
💻 CPP
📖 第 1 页 / 共 5 页
字号:
/*
Copyright (c) 2000-2003, Jelle Kok, University of Amsterdam
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list 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 documentation
and/or other materials provided with the distribution.

3. Neither the name of the University of Amsterdam nor the names of its
contributors may be used to endorse or promote products derived from this
software 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, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

/*! \file ServerSettings.cpp
<pre>
<b>File:</b>          ServerSettings.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 ServerSettings. It contains all the
               member method implementations of the ServerSettings class. This
               class contains all the Soccerserver parameters that are 
               available in the configuration files 'server.conf' and
               'player.conf' along with their default values and
               standard set- and get methods for manipulating these
               values.</pre>

<hr size=2>
<pre>
<h2><b>Changes</b></h2>
<b>Date</b>             <b>Author</b>          <b>Comment</b>
28/11/2000       Jelle Kok       Initial version created (based on Emiel Corten)
31/01/2001       Remco de Boer   Settings for server version 7.xx added
27/04/2001       Remco de Boer   drop_ball_time and player.conf parameters added
03/05/2001       Remco de Boer   Version including full documentation completed
</pre>
*/

#include "ServerSettings.h"
#include <stdio.h>
#include <string.h>           // needed for 'strcpy'

/*****************************************************************************/
/*******************   CLASS SERVERSETTINGS   ********************************/
/*****************************************************************************/

/*! Constructor for the ServerSettings class. It sets all the private member
    variables in this class to the values specified in the configuration files
    (server.conf and player.conf) of Soccer Server version 8.xx. These values
    can be changed by calling the method 'readValues' with a new configuration
    file or by calling the method 'setValue' for a specific variable. */
ServerSettings::ServerSettings( ):GenericValues( "ServerSettings", 121 )
{
  // goal-related parameters
  dGoalWidth         = 14.02; // goal_width: the width of the goal

  // player-related parameters
  dPlayerSize        = 0.3;   // player_size: the size (=radius) of a player
  dPlayerDecay       = 0.4;   // player_decay: player speed decay per cycle
  dPlayerRand        = 0.1;   // player_rand: random error in player movement
  dPlayerWeight      = 60.0;  // player_weight: weight of a player (for wind)
  dPlayerSpeedMax    = 1.2;   // player_speed_max: maximum speed of a player
  dPlayerAccelMax    = 1.0;   // player_accel_max: maximum acceleration of a
                              // player per cycle

  // stamina-related parameters
  dStaminaMax        = 4000.0;// stamina_max: maximum stamina of a player
  dStaminaIncMax     = 45.0;  // stamina_inc_max: maximum stamina increase of a
                              // player per cycle
  dRecoverDecThr     = 0.3;   // recover_dec_thr: percentage of stamina_max
                              // below which player recovery decreases
  dRecoverDec        = 0.002; // recover_dec: decrement step per cycle for
                              // player recovery
  dRecoverMin        = 0.5;   // recover_min: minimum player recovery
  dEffortDecThr      = 0.3;   // effort_dec_thr: % of stamina_max below
                              // which player effort capacity decreases
  dEffortDec         = 0.005; // effort_dec: decrement step per cycle for
                              // player effort capacity
  dEffortIncThr      = 0.6;   // effort_incr_thr: percentage of stamina_max
                              // above which player effort capacity increases
  dEffortInc         = 0.01;  // effort_inc: increment step per cycle for
                              // player effort capacity
  dEffortMin         = 0.6;   // effort_min: minimum value for player effort

  // parameters related to auditory perception
  iHearMax           = 2;     // hear_max: max hearing capacity of a player;
                              // a player can hear hear_inc messages in
                              // hear_decay simulation cycles
  iHearInc           = 1;     // hear_inc: min hearing capacity of a player,
                              // i.e. the number of messages a player can hear
                              // in hear_decay simulation cycles
  iHearDecay         = 2;     // hear_decay: decay rate of player hearing
                              // capacity, i.e. minimum number of cycles for
                              // hear_inc messages

  // parameters related to player turn actions
  dInertiaMoment     = 5.0;   // inertia_moment: inertia moment of a player;
                              // affects actual turn angle depending on speed

  // parameters related to sense_body information
  iSenseBodyStep     = 100;   // sense_body_step: length of the interval (ms)
                              // between sense_body information messages

  // goalkeeper-related parameters
  dCatchableAreaL    = 2.0;   // catchable_area_l: length of area around
                              // goalkeeper in which he can catch the ball
  dCatchableAreaW    = 1.0;   // catchable_area_w: width of area around
                              // goalkeeper in which he can catch the ball
  dCatchProbability  = 1.0;   // catch_probability: the probability for a
                              // goalkeeper to catch the ball
  iCatchBanCycle     = 5 ;    // catch_ban_cycle: number of cycles after catch
                              // in which goalkeeper cannot catch again
  iGoalieMaxMoves    = 2;     // goalie_max_moves: maximum number of 'move'
                              // actions allowed for goalkeeper after catch

  // ball-related parameters
  dBallSize          = 0.085; // ball_size: the size (=radius) of the ball
  dBallDecay         = 0.94;  // ball_decay: ball speed decay per cycle
  dBallRand          = 0.05;  // ball_rand: random error in ball movement
  dBallWeight        = 0.2;   // ball_weight: weight of the ball (for wind)
  dBallSpeedMax      = 2.7;   // ball_speed_max: maximum speed of the ball
  dBallAccelMax      = 2.7;   // ball_accel_max: maximum acceleration of the
                              // ball per cycle

  // wind-related parameters
  dWindForce         = 0.0;   // wind_force: the force of the wind
  dWindDir           = 0.0;   // wind_dir: the direction of the wind
  dWindRand          = 0.0;   // wind_rand: random error in wind direction
  bWindRandom        = false; // wind_random: is wind force and dir random

  // parameters related to 'dash' and 'kick' commands
  dKickableMargin    = 0.7;   // kickable_margin: margin around player in which
                              // ball is kickable; kickable area thus equals
                              // kickable_margin + ball_size + player_size
  dCkickMargin       = 1.0;   // ckick_margin: corner kick margin, i.e. the
                              // minimum distance to the ball for offending
                              // players when a corner kick is taken

  dDashPowerRate     = 0.006; // dash_power_rate: rate by which the 'Power'
                              // argument in a 'dash' command is multiplied
                              // (thus determining the amount of displacement
                              // of the player as a result of the 'dash')
  dKickPowerRate     = 0.027; // kick_power_rate: rate by which the 'Power'
                              // argument in a 'kick' command is multiplied
                              // (thus determining the amount of displacement 
                              // of the ball as a result of the 'kick')
  dKickRand          = 0.0;   // kick_rand: random error in kick direction

  // parameters related to visual and auditory perception range
  dVisibleAngle      = 90.0;  // visible_angle: angle of the view cone of a
                              // player in the standard view mode
  dAudioCutDist      = 50.0;  // audio_cut_dist: maximum distance over which a
                              // spoken message can be heard

  // quantization parameters
  dQuantizeStep      = 0.1;   // quantize_step: quantization step for distance
                              // of moving objects
  dQuantizeStepL     = 0.01;  // quantize_step_l: quantization step for dist
                              // of landmarks

  // range parameters for basic actuator commands
  iMaxPower          = 100;   // maxpower: maximum power for dash/kick
  iMinPower          = -100;  // minpower: minimum power for dash/kick
  iMaxMoment         = 180;   // maxmoment: maximum angle for turn/kick
  iMinMoment         = -180;  // minmoment: minimum angle for turn/kick
  iMaxNeckMoment     = 180;   // maxneckmoment: maximum angle for turnneck
  iMinNeckMoment     = -180;  // minneckmoment: minimum angle for turnneck
  iMaxNeckAng        = 90;    // maxneckang: maximum neck angle rel to body
  iMinNeckAng        = -90;   // minneckang: minimum neck angle rel to body

  // port-related parameters
  iPort              = 6000;  // port: port number for player connection
  iCoachPort         = 6001;  // coach_port: port number for coach connection
  iOlCoachPort       = 6002;  // ol_coach_port: port number for online coach

  // coach-related parameters
  iSayCoachCntMax    = 128;   // say_coach_cnt_max: maximum number of coach
                              // messages possible
  iSayCoachMsgSize   = 128;   // say_coach_msg_size: maximum size of coach
                              // messages
  iClangWinSize      = 300;   // clang_win_size: time window which controls how
                              // many coach messages can be sent
  iClangDefineWin    = 1;     // clang_define_win: number of define messages by
                              // coach per time window
  iClangMetaWin      = 1;     // clang_meta_win: number of meta messages by
                              // coach per time window
  iClangAdviceWin    = 1;     // clang_advice_win: number of advice messages by
                              // coach per time window
  iClangInfoWin      = 1;     // clang_info_win: number of info messages by
                              // coach per time window
  iClangMessDelay    = 50;    // clang_mess_delay: delay of coach messages, ie
                              // the number of cycles between send to player 
                              // and receival of message
  iClangMessPerCycle = 1;     // clang_mess_per_cycle: number of coach messages
                              // per cycle
  iSendViStep        = 100;   // send_vi_step: interval of coach's look, i.e.
                              // the length of the interval (in ms) between
                              // visual messages to the coach

  // time-related parameters
  iSimulatorStep     = 100;   // simulator_step: the length (in ms) of a
                              // simulator cycle
  iSendStep          = 150;   // send_step: the length of the interval (in ms)
                              // between visual messages to a player in the
                              // standard view mode
  iRecvStep          = 10;    // recv_step: the length of the interval (in ms)
                              // for accepting commands from a player
  iHalfTime          = 300;   // half_time: the length (in seconds) of a single
                              // game half
  iDropBallTime      = 200;   // drop_ball_time: the number of cycles to wait
                              // until dropping the ball automatically for free
                              // kicks, corner kicks, etc.

  // speech-related parameters
  iSayMsgSize        = 512;   // say_msg_size: the maximum length (in bytes) of
                              // a spoken message

  // offside-related parameters
  bUseOffside            = true; // use_offside: a boolean flag indicating
                                 // whether the offside rule should be applied
                                 // or not
  dOffsideActiveAreaSize = 5.0;  // offside_active_area_size: offside active
                                 // area size, i.e. radius of circle around
                                 // the ball in which player can be offside
  bForbidKickOffOffside  = true; // forbid_kick_off_offside: a boolean flag
                                 // indicating whether a kick from offside
                                 // position is allowed
  dOffsideKickMargin     = 9.15; // offside_kick_margin: offside kick margin
                                 // i.e. the minimum distance to the ball for
                                 // offending players when a free kick for
                                 // offside is taken

  // log-related parameters
  bVerbose           = false; // verbose: flag indicating whether verbose mode
                              // is active or not; in verbose mode server sends
                              // extra error-information
  iRecordVersion     = 3;     // record_version: the type of log record
  bRecordLog         = true;  // record_log: flag indicating whether log record
                              // for game should be created
  bSendLog           = true;  // send_log: flag indicating whether send client
                              // command log for game should be created
  bLogTimes          = false; // log_times: flag indicating whether ms should 
                              // be written between cycles in log file
  strcpy( strLogFile, "server.log" );// server log to store all actions receiv
  bSynchMode         = false; // synch_mode: in synchronization mode?
  bFullStateL        = false; // fullstate_l, full information left team
  bFullStateR        = false; // fulstate_r, full information right team
  
  // heterogeneous player parameters from player.conf
  iPlayerTypes              = 7;     // player_types: the number of player type
                                     // including the default player type
  iSubsMax                  = 3;     // subs_max: the maximum number of
                                     // substitutions allowed during a game the
                                     // value also indicates the maximum number
                                     // of players allowed for each type
  dPlayerSpeedMaxDeltaMin   = 0.0;   // player_speed_max_delta_min: minimum
                                     // delta for adjusting player_speed_max
  dPlayerSpeedMaxDeltaMax   = 0.0;   // player_speed_max_delta_max: maximum
                                     // delta for adjusting player_speed_max
  dStaminaIncMaxDeltaFactor = 0.0;   // stamina_inc_max_delta_factor: amount by
                                     // which delta is multiplied for
                                     // stamina_inc_max
  dPlayerDecayDeltaMin      = 0.0;   // player_decay_delta_min: minimum delta
                                     // for adjusting player_decay
  dPlayerDecayDeltaMax      = 0.2;   // player_decay_delta_max: maximum delta
                                     // for adjusting player_decay
  dInertiaMomentDeltaFactor = 25.0;  // inertia_moment_delta_factor: amount by
                                     // which delta is multiplied for
                                     // inertia_moment
  dDashPowerRateDeltaMin    = 0.0;   // dash_power_rate_delta_min: min delta
                                     // for adjusting dash_power_rate
  dDashPowerRateDeltaMax    = 0.0;   // dash_power_rate_delta_max: max delta
                                     // for adjusting dash_power_rate
  dPlayerSizeDeltaFactor    = -100.0;// player_size_delta_factor: amount delta
                                     // is multiplied by for player_size
  dKickableMarginDeltaMin   = 0.0;   // kickable_margin_delta_min: min delta
                                     // for adjusting kickable_margin
  dKickableMarginDeltaMax   = 0.2;   // kickable_margin_delta_max: max delta
                                     // for adjusting kickable_margin
  dKickRandDeltaFactor      = 0.5;   // kick_rand_delta_factor: amount delta is
                                     // multiplied by for kick_rand
  dExtraStaminaDeltaMin     = 0.0;   // extra_stamina_delta_min: minimum delta
                                     // for adjusting extra_stamina
  dExtraStaminaDeltaMax     = 100.0; // extra_stamina_delta_max: maximum delta
                                     // for adjusting extra_stamina
  dEffortMaxDeltaFactor     = -0.002;// effort_max_delta_factor: amount delta 
                                     // is multiplied by for effort_max
  dEffortMinDeltaFactor     = -0.002;// effort_min_delta_factor: amount delta
                                     // is multiplied by for effort_min
  dNewDashPowerRateDeltaMin = 0.0;   // dash_power_rate_delta_min: minimum 

⌨️ 快捷键说明

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