5 #ifndef TEST_STATE_CONTROLLER_H
6 #define TEST_STATE_CONTROLLER_H
16 #include <gtest/gtest.h>
17 #include <test_utilities/test_utilities.h>
21 namespace statecontrollertest
24 using namespace testutilities;
25 using namespace statecontroller;
39 class LookForBallState;
40 class WalkToBallState;
41 class LineUpGoalState;
54 , g_state_num_deact(0)
55 , g_test_sc_callbacks(false)
56 , g_tested_term(false)
61 for(
int i = 0; i < 6; i++) { g_scc[i] = 0; }
62 for(
int i = 0; i < 3; i++) { g_sc[i][0] = 0; g_sc[i][1] = 0; g_sc[i][2] = 0; }
66 virtual bool preStepCallback();
67 virtual void preActivateCallback(
bool willCallActivate);
68 virtual void preExecuteCallback();
69 virtual bool postExecuteCallback();
70 virtual void onTerminateCallback();
71 virtual void postStepCallback();
75 int g_state_num_deact;
80 bool g_test_sc_callbacks;
92 class LookForBallState :
public State
96 LookForBallState(DemoSC *sc) :
State(LOOK_FOR_BALL,
"LOOK_FOR_BALL", sc->name), sc(sc) {}
105 void deactivate(
cycle_t cyc,
bool wasExecuted);
113 class WalkToBallState :
public GenState<DemoSC>
128 WalkToBallState(DemoSC *sc,
const StateParams& sp) :
GenState(sc, WALK_TO_BALL,
"WALK_TO_BALL"), sp(sp) {}
134 void deactivate(
cycle_t cyc,
bool wasExecuted);
142 class LineUpGoalState :
public GenState<DemoSC>
146 LineUpGoalState(DemoSC *sc) :
GenState(sc, LINE_UP_GOAL,
"LINE_UP_GOAL") {}
152 void deactivate(
cycle_t cyc,
bool wasExecuted);
157 class KickBallState :
public GenState<DemoSC>
161 KickBallState(DemoSC *sc,
int kick_type) :
GenState(sc, KICK_BALL,
"KICK_BALL"), sp_kick_type(kick_type) {}
164 void testProtected();
169 void deactivate(
cycle_t cyc,
bool wasExecuted);
177 class TestState :
public GenState<DemoSC>
181 TestState(DemoSC* sc) :
GenState(sc, TEST_STATE,
"TEST_STATE") { DISPLAY(std::cout <<
"TestState: In constructor" << std::endl); }
182 virtual ~TestState() { DISPLAY(std::cout <<
"TestState: In destructor" << std::endl); }
188 void deactivate(
cycle_t cyc,
bool wasExecuted);
Implements the State Controller Library.
Base class for all state controllers.
Definition: state_controller.h:593
Implements a state that a state controller can be in.
Definition: state_controller.h:432
unsigned int cycle_t
Used to count the number of executed state controller cycles.
Definition: state_controller.h:415
bool action_t
Used to represent the state transition actions (HOLD_THIS_STATE and PROCEED_NEXT_STATE) ...
Definition: state_controller.h:416
Specialises the State class using templates to take care of the most common overloads.
Definition: state_controller.h:397