00001
00002
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
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
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
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
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