NimbRo ROS Soccer Package
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
wak_game_state.h
1 // Walk and kick: Game states base implementation
2 // Author: Philipp Allgeuer <pallgeuer@ais.uni-bonn.de>
3 
4  // Ensure header is only included once
5 #ifndef WAK_GAME_STATE_H
6 #define WAK_GAME_STATE_H
7 
8 // Includes
9 #include <walk_and_kick/wak_common.h>
10 #include <walk_and_kick/wak_config.h>
11 #include <walk_and_kick/wak_game_vars.h>
12 #include <walk_and_kick/wak_game_shared.h>
13 #include <walk_and_kick/wak_sensor_vars.h>
14 #include <walk_and_kick/wak_ros_interface.h>
15 #include <walk_and_kick/wak_beh_manager.h> // Note: Included here to give access to WAKBehManager::BehStateID in all game states
16 #include <walk_and_kick/wak_utils.h>
17 
18 // Walk and kick namespace
19 namespace walk_and_kick
20 {
27  {
28  public:
29  // Constructor
30  WAKGameState(WAKConfig& config, const SensorVars& SV, const WAKGameShared& WGS, int ID);
31  virtual ~WAKGameState() {}
32 
33  // Config parameters
34  WAKConfig& config;
35 
36  // Sensor variables
37  const SensorVars& SV;
38 
39  // Shared game variables
40  const WAKGameShared& WGS;
41 
42  // Field dimensions
43  const FieldDimensions& field;
44 
45  // Plot manager
46  plot_msgs::PlotManagerFS& PM;
47 
48  // Marker manager
49  WAKMarkerMan& MM;
50 
51  // Reset function
52  void reset() { deactivate(); }
53 
54  // Get functions
55  int id() const { return m_id; }
56  std::string name() const { return m_name; }
57  const std::string& nameRef() const { return m_name; }
58  bool isActive() const { return m_active; }
59 
60  // Activation and deactivation functions
61  void activate() { m_active = true; handleActivation(true); }
62  void deactivate() { m_active = false; handleActivation(false); }
63 
64  // Execute function
65  virtual void execute(GameVars& GV, const GameVars& lastGV, bool justActivated) { GV.reset(); }
66 
67  private:
68  // Handle activation function
69  virtual void handleActivation(bool nowActive) {}
70 
71  // Internal variables
72  int m_id;
73  std::string m_name;
74  bool m_active;
75  };
76 }
77 
78 #endif
79 // EOF
Configuration struct for the walk and kick node.
Definition: wak_config.h:20
Visualisation marker manager for the walk and kick node.
Definition: wak_vis.h:21
An interface class for encapsulating all of the ROS input data to the walk and kick node...
Definition: wak_sensor_vars.h:29
A class that shares the required walk and kick variables amongst the game state classes.
Definition: wak_game_shared.h:31
The base class for all walk and kick game states.
Definition: wak_game_state.h:26
A simple class for abstracting away the source of the field dimensions.
Definition: wak_utils.h:216
An interface class for encapsulating all of the data that the walk and kick game states should comman...
Definition: wak_game_vars.h:21