?? serversettings.c
字號:
/*! \file ServerSettings.C<pre><b>File:</b> ServerSettings.C<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 added27/04/2001 Remco de Boer drop_ball_time and player.conf parameters added03/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: percentage 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: maximum hearing capacity of a player; // a player can hear hear_inc messages in // hear_decay simulation cycles iHearInc = 1; // hear_inc: minimum 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 (in 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 distance // 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 // delta for adjusting dash_power_rate dNewDashPowerRateDeltaMax = 0.002; // dash_power_rate_delta_max: maximum // delta for adjusting dash_power_rate dNewStaminaIncMaxDeltaFactor=-100000.0;// stamina_inc_max_delta_factor: // amount by which delta is multiplied for // stamina_inc_max // important server parameters not in server.conf or player.conf dEffortMax = 1.0; // effort_max: maximum player effort capacity iSlowDownFactor = 1; // slow_down_factor: factor to slow down simulator // and send intervals dVisibleDistance = 3.0; // visible_distance: distance within which objects // are always 'visible' even when not in view cone) dExtraStamina = 0.0; // extra_stamina: extra stamina for heterogeneous // player // penalty parameters dPenDistX = 11.0; // pen_dist_x: distance ball from goal dPenMaxGoalieDistX = 4.0; // pen_goalie_max_dist_x: maximum distance // for goalie during penalties bPenAllowMultKicks = false; // pen_allow_mult_kicks: can penalty // kicker kick multiple times // tackle parameters dTackleDist = 2.0; // tackle_dist: allowed distance in front dTackleBackDist = 0.5; // tackle_back_dist: allowed distance back dTackleWidth = 1.0; // tackle_width: allowed distance side dTackleExponent = 6; // tackle_exponent: exponent need iTackleCycles = 10; // tackle_cycles: cycles immobile dTacklePowerRate = 0.027; // tackle_power_rate: power rate tackle // parameters which depend on other values dMaximalKickDist = dKickableMargin + // the maximum distance from a player dPlayerSize + // for which the ball is kickable dBallSize; // add all the settings, i.e. each parameter // becomes a new generic value for the class // goal-related parameters addSetting( "goal_width" , &dGoalWidth , GENERIC_VALUE_DOUBLE );
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -