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_KICK_TABLE_H
00033 #define RCSC_PLAYER_KICK_TABLE_H
00034
00035 #include <rcsc/geom/vector_2d.h>
00036
00037 namespace rcsc {
00038
00039 class WorldModel;
00040
00041
00042
00043
00044
00045
00046 class KickPoint {
00047 public:
00048 static const int MAX_INTERFERE;
00049
00050 private:
00051 std::size_t M_index;
00052 Vector2D M_ball_pos;
00053 double M_kick_rate;
00054
00058 int M_interfere_cycle;
00059
00061 KickPoint();
00062 public:
00064 KickPoint( const std::size_t index,
00065 const Vector2D & ball_pos,
00066 const double & kick_rate,
00067 const int cycle )
00068 : M_index( index )
00069 , M_ball_pos( ball_pos )
00070 , M_kick_rate( kick_rate )
00071 , M_interfere_cycle( cycle )
00072 { }
00073
00075 std::size_t getIndex() const
00076 {
00077 return M_index;
00078 }
00079
00081 const
00082 Vector2D & ballPos() const
00083 {
00084 return M_ball_pos;
00085 }
00087 const
00088 double & kickRate() const
00089 {
00090 return M_kick_rate;
00091 }
00093 int interfereCycle() const
00094 {
00095 return M_interfere_cycle;
00096 }
00097 };
00098
00099 typedef std::vector< KickPoint > KickPointCont;
00100 typedef std::vector< const KickPoint * > KickPointPtrCont;
00101
00102 class TwoKick {
00103 private:
00104 std::size_t M_first;
00105 std::size_t M_second;
00106 double M_score;
00107 public:
00108 TwoKick( const std::size_t first,
00109 const std::size_t first,
00110 const double & score )
00111 : M_first( first )
00112 , M_sencod( second )
00113 , M_score( score )
00114 { }
00115
00116 };
00117
00118
00128 class KickTable {
00129 public:
00130 enum {
00131 MAX_DEPTH = 2,
00132 ANGLE_DIVS_LOW = 8,
00133 ANGLE_DIVS_HIGH = 12
00134 };
00135 private:
00136
00141 KickPointCont M_kick_points[MAX_DEPTH];
00146 KickPointPtrCont M_kick_points_ptr[MAX_DEPTH];
00147
00148
00149 Kicktable( const KickTable & );
00150 KickTable & operator=( const KickTable & );
00151 public:
00153 KickTable();
00154
00156 void update( const WorldModel & world );
00157
00164 inline
00165 const
00166 KickPointPtrCont * getKickPoints( const int depth ) const
00167 {
00168 if ( depth < 0 || MAX_DEPTH <= depth )
00169 {
00170 return static_cast< KickPointPtrCont* >( 0 );
00171 }
00172 return &( M_kick_points_ptr[depth] );
00173 }
00174
00175 private:
00177 void setPoints( const WorldModel & world );
00179 int calcInterfereCycle( const WorldModel & world,
00180 const Vector2D & point,
00181 const int depth );
00182
00184 void sortPoints();
00185
00186 };
00187
00188 }
00189
00190 #endif