Phoenix2D-Library  0.10
Server.cpp
Go to the documentation of this file.
1 /*
2  * Phoenix2D (RoboCup Soccer Simulation 2D League)
3  * Copyright (c) 2013 Ivan Gonzalez
4  *
5  * This file is part of Phoenix2D.
6  *
7  * Phoenix2D is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * Phoenix2D is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with Phoenix2D. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #include "Server.h"
22 #include <boost/regex.hpp>
23 #include <cstdlib>
24 namespace Phoenix
25 {
26 double Server::AUDIO_CUT_DIST = 50.0;
27 int Server::AUTO_MODE = 0;
28 double Server::BACK_DASH_RATE = 0.6;
29 int Server::BACK_PASSES = 1;
30 double Server::BALL_ACCEL_MAX = 2.7;
31 double Server::BALL_DECAY = 0.94;
32 double Server::BALL_RAND = 0.05;
33 double Server::BALL_SIZE = 0.085;
34 double Server::BALL_SPEED_MAX = 3.0;
35 double Server::BALL_STUCK_AREA = 3.0;
36 double Server::BALL_WEIGHT = 0.2;
38 double Server::CATCH_PROBABILITY = 1.0;
39 double Server::CATCHABLE_AREA_L = 1.2;
40 double Server::CATCHABLE_AREA_W = 1.0;
41 double Server::CKICK_MARGIN = 1.0;
44 int Server::CLANG_DEL_WIN = 1;
50 int Server::CLANG_WIN_SIZE = 300;
51 int Server::COACH = 0;
52 int Server::COACH_PORT = 6001;
54 int Server::CONNECT_WAIT = 300;
55 double Server::CONTROL_RADIUS = 2.0;
56 double Server::DASH_ANGLE_STEP = 45.0;
57 double Server::DASH_POWER_RATE = 0.006;
58 int Server::DROP_BALL_TIME = 100;
59 double Server::EFFORT_DEC = 0.005;
60 double Server::EFFORT_DEC_THR = 0.3;
61 double Server::EFFORT_INC = 0.01;
62 double Server::EFFORT_INC_THR = 0.6;
63 double Server::EFFORT_INIT = 1.0;
64 double Server::EFFORT_MIN = 0.6;
65 int Server::EXTRA_HALF_TIME = 100;
66 int Server::EXTRA_STAMINA = 50;
68 int Server::FOUL_CYCLES = 5;
70 int Server::FOUL_EXPONENT = 10;
74 int Server::FULLSTATE_L = 0;
75 int Server::FULLSTATE_R = 0;
78 std::string Server::GAME_LOG_DIR = "./";
80 std::string Server::GAME_LOG_FIXED_NAME = "rcssserver";
82 int Server::GAME_LOGGING = 1;
83 int Server::GAME_OVER_WAIT = 100;
84 double Server::GOAL_WIDTH = 14.02;
86 int Server::GOLDEN_GOAL = 0;
87 int Server::HALF_TIME = 300;
88 int Server::HEAR_DECAY = 1;
89 int Server::HEAR_INC = 1;
90 int Server::HEAR_MAX = 1;
92 int Server::KEEPAWAY = 1;
95 std::string Server::KEEPAWAY_LOG_DIR = "./";
97 std::string Server::KEEPAWAY_LOG_FIXED_NAME = "rcssserver";
99 int Server::KEEPAWAY_START = -1;
100 int Server::KEEPAWAY_WIDTH = 20;
101 int Server::KICK_OFF_WAIT = 100;
102 double Server::KICK_POWER_RATE = 0.027;
103 double Server::KICK_RAND = 0.1;
104 double Server::KICK_RAND_FACTOR_L = 1.0;
105 double Server::KICK_RAND_FACTOR_R = 1.0;
106 double Server::KICKABLE_MARGIN = 0.7;
107 std::string Server::LANDMARK_FILE = "~/.rcssserver-landmark.xml";
108 std::string Server::LOG_DATE_FORMAT = "%Y%m%d%H%M-";
109 int Server::LOG_TIMES = 0;
110 double Server::MAX_BACK_TACKLE_POWER = 0.0;
111 double Server::MAX_DASH_ANGLE = 180.0;
112 double Server::MAX_DASH_POWER = 100.0;
113 int Server::MAX_GOAL_KICKS = 3;
114 double Server::MAX_TACKLE_POWER = 100.0;
115 double Server::MAXMOMENT = 180.0;
116 double Server::MAXNECKANG = 90.0;
117 double Server::MAXNECKMOMENT = 180.0;
118 double Server::MAXPOWER = 100.0;
119 double Server::MIN_DASH_ANGLE = -180.0;
120 double Server::MIN_DASH_POWER = -100.0;
121 double Server::MINMOMENT = -180.0;
122 double Server::MINNECKANG = -90.0;
123 double Server::MINNECKMOMENT = -180.0;
124 double Server::MINPOWER = -100.0;
125 int Server::NR_EXTRA_HALFS = 2;
128 double Server::OFFSIDE_KICK_MARGIN = 9.15;
129 int Server::OLCOACH_PORT = 6002;
130 int Server::OLD_COACH_HEAR = 0;
134 double Server::PEN_DIST_X = 42.5;
136 double Server::PEN_MAX_GOALIE_DIST_X = 14.0;
137 int Server::PEN_NR_KICKS = 5;
138 double Server::PEN_RANDOM_WINNER = 0;
139 int Server::PEN_READY_WAIT = 10;
140 int Server::PEN_SETUP_WAIT = 70;
141 int Server::PEN_TAKEN_WAIT = 150;
143 double Server::PLAYER_ACCEL_MAX = 1.0;
144 double Server::PLAYER_DECAY = 0.4;
145 double Server::PLAYER_RAND = 0.1;
146 double Server::PLAYER_SIZE = 0.3;
147 double Server::PLAYER_SPEED_MAX = 1.05;
148 double Server::PLAYER_SPEED_MAX_MIN = 0.75;
149 double Server::PLAYER_WEIGHT = 60.0;
150 int Server::POINT_TO_BAN = 5;
152 int Server::PORT = 6000;
153 double Server::PRAND_FACTOR_L = 1.0;
154 double Server::PRAND_FACTOR_R = 1.0;
155 int Server::PROFILE = 0;
157 double Server::QUANTIZE_STEP = 0.1;
158 double Server::QUANTIZE_STEP_L = 0.01;
160 double Server::RECOVER_DEC = 0.002;
161 double Server::RECOVER_DEC_THR = 0.3;
162 double Server::RECOVER_INIT = 1.0;
163 double Server::RECOVER_MIN = 0.5;
164 int Server::RECV_STEP = 10;
165 double Server::RED_CARD_PROBABILITY = 0.0;
166 int Server::SAY_COACH_CNT_MAX = 128;
168 int Server::SAY_MSG_SIZE = 10;
169 int Server::SEND_COMMS = 0;
170 int Server::SEND_STEP = 150;
171 int Server::SEND_VI_STEP = 100;
172 int Server::SENSE_BODY_STEP = 100;
173 double Server::SIDE_DASH_RATE = 0.4;
174 int Server::SIMULATOR_STEP = 100;
175 double Server::SLOW_DOWN_FACTOR = 1.0;
178 int Server::STAMINA_CAPACITY = 130600;
179 int Server::STAMINA_INC_MAX = 45;
180 int Server::STAMINA_MAX = 8000;
181 int Server::START_GOAL_L = 0;
182 int Server::START_GOAL_R = 0;
183 double Server::STOPPED_BALL_VEL = 0.01;
185 int Server::SYNCH_MODE = 0;
186 int Server::SYNCH_OFFSET = 60;
188 double Server::TACKLE_BACK_DIST = 0.0;
189 int Server::TACKLE_CYCLES = 10;
190 double Server::TACKLE_DIST = 2.0;
192 double Server::TACKLE_POWER_RATE = 0.027;
193 double Server::TACKLE_RAND_FACTOR = 2.0;
194 double Server::TACKLE_WIDTH = 1.25;
195 double Server::TEAM_ACTUATOR_NOISE = 0.0;
196 std::string Server::TEAM_L_START = "";
197 std::string Server::TEAM_R_START = "";
199 int Server::TEXT_LOG_DATED = 1;
200 std::string Server::TEXT_LOG_DIR = "./";
201 int Server::TEXT_LOG_FIXED = 0;
202 std::string Server::TEXT_LOG_FIXED_NAME = "rcssserver";
203 int Server::TEXT_LOGGING = 1;
204 int Server::USE_OFFSIDE = 1;
205 int Server::VERBOSE = 0;
206 double Server::VISIBLE_ANGLE = 90.0;
207 double Server::VISIBLE_DISTANCE = 3.0;
208 double Server::WIND_ANG = 0.0;
209 double Server::WIND_DIR = 0.0;
210 double Server::WIND_FORCE = 0.0;
211 double Server::WIND_NONE = 0.0;
212 double Server::WIND_RAND = 0.0;
213 double Server::WIND_RANDOM = 0.0;
214 
215 Server::Server(std::string server_params) {
216  this->server_params = server_params;
217  Server::AUDIO_CUT_DIST = atof((getParameter("audio_cut_dist").c_str()));
218  Server::AUTO_MODE = atoi((getParameter("auto_mode").c_str()));
219  Server::BACK_DASH_RATE = atof((getParameter("back_dash_rate").c_str()));
220  Server::BACK_PASSES = atoi((getParameter("back_passes").c_str()));
221  Server::BALL_ACCEL_MAX = atof((getParameter("ball_accel_max").c_str()));
222  Server::BALL_DECAY = atof((getParameter("ball_decay").c_str()));
223  Server::BALL_RAND = atof((getParameter("ball_rand").c_str()));
224  Server::BALL_SIZE = atof((getParameter("ball_size").c_str()));
225  Server::BALL_SPEED_MAX = atof((getParameter("ball_speed_max").c_str()));
226  Server::BALL_STUCK_AREA = atof((getParameter("ball_stuck_area").c_str()));
227  Server::BALL_WEIGHT = atof((getParameter("ball_weight").c_str()));
228  Server::CATCH_BAN_CYCLE = atoi((getParameter("catch_ban_cycle").c_str()));
229  Server::CATCH_PROBABILITY = atof((getParameter("catch_probability").c_str()));
230  Server::CATCHABLE_AREA_L = atof((getParameter("catchable_area_l").c_str()));
231  Server::CATCHABLE_AREA_W = atof((getParameter("catchable_area_w").c_str()));
232  Server::CKICK_MARGIN = atof((getParameter("ckick_margin").c_str()));
233  Server::CLANG_ADVICE_WIN = atoi((getParameter("clang_advice_win").c_str()));
234  Server::CLANG_DEFINE_WIN = atoi((getParameter("clang_define_win").c_str()));
235  Server::CLANG_DEL_WIN = atoi((getParameter("clang_del_win").c_str()));
236  Server::CLANG_INFO_WIN = atoi((getParameter("clang_info_win").c_str()));
237  Server::CLANG_MESS_DELAY = atoi((getParameter("clang_mess_delay").c_str()));
238  Server::CLANG_MESS_PER_CYCLE = atoi((getParameter("clang_mess_per_cycle").c_str()));
239  Server::CLANG_META_WIN = atoi((getParameter("clang_meta_win").c_str()));
240  Server::CLANG_RULE_WIN = atoi((getParameter("clang_rule_win").c_str()));
241  Server::CLANG_WIN_SIZE = atoi((getParameter("clang_win_size").c_str()));
242  Server::COACH = atoi((getParameter("coach").c_str()));
243  Server::COACH_PORT = atoi((getParameter("coach_port").c_str()));
244  Server::COACH_W_REFEREE = atoi((getParameter("coach_w_referee").c_str()));
245  Server::CONNECT_WAIT = atoi((getParameter("connect_wait").c_str()));
246  Server::CONTROL_RADIUS = atof((getParameter("control_radius").c_str()));
247  Server::DASH_ANGLE_STEP = atof((getParameter("dash_angle_step").c_str()));
248  Server::DASH_POWER_RATE = atof((getParameter("dash_power_rate").c_str()));
249  Server::DROP_BALL_TIME = atoi((getParameter("drop_ball_time").c_str()));
250  Server::EFFORT_DEC = atof((getParameter("effort_dec").c_str()));
251  Server::EFFORT_DEC_THR = atof((getParameter("effort_dec_thr").c_str()));
252  Server::EFFORT_INC = atof((getParameter("effort_inc").c_str()));
253  Server::EFFORT_INC_THR = atof((getParameter("effort_inc_thr").c_str()));
254  Server::EFFORT_INIT = atof((getParameter("effort_init").c_str()));
255  Server::EFFORT_MIN = atof((getParameter("effort_min").c_str()));
256  Server::EXTRA_HALF_TIME = atoi((getParameter("extra_half_time").c_str()));
257  Server::EXTRA_STAMINA = atoi((getParameter("extra_stamina").c_str()));
258  Server::FORBID_KICK_OFF_OFFSIDE = atoi((getParameter("forbid_kick_off_offside").c_str()));
259  Server::FOUL_CYCLES = atoi((getParameter("foul_cycles").c_str()));
260  Server::FOUL_DETECT_PROBABILITY = atof((getParameter("foul_detect_probability").c_str()));
261  Server::FOUL_EXPONENT = atoi((getParameter("foul_exponent").c_str()));
262  Server::FREE_KICK_FAULTS = atoi((getParameter("free_kick_faults").c_str()));
263  Server::FREEFORM_SEND_PERIOD = atoi((getParameter("freeform_send_period").c_str()));
264  Server::FREEFORM_WAIT_PERIOD = atoi((getParameter("freeform_wait_period").c_str()));
265  Server::FULLSTATE_L = atoi((getParameter("fullstate_l").c_str()));
266  Server::FULLSTATE_R = atoi((getParameter("fullstate_r").c_str()));
267  Server::GAME_LOG_COMPRESSION = atoi((getParameter("game_log_compression").c_str()));
268  Server::GAME_LOG_DATED = atoi((getParameter("game_log_dated").c_str()));
269  Server::GAME_LOG_DIR = getParameter("game_log_dir");
270  Server::GAME_LOG_FIXED = atoi((getParameter("game_log_fixed").c_str()));
271  Server::GAME_LOG_FIXED_NAME = getParameter("game_log_fixed_name");
272  Server::GAME_LOG_VERSION = atoi((getParameter("game_log_version").c_str()));
273  Server::GAME_LOGGING = atoi((getParameter("game_logging").c_str()));
274  Server::GAME_OVER_WAIT = atoi((getParameter("game_over_wait").c_str()));
275  Server::GOAL_WIDTH = atof((getParameter("goal_width").c_str()));
276  Server::GOALIE_MAX_MOVES = atoi((getParameter("goalie_max_moves").c_str()));
277  Server::GOLDEN_GOAL = atoi((getParameter("golden_goal").c_str()));
278  Server::HALF_TIME = atoi((getParameter("half_time").c_str()));
279  Server::HEAR_DECAY = atoi((getParameter("hear_decay").c_str()));
280  Server::HEAR_INC = atoi((getParameter("hear_inc").c_str()));
281  Server::HEAR_MAX = atoi((getParameter("hear_max").c_str()));
282  Server::INERTIA_MOMENT = atoi((getParameter("inertia_moment").c_str()));
283  Server::KEEPAWAY = atoi((getParameter("keepaway").c_str()));
284  Server::KEEPAWAY_LENGTH = atoi((getParameter("keepaway_length").c_str()));
285  Server::KEEPAWAY_LOG_DATED = atoi((getParameter("keepaway_log_dated").c_str()));
286  Server::KEEPAWAY_LOG_DIR = getParameter("keepaway_log_dir");
287  Server::KEEPAWAY_LOG_FIXED = atoi((getParameter("keepaway_log_fixed").c_str()));
288  Server::KEEPAWAY_LOG_FIXED_NAME = getParameter("keepaway_log_fixed_name");
289  Server::KEEPAWAY_LOGGING = atoi((getParameter("keepaway_logging").c_str()));
290  Server::KEEPAWAY_START = atoi((getParameter("keepaway_start").c_str()));
291  Server::KEEPAWAY_WIDTH = atoi((getParameter("keepaway_width").c_str()));
292  Server::KICK_OFF_WAIT = atoi((getParameter("kick_off_wait").c_str()));
293  Server::KICK_POWER_RATE = atof((getParameter("kick_power_rate").c_str()));
294  Server::KICK_RAND = atof((getParameter("kick_rand").c_str()));
295  Server::KICK_RAND_FACTOR_L = atof((getParameter("kick_rand_factor_l").c_str()));
296  Server::KICK_RAND_FACTOR_R = atof((getParameter("kick_rand_factor_r").c_str()));
297  Server::KICKABLE_MARGIN = atof((getParameter("kickable_margin").c_str()));
298  Server::LANDMARK_FILE = getParameter("landmark_file");
299  Server::LOG_DATE_FORMAT = getParameter("log_date_format");
300  Server::LOG_TIMES = atoi((getParameter("log_times").c_str()));
301  Server::MAX_BACK_TACKLE_POWER = atof((getParameter("max_back_tackle_power").c_str()));
302  Server::MAX_DASH_ANGLE = atof((getParameter("max_dash_angle").c_str()));
303  Server::MAX_DASH_POWER = atof((getParameter("max_dash_power").c_str()));
304  Server::MAX_GOAL_KICKS = atoi((getParameter("max_goal_kicks").c_str()));
305  Server::MAX_TACKLE_POWER = atof((getParameter("max_tackle_power").c_str()));
306  Server::MAXMOMENT = atof((getParameter("maxmoment").c_str()));
307  Server::MAXNECKANG = atof((getParameter("maxneckang").c_str()));
308  Server::MAXNECKMOMENT = atof((getParameter("maxneckmoment").c_str()));
309  Server::MAXPOWER = atof((getParameter("maxpower").c_str()));
310  Server::MIN_DASH_ANGLE = atof((getParameter("min_dash_angle").c_str()));
311  Server::MIN_DASH_POWER = atof((getParameter("min_dash_power").c_str()));
312  Server::MINMOMENT = atof((getParameter("minmoment").c_str()));
313  Server::MINNECKANG = atof((getParameter("minneckang").c_str()));
314  Server::MINNECKMOMENT = atof((getParameter("minneckmoment").c_str()));
315  Server::MINPOWER = atof((getParameter("minpower").c_str()));
316  Server::NR_EXTRA_HALFS = atoi((getParameter("nr_extra_halfs").c_str()));
317  Server::NR_NORMAL_HALFS = atoi((getParameter("nr_normal_halfs").c_str()));
318  Server::OFFSIDE_ACTIVE_AREA_SIZE = atof((getParameter("offside_active_area_size").c_str()));
319  Server::OFFSIDE_KICK_MARGIN = atof((getParameter("offside_kick_margin").c_str()));
320  Server::OLCOACH_PORT = atoi((getParameter("olcoach_port").c_str()));
321  Server::OLD_COACH_HEAR = atoi((getParameter("old_coach_hear").c_str()));
322  Server::PEN_ALLOW_MULT_KICKS = atoi((getParameter("pen_allow_mult_kicks").c_str()));
323  Server::PEN_BEFORE_SETUP_WAIT = atoi((getParameter("pen_before_setup_wait").c_str()));
324  Server::PEN_COACH_MOVES_PLAYERS = atoi((getParameter("pen_coach_moves_players").c_str()));
325  Server::PEN_DIST_X = atof((getParameter("pen_dist_x").c_str()));
326  Server::PEN_MAX_EXTRA_KICKS = atoi((getParameter("pen_max_extra_kicks").c_str()));
327  Server::PEN_MAX_GOALIE_DIST_X = atof((getParameter("pen_max_goalie_dist_x").c_str()));
328  Server::PEN_NR_KICKS = atoi((getParameter("pen_nr_kicks").c_str()));
329  Server::PEN_RANDOM_WINNER = atof((getParameter("pen_random_winner").c_str()));
330  Server::PEN_READY_WAIT = atoi((getParameter("pen_ready_wait").c_str()));
331  Server::PEN_SETUP_WAIT = atoi((getParameter("pen_setup_wait").c_str()));
332  Server::PEN_TAKEN_WAIT = atoi((getParameter("pen_taken_wait").c_str()));
333  Server::PENALTY_SHOOT_OUTS = atoi((getParameter("penalty_shoot_outs").c_str()));
334  Server::PLAYER_ACCEL_MAX = atof((getParameter("player_accel_max").c_str()));
335  Server::PLAYER_DECAY = atof((getParameter("player_decay").c_str()));
336  Server::PLAYER_RAND = atof((getParameter("player_rand").c_str()));
337  Server::PLAYER_SIZE = atof((getParameter("player_size").c_str()));
338  Server::PLAYER_SPEED_MAX = atof((getParameter("player_speed_max").c_str()));
339  Server::PLAYER_SPEED_MAX_MIN = atof((getParameter("player_speed_max_min").c_str()));
340  Server::PLAYER_WEIGHT = atof((getParameter("player_weight").c_str()));
341  Server::POINT_TO_BAN = atoi((getParameter("point_to_ban").c_str()));
342  Server::POINT_TO_DURATION = atoi((getParameter("point_to_duration").c_str()));
343  Server::PORT = atoi((getParameter("port").c_str()));
344  Server::PRAND_FACTOR_L = atof((getParameter("prand_factor_l").c_str()));
345  Server::PRAND_FACTOR_R = atof((getParameter("prand_factor_r").c_str()));
346  Server::PROFILE = atoi((getParameter("profile").c_str()));
347  Server::PROPER_GOAL_KICKS = atoi((getParameter("proper_goal_kicks").c_str()));
348  Server::QUANTIZE_STEP = atof((getParameter("quantize_step").c_str()));
349  Server::QUANTIZE_STEP_L = atof((getParameter("quantize_step_l").c_str()));
350  Server::RECORD_MESSAGES = atoi((getParameter("record_messages").c_str()));
351  Server::RECOVER_DEC = atof((getParameter("recover_dec").c_str()));
352  Server::RECOVER_DEC_THR = atof((getParameter("recover_dec_thr").c_str()));
353  Server::RECOVER_INIT = atof((getParameter("recover_init").c_str()));
354  Server::RECOVER_MIN = atof((getParameter("recover_min").c_str()));
355  Server::RECV_STEP = atoi((getParameter("recv_step").c_str()));
356  Server::RED_CARD_PROBABILITY = atof((getParameter("red_card_probability").c_str()));
357  Server::SAY_COACH_CNT_MAX = atoi((getParameter("say_coach_cnt_max").c_str()));
358  Server::SAY_COACH_MSG_SIZE = atoi((getParameter("say_coach_msg_size").c_str()));
359  Server::SAY_MSG_SIZE = atoi((getParameter("say_msg_size").c_str()));
360  Server::SEND_COMMS = atoi((getParameter("send_comms").c_str()));
361  Server::SEND_STEP = atoi((getParameter("send_step").c_str()));
362  Server::SEND_VI_STEP = atoi((getParameter("send_vi_step").c_str()));
363  Server::SENSE_BODY_STEP = atoi((getParameter("sense_body_step").c_str()));
364  Server::SIDE_DASH_RATE = atof((getParameter("side_dash_rate").c_str()));
365  Server::SIMULATOR_STEP = atoi((getParameter("simulator_step").c_str()));
366  Server::SLOW_DOWN_FACTOR = atof((getParameter("slow_down_factor").c_str()));
367  Server::SLOWNESS_ON_TOP_FOR_LEFT_TEAM = atof((getParameter("slowness_on_top_for_left_team").c_str()));
368  Server::SLOWNESS_ON_TOP_FOR_RIGHT_TEAM = atof((getParameter("slowness_on_top_for_right_team").c_str()));
369  Server::STAMINA_CAPACITY = atoi((getParameter("stamina_capacity").c_str()));
370  Server::STAMINA_INC_MAX = atoi((getParameter("stamina_inc_max").c_str()));
371  Server::STAMINA_MAX = atoi((getParameter("stamina_max").c_str()));
372  Server::START_GOAL_L = atoi((getParameter("start_goal_l").c_str()));
373  Server::START_GOAL_R = atoi((getParameter("start_goal_r").c_str()));
374  Server::STOPPED_BALL_VEL = atof((getParameter("stopped_ball_vel").c_str()));
375  Server::SYNCH_MICRO_SLEEP = atoi((getParameter("synch_micro_sleep").c_str()));
376  Server::SYNCH_MODE = atoi((getParameter("synch_mode").c_str()));
377  Server::SYNCH_OFFSET = atoi((getParameter("synch_offset").c_str()));
378  Server::SYNCH_SEE_OFFSET = atoi((getParameter("synch_see_offset").c_str()));
379  Server::TACKLE_BACK_DIST = atof((getParameter("tackle_back_dist").c_str()));
380  Server::TACKLE_CYCLES = atoi((getParameter("tackle_cycles").c_str()));
381  Server::TACKLE_DIST = atof((getParameter("tackle_dist").c_str()));
382  Server::TACKLE_EXPONENT = atoi((getParameter("tackle_exponent").c_str()));
383  Server::TACKLE_POWER_RATE = atof((getParameter("tackle_power_rate").c_str()));
384  Server::TACKLE_RAND_FACTOR = atof((getParameter("tackle_rand_factor").c_str()));
385  Server::TACKLE_WIDTH = atof((getParameter("tackle_width").c_str()));
386  Server::TEAM_ACTUATOR_NOISE = atof((getParameter("team_actuator_noise").c_str()));
387  Server::TEAM_L_START = getParameter("team_l_start");
388  Server::TEAM_R_START = getParameter("team_r_start");
389  Server::TEXT_LOG_COMPRESSION = atoi((getParameter("text_log_compression").c_str()));
390  Server::TEXT_LOG_DATED = atoi((getParameter("text_log_dated").c_str()));
391  Server::TEXT_LOG_DIR = getParameter("text_log_dir");
392  Server::TEXT_LOG_FIXED = atoi((getParameter("text_log_fixed").c_str()));
393  Server::TEXT_LOG_FIXED_NAME = getParameter("text_log_fixed_name");
394  Server::TEXT_LOGGING = atoi((getParameter("text_logging").c_str()));
395  Server::USE_OFFSIDE = atoi((getParameter("use_offside").c_str()));
396  Server::VERBOSE = atoi((getParameter("verbose").c_str()));
397  Server::VISIBLE_ANGLE = atof((getParameter("visible_angle").c_str()));
398  Server::VISIBLE_DISTANCE = atof((getParameter("visible_distance").c_str()));
399  Server::WIND_ANG = atof((getParameter("wind_ang").c_str()));
400  Server::WIND_DIR = atof((getParameter("wind_dir").c_str()));
401  Server::WIND_FORCE = atof((getParameter("wind_force").c_str()));
402  Server::WIND_NONE = atof((getParameter("wind_none").c_str()));
403  Server::WIND_RAND = atof((getParameter("wind_rand").c_str()));
404  Server::WIND_RANDOM = atof((getParameter("wind_random").c_str()));
405 }
406 
408 
409 }
410 
411 std::string Server::getParameter(std::string parameter) {
412  boost::regex parameter_regex("\\(" + parameter + "\\s+([\\w\\-\\.~%\"/]*)\\)");
413  boost::cmatch match;
414  if (boost::regex_search(server_params.c_str(), match, parameter_regex)) {
415  return std::string() + match[1];
416  } else {
417  std::cerr << "Server::getParameter(string) -> search failed miserably for parameter " << parameter << std::endl;
418  return "";
419  }
420 }
421 }
static double PLAYER_SIZE
Definition: Server.h:162
static int DROP_BALL_TIME
Definition: Server.h:74
static int PEN_READY_WAIT
Definition: Server.h:155
static int TACKLE_EXPONENT
Definition: Server.h:207
static int TACKLE_CYCLES
Definition: Server.h:205
static int PEN_NR_KICKS
Definition: Server.h:153
static int KICK_OFF_WAIT
Definition: Server.h:117
static double PEN_MAX_GOALIE_DIST_X
Definition: Server.h:152
static int PENALTY_SHOOT_OUTS
Definition: Server.h:158
static int HALF_TIME
Definition: Server.h:103
static double BALL_DECAY
Definition: Server.h:47
static int GOALIE_MAX_MOVES
Definition: Server.h:101
static double BALL_SIZE
Definition: Server.h:49
static int FREEFORM_SEND_PERIOD
Definition: Server.h:88
static double WIND_RAND
Definition: Server.h:228
static std::string TEXT_LOG_FIXED_NAME
Definition: Server.h:218
static int START_GOAL_L
Definition: Server.h:197
static int STAMINA_CAPACITY
Definition: Server.h:194
static int KEEPAWAY_LENGTH
Definition: Server.h:109
static double CKICK_MARGIN
Definition: Server.h:57
static int SYNCH_MICRO_SLEEP
Definition: Server.h:200
static int NR_NORMAL_HALFS
Definition: Server.h:142
static double BALL_SPEED_MAX
Definition: Server.h:50
static int SYNCH_MODE
Definition: Server.h:201
static double EFFORT_DEC
Definition: Server.h:75
static int COACH_W_REFEREE
Definition: Server.h:69
static double PRAND_FACTOR_L
Definition: Server.h:169
static int HEAR_MAX
Definition: Server.h:106
static int COACH_PORT
Definition: Server.h:68
static int KEEPAWAY_WIDTH
Definition: Server.h:116
static double QUANTIZE_STEP_L
Definition: Server.h:174
static int CLANG_META_WIN
Definition: Server.h:64
static int PROPER_GOAL_KICKS
Definition: Server.h:172
static double SLOWNESS_ON_TOP_FOR_RIGHT_TEAM
Definition: Server.h:193
static double MINNECKMOMENT
Definition: Server.h:139
static int CLANG_DEL_WIN
Definition: Server.h:60
static double TEAM_ACTUATOR_NOISE
Definition: Server.h:211
static int SEND_VI_STEP
Definition: Server.h:187
static int SAY_COACH_CNT_MAX
Definition: Server.h:182
static int GAME_LOG_DATED
Definition: Server.h:93
static int CATCH_BAN_CYCLE
Definition: Server.h:53
static double DASH_ANGLE_STEP
Definition: Server.h:72
static double PEN_RANDOM_WINNER
Definition: Server.h:154
static int RECORD_MESSAGES
Definition: Server.h:175
static int GAME_LOG_VERSION
Definition: Server.h:97
static int FULLSTATE_R
Definition: Server.h:91
static int POINT_TO_BAN
Definition: Server.h:166
static int OLD_COACH_HEAR
Definition: Server.h:146
static int CLANG_MESS_DELAY
Definition: Server.h:62
static double MINMOMENT
Definition: Server.h:137
static std::string TEXT_LOG_DIR
Definition: Server.h:216
static double MIN_DASH_ANGLE
Definition: Server.h:135
static double PEN_DIST_X
Definition: Server.h:150
static std::string GAME_LOG_DIR
Definition: Server.h:94
static int HEAR_DECAY
Definition: Server.h:104
static double PLAYER_ACCEL_MAX
Definition: Server.h:159
static std::string TEAM_L_START
Definition: Server.h:212
static double WIND_DIR
Definition: Server.h:225
Server(std::string server_params)
Definition: Server.cpp:215
static int PEN_TAKEN_WAIT
Definition: Server.h:157
static int VERBOSE
Definition: Server.h:221
static int PEN_ALLOW_MULT_KICKS
Definition: Server.h:147
static double KICK_RAND_FACTOR_L
Definition: Server.h:120
static double TACKLE_RAND_FACTOR
Definition: Server.h:209
static double EFFORT_INC_THR
Definition: Server.h:78
static int CLANG_WIN_SIZE
Definition: Server.h:66
static double PLAYER_DECAY
Definition: Server.h:160
static int KEEPAWAY_LOGGING
Definition: Server.h:114
static int GAME_LOG_FIXED
Definition: Server.h:95
static int EXTRA_HALF_TIME
Definition: Server.h:81
static int NR_EXTRA_HALFS
Definition: Server.h:141
static double PLAYER_SPEED_MAX_MIN
Definition: Server.h:164
static int MAX_GOAL_KICKS
Definition: Server.h:129
static double WIND_FORCE
Definition: Server.h:226
static double MAXNECKMOMENT
Definition: Server.h:133
static double TACKLE_DIST
Definition: Server.h:206
static int CLANG_RULE_WIN
Definition: Server.h:65
static int SEND_COMMS
Definition: Server.h:185
std::string server_params
Definition: Server.h:39
static int KEEPAWAY_LOG_DATED
Definition: Server.h:110
static int POINT_TO_DURATION
Definition: Server.h:167
static double PLAYER_SPEED_MAX
Definition: Server.h:163
static double VISIBLE_ANGLE
Definition: Server.h:222
static int PROFILE
Definition: Server.h:171
static int GAME_LOG_COMPRESSION
Definition: Server.h:92
static int TEXT_LOG_DATED
Definition: Server.h:215
static int AUTO_MODE
Definition: Server.h:43
static double EFFORT_INC
Definition: Server.h:77
static double KICK_POWER_RATE
Definition: Server.h:118
static std::string KEEPAWAY_LOG_DIR
Definition: Server.h:111
static int TEXT_LOGGING
Definition: Server.h:219
static double BALL_STUCK_AREA
Definition: Server.h:51
static double OFFSIDE_KICK_MARGIN
Definition: Server.h:144
static double SIDE_DASH_RATE
Definition: Server.h:189
static double EFFORT_MIN
Definition: Server.h:80
static double BALL_WEIGHT
Definition: Server.h:52
static int STAMINA_MAX
Definition: Server.h:196
static double TACKLE_BACK_DIST
Definition: Server.h:204
static int PEN_BEFORE_SETUP_WAIT
Definition: Server.h:148
static int KEEPAWAY_LOG_FIXED
Definition: Server.h:112
static int FULLSTATE_L
Definition: Server.h:90
static double PLAYER_RAND
Definition: Server.h:161
static double BALL_ACCEL_MAX
Definition: Server.h:46
static double AUDIO_CUT_DIST
Definition: Server.h:42
static double CATCHABLE_AREA_L
Definition: Server.h:55
static double RED_CARD_PROBABILITY
Definition: Server.h:181
static int RECV_STEP
Definition: Server.h:180
static int KEEPAWAY_START
Definition: Server.h:115
static double MAX_TACKLE_POWER
Definition: Server.h:130
static int TEXT_LOG_COMPRESSION
Definition: Server.h:214
static int USE_OFFSIDE
Definition: Server.h:220
static double SLOWNESS_ON_TOP_FOR_LEFT_TEAM
Definition: Server.h:192
static double DASH_POWER_RATE
Definition: Server.h:73
static double MINNECKANG
Definition: Server.h:138
static double OFFSIDE_ACTIVE_AREA_SIZE
Definition: Server.h:143
static double MAX_BACK_TACKLE_POWER
Definition: Server.h:126
static int FORBID_KICK_OFF_OFFSIDE
Definition: Server.h:83
static std::string KEEPAWAY_LOG_FIXED_NAME
Definition: Server.h:113
static int CLANG_DEFINE_WIN
Definition: Server.h:59
static int PEN_MAX_EXTRA_KICKS
Definition: Server.h:151
static int SYNCH_SEE_OFFSET
Definition: Server.h:203
static double RECOVER_DEC_THR
Definition: Server.h:177
static int SEND_STEP
Definition: Server.h:186
static int LOG_TIMES
Definition: Server.h:125
static double MAX_DASH_ANGLE
Definition: Server.h:127
static double RECOVER_INIT
Definition: Server.h:178
static int EXTRA_STAMINA
Definition: Server.h:82
static std::string TEAM_R_START
Definition: Server.h:213
static int SAY_MSG_SIZE
Definition: Server.h:184
static double KICKABLE_MARGIN
Definition: Server.h:122
static int HEAR_INC
Definition: Server.h:105
static double EFFORT_INIT
Definition: Server.h:79
static double BACK_DASH_RATE
Definition: Server.h:44
static int GOLDEN_GOAL
Definition: Server.h:102
static int SIMULATOR_STEP
Definition: Server.h:190
static double EFFORT_DEC_THR
Definition: Server.h:76
static double MIN_DASH_POWER
Definition: Server.h:136
static double TACKLE_POWER_RATE
Definition: Server.h:208
static double RECOVER_MIN
Definition: Server.h:179
static double CATCHABLE_AREA_W
Definition: Server.h:56
static int TEXT_LOG_FIXED
Definition: Server.h:217
static int STAMINA_INC_MAX
Definition: Server.h:195
static double WIND_ANG
Definition: Server.h:224
static int CLANG_MESS_PER_CYCLE
Definition: Server.h:63
static int SYNCH_OFFSET
Definition: Server.h:202
static int CLANG_ADVICE_WIN
Definition: Server.h:58
static double MAX_DASH_POWER
Definition: Server.h:128
static int INERTIA_MOMENT
Definition: Server.h:107
static int PORT
Definition: Server.h:168
std::string getParameter(std::string parameter)
Definition: Server.cpp:411
static int GAME_OVER_WAIT
Definition: Server.h:99
static int CLANG_INFO_WIN
Definition: Server.h:61
static int GAME_LOGGING
Definition: Server.h:98
static double RECOVER_DEC
Definition: Server.h:176
static int BACK_PASSES
Definition: Server.h:45
static int OLCOACH_PORT
Definition: Server.h:145
static double WIND_RANDOM
Definition: Server.h:229
static std::string GAME_LOG_FIXED_NAME
Definition: Server.h:96
static int PEN_COACH_MOVES_PLAYERS
Definition: Server.h:149
static double CONTROL_RADIUS
Definition: Server.h:71
static int FOUL_CYCLES
Definition: Server.h:84
static double FOUL_DETECT_PROBABILITY
Definition: Server.h:85
static double GOAL_WIDTH
Definition: Server.h:100
static double PLAYER_WEIGHT
Definition: Server.h:165
static int FOUL_EXPONENT
Definition: Server.h:86
static double TACKLE_WIDTH
Definition: Server.h:210
static std::string LOG_DATE_FORMAT
Definition: Server.h:124
static double STOPPED_BALL_VEL
Definition: Server.h:199
static int FREE_KICK_FAULTS
Definition: Server.h:87
static double MAXPOWER
Definition: Server.h:134
static int CONNECT_WAIT
Definition: Server.h:70
static double WIND_NONE
Definition: Server.h:227
static double QUANTIZE_STEP
Definition: Server.h:173
static int KEEPAWAY
Definition: Server.h:108
static int SENSE_BODY_STEP
Definition: Server.h:188
static double KICK_RAND_FACTOR_R
Definition: Server.h:121
static double MINPOWER
Definition: Server.h:140
static int FREEFORM_WAIT_PERIOD
Definition: Server.h:89
static int PEN_SETUP_WAIT
Definition: Server.h:156
static int START_GOAL_R
Definition: Server.h:198
static double KICK_RAND
Definition: Server.h:119
static double SLOW_DOWN_FACTOR
Definition: Server.h:191
static std::string LANDMARK_FILE
Definition: Server.h:123
static double BALL_RAND
Definition: Server.h:48
static int SAY_COACH_MSG_SIZE
Definition: Server.h:183
static double PRAND_FACTOR_R
Definition: Server.h:170
static int COACH
Definition: Server.h:67
static double MAXMOMENT
Definition: Server.h:131
static double VISIBLE_DISTANCE
Definition: Server.h:223
static double CATCH_PROBABILITY
Definition: Server.h:54
static double MAXNECKANG
Definition: Server.h:132