6 #ifndef STANDING_DEMO_FSM_H
7 #define STANDING_DEMO_FSM_H
11 #include <limb_control/PlayCommandsSrv.h>
15 namespace standing_demo
18 using namespace statecontroller;
28 class WaitForStandingState;
29 class WaitForTimeState;
30 class WaitForMotionPlayerState;
31 class PlanDemoActionState;
39 WAIT_FOR_MOTION_PLAYER,
40 WAIT_FOR_LIMB_CONTROL,
43 START_MOTION_PLAYBACK,
54 StandingDemoSC(StandingDemo* SD);
57 StandingDemo*
const m_SD;
60 virtual bool preStepCallback();
61 virtual void preActivateCallback(
bool willCallActivate);
62 virtual void preExecuteCallback();
65 inline const ros::Time& now()
const {
return m_curStepTime; }
69 void enableHeadIdle();
70 void disableHeadIdle();
73 void handleLegDangle();
74 void handleHeadIdle();
77 bool m_headIdleEnabled;
80 ros::Time m_curStepTime;
84 class InitDemoState :
public GenState<StandingDemoSC>
88 InitDemoState(StandingDemoSC *sc) :
GenState(sc, INIT_DEMO,
"INIT_DEMO") {}
96 class WaitForStandingState :
public GenState<StandingDemoSC>
100 WaitForStandingState(StandingDemoSC *sc) :
GenState(sc, WAIT_FOR_STANDING,
"WAIT_FOR_STANDING") {}
108 class WaitForTimeState :
public GenState<StandingDemoSC>
112 static const ros::Time NullROSTime;
115 WaitForTimeState(StandingDemoSC* sc,
double waitTime, ros::Time endTime = NullROSTime) :
GenState(sc, WAIT_FOR_TIME,
"WAIT_FOR_TIME"), m_waitTime(waitTime), m_endTime(endTime) {}
119 virtual void activate(
cycle_t cyc);
128 class WaitForMotionPlayerState :
public GenState<StandingDemoSC>
132 WaitForMotionPlayerState(StandingDemoSC *sc) :
GenState(sc, WAIT_FOR_MOTION_PLAYER,
"WAIT_FOR_MOTION_PLAYER") {}
140 class WaitForLimbControlState :
public GenState<StandingDemoSC>
144 WaitForLimbControlState(StandingDemoSC *sc) :
GenState(sc, WAIT_FOR_LIMB_CONTROL,
"WAIT_FOR_LIMB_CONTROL") {}
151 const limb_control::PlayCommandsRequest PCmdReqNull;
155 class PlanDemoActionState :
public GenState<StandingDemoSC>
159 PlanDemoActionState(StandingDemoSC* sc) :
GenState(sc, PLAN_DEMO_ACTION,
"PLAN_DEMO_ACTION") {}
167 class ReturnToStandingState :
public GenState<StandingDemoSC>
171 ReturnToStandingState(StandingDemoSC* sc) :
GenState(sc, RETURN_TO_STANDING,
"RETURN_TO_STANDING") {}
175 virtual void activate(
cycle_t cyc);
179 limb_control::PlayCommandsRequest PCmdReq;
183 class StartMotionPlaybackState :
public GenState<StandingDemoSC>
187 StartMotionPlaybackState(StandingDemoSC *sc,
int motion) :
GenState(sc, START_MOTION_PLAYBACK,
"START_MOTION_PLAYBACK"), m_motion(motion) {}
191 virtual void activate(
cycle_t cyc);
199 class StopMotionPlaybackState :
public GenState<StandingDemoSC>
203 StopMotionPlaybackState(StandingDemoSC *sc) :
GenState(sc, STOP_MOTION_PLAYBACK,
"STOP_MOTION_PLAYBACK") {}
211 class StartHeadIdlingState :
public GenState<StandingDemoSC>
215 StartHeadIdlingState(StandingDemoSC *sc) :
GenState(sc, START_HEAD_IDLING,
"START_HEAD_IDLING") {}
219 virtual void activate(
cycle_t cyc);
224 class StopHeadIdlingState :
public GenState<StandingDemoSC>
228 StopHeadIdlingState(StandingDemoSC *sc) :
GenState(sc, STOP_HEAD_IDLING,
"STOP_HEAD_IDLING") {}
232 virtual void activate(
cycle_t cyc);
Implements the State Controller Library.
Base class for all state controllers.
Definition: state_controller.h:593
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