LIBRCSC Docs
Documentation for HELIOS's BASE LIBRCSC library for RoboCup 2D Simulation League.
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
view_grid_map.h
Go to the documentation of this file.
1// -*-c++-*-
2
8/*
9 *Copyright:
10
11 Copyright (C) Hidehisa AKIYAMA
12
13 This code is free software; you can redistribute it and/or
14 modify it under the terms of the GNU Lesser General Public
15 License as published by the Free Software Foundation; either
16 version 3 of the License, or (at your option) any later version.
17
18 This library is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 Lesser General Public License for more details.
22
23 You should have received a copy of the GNU Lesser General Public
24 License along with this library; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26
27 *EndCopyright:
28 */
29
31
32#ifndef RCSC_PLAYER_VIEW_GRID_MAP_H
33#define RCSC_PLAYER_VIEW_GRID_MAP_H
34
35#include <rcsc/geom/vector_2d.h>
36
37#include <vector>
38#include <utility>
39
40namespace rcsc {
41
42class GameTime;
43class ViewArea;
44
50public:
51
52 struct Grid {
53 const rcsc::Vector2D center_;
54 int seen_count_;
55
56 Grid() = delete;
57
58 explicit
59 Grid( const rcsc::Vector2D & center )
60 : center_( center ),
61 seen_count_( 0 )
62 { }
63 };
64
65private:
66
67 std::vector< Grid > M_grid_map;
68
69public:
70
71 static const double GRID_LENGTH;
72
73 static const double PITCH_MAX_X;
74 static const double PITCH_MAX_Y;
75 static const double PITCH_LENGTH;
76 static const double PITCH_WIDTH;
77
78 static const int GRID_X_SIZE;
79 static const int GRID_Y_SIZE;
80 static const double GRID_RADIUS;
81 static const double GRID_RADIUS2;
82
83public:
84
89
94
99
103 void update( const GameTime & time,
104 const ViewArea & view_area );
105
106 const std::vector< Grid > & gridMap() const
107 {
108 return M_grid_map;
109 }
110
116 int seenCount( const Vector2D & pos ) const;
117
121 void debugOutput() const;
122
123};
124
125}
126
127#endif
game time object
Definition: game_time.h:43
2D point vector class
Definition: vector_2d.h:46
player's view area.
Definition: view_area.h:48
grid map that stores field accuracy information
Definition: view_grid_map.h:49
ViewGridMap()
default constructor
~ViewGridMap()
destructor.
void update(const GameTime &time, const ViewArea &view_area)
update by new see info
void debugOutput() const
output the debug data
void incrementAll()
simply increment all grid values.
int seenCount(const Vector2D &pos) const
get the count since last observation
Definition: view_grid_map.h:52
2d vector class Header File.