5 #ifndef WAK_BEH_MANAGER_H
6 #define WAK_BEH_MANAGER_H
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_sensor_vars.h>
13 #include <walk_and_kick/wak_actuator_vars.h>
14 #include <walk_and_kick/wak_ros_interface.h>
15 #include <walk_and_kick/wak_game_shared.h>
16 #include <walk_and_kick/wak_beh_shared.h>
17 #include <walk_and_kick/wak_beh_state.h>
18 #include <walk_and_kick/wak_beh_state_combined.h>
21 #include <walk_and_kick/beh_states/beh_unknown_state.h>
22 #include <walk_and_kick/beh_states/beh_stopped.h>
23 #include <walk_and_kick/beh_states/beh_panic_attack.h>
24 #include <walk_and_kick/beh_states/beh_search_for_ball.h>
25 #include <walk_and_kick/beh_states/beh_go_behind_ball.h>
26 #include <walk_and_kick/beh_states/beh_dribble_ball.h>
27 #include <walk_and_kick/beh_states/beh_kick_ball.h>
28 #include <walk_and_kick/beh_states/beh_dive_for_ball.h>
29 #include <walk_and_kick/beh_states/gaze_beh_look_around.h>
30 #include <walk_and_kick/beh_states/gaze_beh_look_at_ball.h>
31 #include <walk_and_kick/beh_states/gaze_beh_look_down.h>
32 #include <walk_and_kick/beh_states/gaze_beh_look_for_ball.h>
33 #include <walk_and_kick/beh_states/gaze_beh_look_left_right.h>
34 #include <walk_and_kick/beh_states/walk_beh_walk_to_pose.h>
37 namespace walk_and_kick
40 typedef WAKBehStateCombined<WalkBehWalkToPose, GazeBehLookAround> BehWalkToPoseLookAround;
41 typedef WAKBehStateCombined<WalkBehWalkToPose, GazeBehLookAtBall> BehWalkToPoseLookAtBall;
42 typedef WAKBehStateCombined<WalkBehWalkToPose, GazeBehLookForBall> BehWalkToPoseLookForBall;
43 typedef WAKBehStateCombined<WalkBehWalkToPose, GazeBehLookLeftRight> BehWalkToPoseLookLeftRight;
70 BS_WALK_TO_POSE_LOOK_AROUND,
71 BS_WALK_TO_POSE_LOOK_AT_BALL,
72 BS_WALK_TO_POSE_LOOK_FOR_BALL,
73 BS_WALK_TO_POSE_LOOK_LEFT_RIGHT,
76 static bool behStateValid(
int BSI) {
return (BSI > BS_UNKNOWN && BSI < BS_COUNT); }
77 static bool behStateValid(BehStateID BSI) {
return behStateValid((
int) BSI); }
78 static const std::string& behStateName(BehStateID BSI) {
return behStateName((
int) BSI); }
79 static const std::string& behStateName(
int BSI) {
if(behStateValid(BSI))
return BehStateName[BSI];
else return BehStateName[BS_UNKNOWN]; }
81 static const std::string BehStateName[BS_COUNT];
91 void resetStateMachine();
94 void registerState(
WAKBehState* state,
int ID,
const std::string& name);
97 const WAKBehState* currentState()
const {
return m_curState; }
98 const BehStopped* stoppedState()
const {
return Stopped; }
104 cycle_t wakCycle()
const {
return m_wakCycle; }
105 cycle_t stateCycle()
const {
return m_stateCycle; }
106 BAType ballAction()
const {
return m_ballAction; }
109 void updateManager(
const GameVars& GV, cycle_t wakCycle);
158 std::string stateNameForID(
int ID);
159 std::map<int, WAKBehState*> m_stateMap;
160 std::map<int, std::string> m_stateNameMap;
174 bool m_allowBreakDribble;
177 bool haveWalkingTarget()
const {
return m_walkingTargetValid; }
178 Vec2f getWalkingTarget()
const {
return m_walkingTarget; }
179 float getWalkingTargetTol()
const {
return m_walkingTargetTol; }
180 void setWalkingTarget(
const Vec2f& target,
float tol = -1.0f) { m_walkingTarget = target; m_walkingTargetTol = tol; m_walkingTargetValid =
true; }
181 void setWalkingTargetTol(
float tol) { m_walkingTargetTol = tol; }
182 void invalidateWalkingTarget() { m_walkingTargetValid =
false; RI.MM->WalkingTarget.setColor(1.0, 0.0, 0.0); RI.MM->WalkingTargetTol.setColor(1.0, 0.0, 0.0); }
183 Vec2f m_walkingTarget;
184 float m_walkingTargetTol;
185 bool m_walkingTargetValid;
189 cycle_t m_stateCycle;
Configuration struct for the walk and kick node.
Definition: wak_config.h:20
A walk and kick walk behaviour state that makes the robot walk to a desired target pose on the field...
Definition: walk_beh_walk_to_pose.h:19
A walk and kick behaviour state that kicks the ball towards a target.
Definition: beh_kick_ball.h:20
A walk and kick gaze behaviour state that looks at the ball (and does not move the head from the last...
Definition: gaze_beh_look_at_ball.h:19
A walk and kick gaze behaviour state that looks left and right.
Definition: gaze_beh_look_left_right.h:19
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
A walk and kick behaviour state that lines up the robot with the ball and a target.
Definition: beh_go_behind_ball.h:20
A class that manages and executes the walk and kick behaviour states.
Definition: wak_beh_manager.h:50
A walk and kick behaviour state that simply tells the robot to stop in place.
Definition: beh_stopped.h:19
The main walk and kick behaviour class.
Definition: walk_and_kick.h:34
A walk and kick behaviour state that induces a panic attack and stops the robot still.
Definition: beh_panic_attack.h:19
A walk and kick behaviour state that combines two others (which are assumed to operate independently)...
Definition: wak_beh_state_combined.h:22
A walk and kick behaviour state that stands in for an unknown state or ID.
Definition: beh_unknown_state.h:19
A walk and kick behaviour state that dribbles the ball towards a target.
Definition: beh_dribble_ball.h:20
A walk and kick gaze behaviour state that looks around.
Definition: gaze_beh_look_around.h:19
The base class for all walk and kick behaviour states.
Definition: wak_beh_state.h:27
A walk and kick gaze behaviour state that looks down.
Definition: gaze_beh_look_down.h:19
A walk and kick gaze behaviour state that looks for the ball.
Definition: gaze_beh_look_for_ball.h:20
An interface class for encapsulating all of the data that the walk and kick game states should comman...
Definition: wak_game_vars.h:21
A class that shares the required walk and kick variables amongst the behaviour state classes...
Definition: wak_beh_shared.h:48
A walk and kick behaviour state that searches for the ball.
Definition: beh_search_for_ball.h:21
A walk and kick behaviour state that dives for the ball.
Definition: beh_dive_for_ball.h:20
An interface class between the walk and kick and ROS worlds.
Definition: wak_ros_interface.h:54
A class that implements the worm, for making a live decision between two opposites.
Definition: wak_utils.h:83
An interface class for encapsulating all of the data that the walk and kick behaviour states should c...
Definition: wak_actuator_vars.h:22