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

📄 serverparam.h

📁 在LINUX下运行的仿真机器人服务器源代码
💻 H
📖 第 1 页 / 共 3 页
字号:
/* -*- Mode: C++ -*- *//* *Copyright:    Copyright (C) 1996-2000 Electrotechnical Laboratory.     	Itsuki Noda, Yasuo Kuniyoshi and Hitoshi Matsubara.    Copyright (C) 2000, 2001 RoboCup Soccer Server Maintainance Group.    	Patrick Riley, Tom Howard, Daniel Polani, Itsuki Noda,	Mikhail Prokopenko, Jan Wendler     This file is a part of SoccerServer.    This code is free software; you can redistribute it and/or    modify it under the terms of the GNU Lesser General Public    License as published by the Free Software Foundation; either    version 2.1 of the License, or (at your option) any later version.    This library is distributed in the hope that it will be useful,    but WITHOUT ANY WARRANTY; without even the implied warranty of    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU    Lesser General Public License for more details.    You should have received a copy of the GNU Lesser General Public    License along with this library; if not, write to the Free Software    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA *EndCopyright: */#ifndef _SERVER_PARAM_H_#define _SERVER_PARAM_H_#include <map>#include <sys/param.h> /* needed for htonl, htons, ... */#include <netinet/in.h>#include <rcssbase/net/udpsocket.hpp>//#include <rcssbase/conf/builder.hpp>//#include <rcssbase/conf/parser.hpp>//#include <rcssbase/lib/loader.hpp>#include <boost/shared_ptr.hpp>//#include "paramreader.h"#include "utility.h"#include "types.h"namespace rcss{    namespace conf    {	class Parser;	class Builder;	class StreamStatusHandler;    }}class ServerParam//    : /*public ParamReader,*///      public rcss::conf::Builder{protected:    ServerParam ( const std::string& progname );private:    ServerParam( const ServerParam& ); // not used        ServerParam&    operator=( const ServerParam& ); // not usedprotected:public:    class Printer    {    private:        std::ostream& M_out;        unsigned int M_version;    public:        Printer( std::ostream& out, unsigned int version );                void        operator()( const std::pair< const std::string, unsigned int > item );    };  static  ServerParam&  instance( const std::string& progname );  static  ServerParam&  instance();  static  bool  init( const int& argc, const char * const *argv );private:    boost::shared_ptr< rcss::conf::Builder > m_builder;    boost::shared_ptr< rcss::conf::Parser > m_conf_parser;    boost::shared_ptr< rcss::conf::StreamStatusHandler > m_err_handler;public:  virtual ~ServerParam ();  server_params_t convertToStruct ();  public:    typedef std::map< std::string, unsigned int > VerMap;//   virtual void getOptions(const int& argc, const char * const *argv );//   virtual void writeConfig ( std::ostream& o );  private:  virtual   void   setDefaults();//   virtual//   void//   createMaps();    template< typename P >    void    addParam(  const std::string& name,                P& param,               const std::string& desc,               int version );    template< typename S, typename G >    void    addParam(  const std::string& name,                const S& setter,               const G& getter,               const std::string& desc,               int version );    void    addParams();private:    VerMap m_ver_map;public:    const VerMap&    verMap() const    { return m_ver_map; }		Value gwidth ;					/* goal width */		Value inertia_moment ;			/* intertia moment for turn */		Value psize ;					/* player size */		Value pdecay ;					/* player decay */		Value prand ;					/* player rand */		Value pweight ;					/* player weight */		Value pspeed_max ;				/* player speed max */		// th 6.3.00		Value paccel_max ;				/* player acceleration max */		//		Value stamina_max ;				/* player stamina max */		Value stamina_inc ;				/* player stamina inc */		Value recover_init ;			/* player recovery init */		Value recover_dthr ;			/* player recovery decriment threshold */		Value recover_min ;				/* player recovery min */		Value recover_dec ;				/* player recovery decriment */		Value effort_init ;				/* player dash effort init */		Value effort_dthr ;				/* player dash effort decriment threshold */		Value effort_min ;				/* player dash effrot min */		Value effort_dec ;				/* player dash effort decriment */		Value effort_ithr ;				/* player dash effort incriment threshold */		Value effort_inc ;				/* player dash effort incriment */		// pfr 8/14/00: for RC2000 evaluation		Value kick_rand;                                /* noise added directly to kicks */		bool team_actuator_noise;                        /* flag whether to use team specific actuator noise */		Value prand_factor_l;                           /* factor to multiple prand for left team */		Value prand_factor_r;                           /* factor to multiple prand for right team */		Value kick_rand_factor_l;                       /* factor to multiple kick_rand for left team */		Value kick_rand_factor_r;                       /* factor to multiple kick_rand for right team */		Value bsize ;					/* ball size */		Value bdecay ;					/* ball decay */		Value brand ;					/* ball rand */		Value bweight ;					/* ball weight */		Value bspeed_max ;				/* ball speed max */		// th 6.3.00		Value baccel_max;				/* ball acceleration max */		//		Value dprate ;					/* dash power rate */		Value kprate ;					/* kick power rate */		Value kmargin ;					/* kickable margin */		Value ctlradius ;				/* control radius */private:		Value ctlradius_width ;			/* (control radius) - (plyaer size) */    void    setCTLRadius( double value )    {        ctlradius_width -= ctlradius;        ctlradius = value;        ctlradius_width += ctlradius;    }public:    Value    CtlRadiusWidth() const    { return ctlradius_width; }		Value maxp ;					/* max power */		Value minp ;					/* min power */		Value maxm ;					/* max moment */		Value minm ;					/* min moment */		Value maxnm ;					/* max neck moment */		Value minnm ;					/* min neck moment */		Value maxn ;					/* max neck angle */		Value minn ;					/* min neck angle */private:		Value visangle ;				/* visible angle */public:		Value visdist ;					/* visible distance */		Angle windir ;					/* wind direction */		Value winforce ;				/* wind force */		Value winang ;					/* wind angle for rand */		Value winrand ;					/* wind force for force */private:		Value kickable_area ;			/* kickable_area */    void    setKickMargin( double value )    {        kickable_area -= kmargin;        kmargin = value;        kickable_area += kmargin;    }    void    setBallSize( double value )    {        kickable_area -= bsize;        bsize = value;        kickable_area += bsize;    }    void    setPlayerSize( double value )    {        ctlradius_width += psize;        kickable_area -= psize;        psize = value;        kickable_area += psize;        ctlradius_width -= psize;    }public:    Value    kickableArea() const    { return kickable_area; }		Value catch_area_l ;			/* goalie catchable area length */		Value catch_area_w ;			/* goalie catchable area width */		Value catch_prob ;				/* goalie catchable possibility */                int   goalie_max_moves;                 /* goalie max moves after a catch */	                bool kaway ;                         /* keepaway mode on/off */                Value ka_length ;                    /* keepaway region length */                Value ka_width ;                     /* keepaway region width */		Value ckmargin ;				/* corner kick margin */		Value offside_area ;			/* offside active area size */		bool win_no ;					/* wind factor is none */		bool win_random ;				/* wind factor is random */		int portnum ;					/* port number */		int coach_pnum ;				/* coach port number */		int olcoach_pnum ;				/* online coach port number */		int say_cnt_max ;				/* max count of coach SAY (freeform) */		int SayCoachMsgSize ;				/* max length of coach SAY (freeform) */		int clang_win_size;                         /* coach language: time window size */		int clang_define_win;                       /* coach language: define messages per window */		int clang_meta_win;                         /* coach language: meta messages per window */		int clang_advice_win;                       /* coach language: advice messages per window */		int clang_info_win;                         /* coach language: info messages per window */		int clang_mess_delay;                       /* coach language: delay between receive and send */		int clang_mess_per_cycle;                   /* coach language: number of messages to flush per cycle */private:  		int half_time ;					/* half time */    double    getHalfTimeScaler() const	{	    double value = ((1000.0 / (sim_st / slow_down_factor)));	    if( value != 0.0 )		return value;	    else		return EPS;	}    //Have to be careful with integer math, see bug # 800540    void    setHalfTime( int value )    {        half_time = (int)rint( value * getHalfTimeScaler());    }    //Have to be careful with integer math, see bug # 800540    int    getRawHalfTime() const    {        return (int)rint(half_time / getHalfTimeScaler());    }public:    int     halfTime() const    { return half_time; }		int drop_time;                                  /* cycles for dropping																											 the ball after a free kick,																											 corner kick message and																											 noone kicking the ball.																											 0 means don't drop																											 automatically  */                int nr_normal_halfs;    /* nr of normal halfs: default 2)      */                int nr_extra_halfs;     /* nr of extra halfs: -1 is infinite)  */                bool penalty_shoot_outs;/* penalty shoot outs after extra halfs*/                int pen_before_setup_wait;/* cycles waited before penalty setup*/                int pen_setup_wait;       /* cycles waited to setup penalty    */                int pen_ready_wait;       /* cycles waited to take penalty     */                int pen_taken_wait;       /* cycles waited to finish penalty   */                int pen_nr_kicks;         /* number of penalty kicks           */                int pen_max_extra_kicks;  /* max. nr of extra penalty kicks    */                double pen_dist_x;        /* distance from goal to place ball  */                bool pen_random_winner;   /* random winner when draw?          */                bool pen_allow_mult_kicks;/* can attacker kick mult. times */                double pen_max_goalie_dist_x;/*max distance from goal for goalie*/                bool pen_coach_moves_players; /*coach moves players when positioned wrongly */private:		int sim_st ;					/* simulator step interval msec */		int sb_step ;					/* sense_body interval step msec */		int sv_st ;					/* online coach's look interval step */		int send_st ;					/* udp send step interval msec */		int lcm_st ;		                        /* lcm of all the above steps msec */    void    setSimStep( int value )    {        half_time = (int)rint( half_time / getHalfTimeScaler());        sim_st = value * slow_down_factor;        half_time = (int)rint( half_time * getHalfTimeScaler());    }    int    getRawSimStep() const    {        return sim_st / slow_down_factor;    }    void    setSenseBodyStep( int value )    {        sb_step = value * slow_down_factor;    }    int    getRawSenseBodyStep() const    {        return sb_step / slow_down_factor;    }    void    setCoachVisualStep( int value )    {        sv_st = value * slow_down_factor;    }    int    getRawCoachVisualStep() const    {        return sv_st / slow_down_factor;    }    void    setSendStep( int value )    {        send_st = value * slow_down_factor;    }        int    getRawSendStep() const    {        return send_st / slow_down_factor;    }    void    setSynchOffset( int value )    {        synch_offset = value * slow_down_factor;    }

⌨️ 快捷键说明

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