body_pass.h

説明を見る。
00001 // -*-c++-*-
00002 
00008 /*
00009  *Copyright:
00010 
00011  Copyright (C) Hidehisa AKIYAMA
00012 
00013  This code is free software; you can redistribute it and/or
00014  modify it under the terms of the GNU Lesser General Public
00015  License as published by the Free Software Foundation; either
00016  version 2.1 of the License, or (at your option) any later version.
00017 
00018  This library is distributed in the hope that it will be useful,
00019  but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00021  Lesser General Public License for more details.
00022 
00023  You should have received a copy of the GNU Lesser General Public
00024  License along with this library; if not, write to the Free Software
00025  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026 
00027  *EndCopyright:
00028  */
00029 
00031 
00032 #ifndef RCSC_ACTION_BODY_PASS_H
00033 #define RCSC_ACTION_BODY_PASS_H
00034 
00035 #include <rcsc/player/soccer_action.h>
00036 #include <rcsc/geom/vector_2d.h>
00037 
00038 #include <functional>
00039 #include <vector>
00040 
00041 namespace rcsc {
00042 
00043 class WorldModel;
00044 class PlayerObject;
00045 
00050 class Body_Pass
00051     : public BodyAction {
00052 public:
00057     enum PassType {
00058         DIRECT  = 1,
00059         LEAD    = 2,
00060         THROUGH = 3
00061     };
00062 
00068     struct PassRoute {
00069         PassType type_; 
00070         const PlayerObject * receiver_; 
00071         Vector2D receive_point_; 
00072         double first_speed_; 
00073         bool one_step_kick_; 
00074         double score_; 
00075 
00084         PassRoute( PassType type,
00085                    const PlayerObject * receiver,
00086                    const Vector2D & point,
00087                    const double & speed,
00088                    const bool one_step_kick )
00089             : type_( type )
00090             , receiver_( receiver )
00091             , receive_point_( point )
00092             , first_speed_( speed )
00093             , one_step_kick_( one_step_kick )
00094             , score_( 0.0 )
00095           { }
00096     };
00097 
00102     class PassRouteScoreComp
00103         : public std::binary_function< PassRoute, PassRoute, bool > {
00104     public:
00111         result_type operator()( const first_argument_type & lhs,
00112                                 const second_argument_type & rhs ) const
00113           {
00114               return lhs.score_ < rhs.score_;
00115           }
00116     };
00117 
00118 private:
00119 
00121     static std::vector< PassRoute > S_cached_pass_route;
00122 
00123 
00124 public:
00128     Body_Pass()
00129       { }
00130 
00136     bool execute( PlayerAgent * agent );
00137 
00146     static
00147     bool get_best_pass( const WorldModel & world,
00148                         Vector2D * target_point,
00149                         double * first_speed,
00150                         int * receiver );
00151 
00152 private:
00153     static
00154     void create_routes( const WorldModel & world );
00155 
00156     static
00157     void create_direct_pass( const WorldModel & world,
00158                              const PlayerObject * teammates );
00159     static
00160     void create_lead_pass( const WorldModel & world,
00161                            const PlayerObject * teammates );
00162     static
00163     void create_through_pass( const WorldModel & world,
00164                               const PlayerObject * teammates );
00165 
00166     static
00167     bool verify_direct_pass( const WorldModel & world,
00168                              const PlayerObject * receiver,
00169                              const Vector2D & target_point,
00170                              const double & target_dist,
00171                              const AngleDeg & target_angle,
00172                              const double & first_speed );
00173     static
00174     bool verify_through_pass( const WorldModel & world,
00175                               const PlayerObject * receiver,
00176                               const Vector2D & receiver_pos,
00177                               const Vector2D & target_point,
00178                               const double & target_dist,
00179                               const AngleDeg & target_angle,
00180                               const double & first_speed,
00181                               const double & reach_step );
00182 
00183     static
00184     void evaluate_routes( const WorldModel & world );
00185 
00186     static
00187     bool can_kick_by_one_step( const WorldModel & world,
00188                                const double & first_speed,
00189                                const AngleDeg & target_angle );
00190 };
00191 
00192 }
00193 
00194 #endif

librcscに対してThu May 1 15:41:20 2008に生成されました。  doxygen 1.5.0