visualsenderplayer.h

来自「2009 ROBOCUP 仿真2DSERVER 源码」· C头文件 代码 · 共 612 行 · 第 1/2 页

H
612 行
字号
      {          return Quantize( std::exp( Quantize( std::log( std::fabs( player_2_line                                                                    / std::cos( sight_2_line_ang ) )                                                         + EPS ),                                               qstep ) ), 0.1 );      }    void calcVel( const PVector & obj_vel,                  const PVector & obj_pos,                  const double & un_quant_dist,                  const double & quant_dist,                  double & dist_chg,                  double & dir_chg ) const;    bool decide( const double & prob )      {          if ( prob >= 1.0 ) return true;          if ( prob <= 0.0 ) return false;          return boost::bernoulli_distribution<>( prob )( random::DefaultRNG::instance() );      }protected:    virtual    void serializePlayer( const Player & player,                          const std::string & name,                          const double & dist,                          const int dir,                          const double & dist_chg,                          const double & dir_chg );    virtual    void serializePlayer( const Player & player,                          const std::string & name,                          const double & dist,                          const int dir );    virtual    int rad2Deg( const double & rad ) const      {          return Rad2IDeg( rad );      }    virtual    const    std::string & calcName( const PObject & obj ) const      {          return obj.name();      }    virtual    const    std::string & calcCloseName( const PObject & obj ) const      {          return obj.closeName();      }    virtual    const    std::string & calcTFarName( const Player & obj ) const      {          return obj.nameTooFar();      }    virtual    const    std::string & calcUFarName( const Player & obj ) const      {          return obj.nameFar();      }private:    void (VisualSenderPlayerV1::*M_send_flag)( const PObject & );    void (VisualSenderPlayerV1::*M_send_ball)( const MPObject & );    void (VisualSenderPlayerV1::*M_send_player)( const Player & );    void (VisualSenderPlayerV1::*M_serialize_line)( const std::string &,                                                    const int,                                                    const double &,                                                    const double & );};/*!//===================================================================////  CLASS: VisualSenderPlayerV4////  DESC: Class for the version 4 visual protocol.  This version//        introduced body directions of players. Everything else is//        the same.////===================================================================*/class VisualSenderPlayerV4    : public VisualSenderPlayerV1 {public:    VisualSenderPlayerV4( const Params & params );    virtual    ~VisualSenderPlayerV4();protected:    virtual    void serializePlayer( const Player & player,                          const std::string & name,                          const double & dist,                          const int dir,                          const double & dist_chg,                          const double & dir_chg );    int calcBodyDir( const Player & player ) const      {          return rad2Deg( normalize_angle( player.angleBodyCommitted()                                           - self().angleBodyCommitted()                                           - self().angleNeckCommitted() ) );      }};/*!//===================================================================////  CLASS: VisualSensorPlayerV5////  DESC: Class for the version 5 visual protocol.  This version//        introduced head directions of players. Everything else is//        the same////===================================================================*/class VisualSenderPlayerV5    : public VisualSenderPlayerV4 {public:    VisualSenderPlayerV5( const Params & params );    virtual    ~VisualSenderPlayerV5();protected:    virtual    void serializePlayer( const Player & player,                          const std::string & name,                          const double & dist,                          const int dir,                          const double & dist_chg,                          const double & dir_chg );    int calcHeadDir( const Player & player ) const      {          return rad2Deg( normalize_angle( player.angleNeckCommitted()                                           + player.angleBodyCommitted()                                           - self().angleBodyCommitted()                                           - self().angleNeckCommitted() ) );      }};/*!//===================================================================////  CLASS: VisualSensorPlayerV6////  DESC: Class for the version 6 visual protocol.  This version//        introduced shortened names for all the objects meaning the//        name calculation must be redefined.////===================================================================*/class VisualSenderPlayerV6    : public VisualSenderPlayerV5 {public:    VisualSenderPlayerV6( const Params & params );    virtual    ~VisualSenderPlayerV6();    virtual    const    std::string & calcName( const PObject & obj ) const      {          return obj.shortName();      }    virtual    const    std::string & calcCloseName( const PObject & obj ) const      {          return obj.shortCloseName();      }    virtual    const    std::string & calcUFarName( const Player & obj ) const      {          return obj.shortNameFar();      }    virtual    const    std::string & calcTFarName( const Player & obj ) const      {          return obj.shortNameTooFar();      }};/*!//===================================================================////  CLASS: VisualSensorPlayerV7////  DESC: Class for the version 7 visual protocol.  This version//        fixed a bug in the generation of directions in that they//        were truncated to int, rather than rounded.  This meant//        error in the direction pointed was at most times between//        -0.5 and +0.5 degrees, but occationally between -1.0 and//        +1.0 degrees and at other times exact.  With the new method//        of rounding, the error is always between -0.5 and +0.5.////===================================================================*/class VisualSenderPlayerV7    : public VisualSenderPlayerV6 {public:    VisualSenderPlayerV7( const Params & params );    virtual    ~VisualSenderPlayerV7();protected:    virtual    int rad2Deg( const double & rad ) const      {          return Rad2IDegRound( rad );      }};/*!//===================================================================////  CLASS: VisualSensorPlayerV8////  DESC: Class for the version 8 visual protocol.  This version//        introduced observation of the a new arm feature, that//        allows plays to point to different spots, however, on//        direction the arm is pointing to is visable, not the//        distance to the spot the arm is pointing to.////===================================================================*/class VisualSenderPlayerV8    : public VisualSenderPlayerV7 {public:    VisualSenderPlayerV8( const Params & params );    virtual    ~VisualSenderPlayerV8();protected:    int calcPointDir( const Player & player );    virtual    void serializePlayer( const Player & player,                          const std::string & name,                          const double & dist,                          const int dir,                          const double & dist_chg,                          const double & dir_chg );    virtual    void serializePlayer( const Player & player,                          const std::string & name,                          const double & dist,                          const int dir );};/*!//===================================================================////  CLASS: VisualSensorPlayerV13////  DESC: Class for the version 13 visual protocol.  This version//        introduced observation of the kicking state of other players.////===================================================================*/class VisualSenderPlayerV13    : public VisualSenderPlayerV8 {public:    VisualSenderPlayerV13( const Params & params );    virtual    ~VisualSenderPlayerV13();};}#endif

⌨️ 快捷键说明

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