NimbRo ROS Soccer Package
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
walk_and_kick.h
1 // Walk and kick: Main walk and kick class
2 // Author: Philipp Allgeuer <pallgeuer@ais.uni-bonn.de>
3 
4 // Ensure header is only included once
5 #ifndef WALK_AND_KICK_H
6 #define WALK_AND_KICK_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_sensor_vars.h>
12 #include <walk_and_kick/wak_ros_interface.h>
13 #include <walk_and_kick/wak_game_manager.h>
14 #include <walk_and_kick/wak_beh_manager.h>
15 #include <walk_and_kick/wak_utils.h>
16 #include <walk_and_kick/TeamCommsData.h>
17 #include <walk_and_kick/VisualiseDBH.h>
18 #include <std_srvs/Empty.h>
19 
20 // TODO: Get WAK working with Gazebo
21 
27 namespace walk_and_kick
28 {
35  {
36  public:
37  // Constructor
38  WalkAndKick();
39 
40  // Reset functions
41  void reset();
42  void resetAll();
43 
44  // Initialisation function
45  bool init();
46 
47  // Step function
48  void step();
49 
50  // Publish functions
51  bool publishLEDPending() { return (m_lastBlinkLED != shouldBlinkLED()); }
52  void publishLED() { m_lastBlinkLED = shouldBlinkLED(); RI.updateRGBLED(m_lastBlinkLED); }
53  void publishNeutral() { RI.writeNeutral(); }
54  void publishState();
55  void publishTeamComms(const ros::Time& now);
56 
57  // Service handlers
58  bool handleVisualiseClear(std_srvs::EmptyRequest& req, std_srvs::EmptyResponse& resp);
59  bool handleVisualiseDBH(walk_and_kick::VisualiseDBHRequest& req, walk_and_kick::VisualiseDBHResponse& resp);
60  bool handleVisualiseDbApp(walk_and_kick::VisualiseDbAppRequest& req, walk_and_kick::VisualiseDbAppResponse& resp);
61  bool handleVisualiseGcvXY(std_srvs::EmptyRequest& req, std_srvs::EmptyResponse& resp);
62 
63  // Config parameters
64  WAKConfig config;
65 
66  private:
67  // ROS interface
68  WAKRosInterface RI;
69 
70  // Sensor variables
71  SensorVars SV;
72 
73  // Finite state machine managers
74  WAKGameManager GM;
75  WAKBehManager BM;
76 
77  // Field dimensions
78  const FieldDimensions field;
79 
80  // Cycle number
81  cycle_t m_wakCycle;
82 
83  // Team communications
84  TeamCommsData m_teamPacket;
85  int m_teamPacketCount;
86 
87  // LED blinking
88  bool shouldBlinkLED() const { return SV.listenToGC; }
89  bool m_lastBlinkLED;
90  };
91 }
92 
93 #endif
94 // EOF
Configuration struct for the walk and kick node.
Definition: wak_config.h:20
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 manages and executes the walk and kick behaviour states.
Definition: wak_beh_manager.h:50
The main walk and kick behaviour class.
Definition: walk_and_kick.h:34
A simple class for abstracting away the source of the field dimensions.
Definition: wak_utils.h:216
A class that manages and executes the walk and kick game states.
Definition: wak_game_manager.h:38
An interface class between the walk and kick and ROS worlds.
Definition: wak_ros_interface.h:54