self_intercept.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_PLAYER_SELF_INTERCEPT_H
00033 #define RCSC_PLAYER_SELF_INTERCEPT_H
00034 
00035 #include <rcsc/geom/vector_2d.h>
00036 #include <vector>
00037 
00038 namespace rcsc {
00039 
00040 class InterceptInfo;
00041 class BallObject;
00042 class SelfObject;
00043 class WorldModel;
00044 
00049 class SelfIntercept {
00050 public:
00052     static const double MIN_TURN_THR;
00054     static const double BACK_DASH_THR_ANGLE;
00055 
00056 private:
00058     const WorldModel & M_world;
00059 
00060     // noncopyable
00061     SelfIntercept();
00062     SelfIntercept( const SelfIntercept & );
00063     SelfIntercept & operator=( const SelfIntercept & );
00064 public:
00069     explicit
00070     SelfIntercept( const WorldModel & world )
00071         : M_world( world )
00072       { }
00073 
00075 
00081     void predict( const int max_cycle,
00082                   std::vector< InterceptInfo > & self_cache ) const;
00083 
00084 
00085 private:
00087     // one dash
00088 
00093     void predictOneStep( std::vector< InterceptInfo > & self_cache ) const;
00094 
00104     bool predictNoDash( const bool goalie_mode,
00105                         const double & control_area,
00106                         const Vector2D & next_ball_rel,
00107                         std::vector< InterceptInfo > & self_cache ) const;
00108 
00119     void predictOneDash( const double & control_area,
00120                          const Vector2D & next_ball_rel,
00121                          std::vector< InterceptInfo > & self_cache ) const;
00122 
00134     bool predictOneDashAdjustX( const double & control_area,
00135                                 const Vector2D & next_ball_rel,
00136                                 const double & back_accel_x,
00137                                 const double & forward_accel_x,
00138                                 const bool stamina_safety,
00139                                 std::vector< InterceptInfo > & self_cache ) const;
00152     double getOneStepBestTrapPower( const double & control_area,
00153                                     const Vector2D & next_ball_rel,
00154                                     const double & max_back_accel_x,
00155                                     const double & max_forward_accel_x ) const;
00157     // long dash
00158 
00164     void predictLongStep( const int max_cycle,
00165                           std::vector< InterceptInfo > & self_cache ) const;
00166 
00171     void predictFinal( std::vector< InterceptInfo > & self_cache ) const;
00172 
00183     bool canReachAfterTurnDash( const int cycle,
00184                                 const Vector2D & ball_pos,
00185                                 const double & control_area,
00186                                 int * n_turn,
00187                                 bool * back_dash,
00188                                 bool * save_recovery ) const;
00189 
00199     int predictTurnCycle( const int cycle,
00200                           const Vector2D & ball_pos,
00201                           const double & control_area,
00202                           AngleDeg * dash_angle,
00203                           bool * back_dash ) const;
00204 
00212     bool canBackDashChase( const int cycle,
00213                            const double & target_dist,
00214                            const double & angle_diff ) const;
00215 
00227     bool canReachAfterDash( const int n_turn,
00228                             const int n_dash,
00229                             const Vector2D & ball_pos,
00230                             const double & control_area,
00231                             const AngleDeg & dash_angle,
00232                             const bool back_dash,
00233                             bool * save_recovery ) const;
00234 };
00235 
00236 }
00237 
00238 #endif

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