body_dribble2007.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_DRIBBLE_2007_H
00033 #define RCSC_ACTION_BODY_DRIBBLE_2007_H
00034 
00035 #include <rcsc/player/soccer_action.h>
00036 #include <rcsc/geom/vector_2d.h>
00037 
00038 #include <vector>
00039 #include <list>
00040 
00041 namespace rcsc {
00042 
00043 class WorldModel;
00044 
00049 class Body_Dribble2007
00050     : public BodyAction {
00051 public:
00052 
00057     struct KeepDribbleInfo {
00058         Vector2D first_ball_vel_; 
00059         double ball_forward_travel_; 
00060         int dash_count_; 
00061         double min_opp_dist_; 
00062 
00070         KeepDribbleInfo( const Vector2D & first_ball_vel,
00071                          const double & ball_forward_travel,
00072                          const int dash_count,
00073                          const double & min_opp_dist )
00074             : first_ball_vel_( first_ball_vel )
00075             , ball_forward_travel_( ball_forward_travel )
00076             , dash_count_( dash_count )
00077             , min_opp_dist_( min_opp_dist )
00078           { }
00079     };
00080 
00081 private:
00083     const Vector2D M_target_point;
00085     const double M_dist_thr;
00087     double M_dash_power;
00089     int M_dash_count;
00091     const bool M_dodge_mode;
00092 public:
00103     Body_Dribble2007( const Vector2D & target_point,
00104                       const double & dist_thr,
00105                       const double & dash_power,
00106                       const int dash_count,
00107                       const bool dodge = true )
00108         : M_target_point( target_point )
00109         , M_dist_thr( dist_thr )
00110         , M_dash_power( dash_power )
00111         , M_dash_count( dash_count )
00112         , M_dodge_mode( dodge )
00113       { }
00114 
00120     bool execute( PlayerAgent * agent );
00121 
00122 private:
00123 
00130     void say( PlayerAgent * agent,
00131               const Vector2D & target_point,
00132               const int queu_count );
00133 
00144     bool doAction( PlayerAgent * agent,
00145                    const Vector2D & target_point,
00146                    const double & dash_power,
00147                    const int dash_count,
00148                    const bool dodge,
00149                    const bool dodge_mode = false );
00150 
00151     bool doTurn( PlayerAgent * agent,
00152                  const Vector2D & target_point,
00153                  const double & dash_power,
00154                  const int dash_count,
00155                  const bool dodge );
00156 
00165     bool doTurnOnly( PlayerAgent * agent,
00166                      const Vector2D & target_point,
00167                      const double & dash_power,
00168                      const double & dir_diff );
00169 
00175     bool doCollideWithBall( PlayerAgent * agent );
00176 
00186     bool doCollideForTurn( PlayerAgent * agent,
00187                            const double & dir_diff_abs,
00188                            const bool kick_first );
00189 
00199     bool doKickTurnsDash( PlayerAgent * agent,
00200                           const Vector2D & target_point,
00201                           const double & dash_power,
00202                           const double & dir_diff,
00203                           const double & dir_margin_abs );
00204 
00205     bool doKickTurnsDashes( PlayerAgent * agent,
00206                             const Vector2D & target_point,
00207                             const double & dash_power,
00208                             const int n_turn );
00209 
00219     bool doKickDashes( PlayerAgent * agent,
00220                        const Vector2D & target_point,
00221                        const double & dash_power,
00222                        const int dash_count );
00223 
00228     bool doKickDashesWithBall( PlayerAgent * agent,
00229                                const Vector2D & target_point,
00230                                const double & dash_power,
00231                                const int dash_count,
00232                                const bool dodge_mode );
00233 
00234     void createSelfCache( PlayerAgent * agent,
00235                           const Vector2D & target_point,
00236                           const double & dash_power,
00237                           const int turn_count,
00238                           const int dash_count,
00239                           std::vector< Vector2D > & self_cache );
00240 
00241     bool existKickableOpponent( const WorldModel & wm,
00242                                 const Vector2D & ball_pos,
00243                                 double * min_opp_dist ) const;
00244 
00251     bool doDodge( PlayerAgent * agent,
00252                   const Vector2D & target_point );
00253 
00260     bool doAvoidKick( PlayerAgent * agent,
00261                       const AngleDeg & avoid_angle );
00268     bool isDodgeSituation( const PlayerAgent * agent,
00269                            const Vector2D & target_point );
00270 
00279     bool canKickAfterDash( const PlayerAgent * agent,
00280                            double * dash_power );
00281 
00289     bool existCloseOpponent( const PlayerAgent * agent,
00290                              AngleDeg * keep_angle );
00291 
00298     AngleDeg getAvoidAngle( const PlayerAgent * agent,
00299                             const AngleDeg & target_angle );
00300 
00301 };
00302 
00303 }
00304 
00305 #endif

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