18 #include <boost/msm/front/state_machine_def.hpp>
21 #include <boost/msm/front/functor_row.hpp>
30 #include <glog/logging.h>
38 namespace msmf = boost::msm::front;
39 namespace be = uav_basic_events;
61 :
public msmf::state_machine_def<UAVStateMachineFrontEnd>,
70 template <
class Event,
class FSM>
void on_entry(Event
const &, FSM &) {
71 VLOG(1) <<
"entering: UAV system";
79 template <
class Event,
class FSM>
void on_exit(Event
const &, FSM &) {
80 VLOG(1) <<
"leaving: UAV system";
100 : boost::mpl::vector<
103 msmf::Row<usa::Landed, be::Takeoff, usa::TakingOff,
104 usa::TakeoffAction, usa::TakeoffGuard>,
105 msmf::Row<usa::Landed, ManualControlEvent, usa::ManualControlState,
106 msmf::none, msmf::none>,
108 msmf::Row<usa::TakingOff, Completed, usa::Hovering, msmf::none,
111 msmf::Row<usa::Hovering, PositionYaw, usa::ReachingGoal,
112 usa::ReachingGoalSet, usa::ReachingGoalGuard>,
113 msmf::Row<usa::Hovering, be::Land, usa::Landing, usa::LandingAction,
115 msmf::Row<usa::Hovering, ManualControlEvent,
116 usa::ManualControlState, msmf::none, msmf::none>,
118 msmf::Row<usa::ReachingGoal, be::Abort, usa::Hovering,
119 usa::UAVControllerAbort, msmf::none>,
120 msmf::Row<usa::ReachingGoal, be::Land, usa::Landing,
121 usa::ReachingGoalLand, msmf::none>,
123 msmf::Row<usa::Landing, Completed, usa::Landed, msmf::none,
125 msmf::Row<usa::ReachingGoal, Completed, usa::Hovering,
126 usa::UAVControllerAbort, msmf::none>,
128 msmf::Row<usa::ManualControlState, be::Takeoff, usa::Hovering,
129 usa::ManualControlSwitchAction,
130 usa::ManualControlSwitchGuard>,
131 msmf::Row<usa::ManualControlState, be::Land, usa::Landed,
132 usa::ManualControlSwitchAction,
133 usa::ManualControlSwitchGuard>
145 static constexpr std::array<const char *, 6> state_names = {
146 "Landed",
"TakingOff",
"Hovering",
147 "ReachingGoal",
"Landing",
"ManualControlState"};
156 return state_names.at(p.current_state()[0]);
ManualControlState_< LogicStateMachineT > ManualControlState
Manual control state.
Definition: uav_states_actions.h:39
Base state for all states in logic state machine.
Definition: base_state.h:24
Thread safe state machine class that extends boost::msm::back::state_machine class.
Definition: thread_safe_state_machine.h:28
Owns, initializes, and facilitates communication between different hardware/software components...
Definition: uav_system.h:21
front-end: define the FSM structure
Definition: uav_state_machine.h:60
UAVStateMachineFrontEnd(UAVSystem &uav_system)
Constructor with arguments to store robot system.
Definition: uav_state_machine.h:89
Transition table for State Machine.
Definition: uav_state_machine.h:99
void on_exit(Event const &, FSM &)
Action to take on leaving state machine.
Definition: uav_state_machine.h:79
Class to provide typedefs for all basic uav states and actions.
Definition: uav_states_actions.h:14
const char * pstate(UAVStateMachine const &p)
Get current state name.
Definition: uav_state_machine.h:155
void on_entry(Event const &, FSM &)
Action to take on entering state machine.
Definition: uav_state_machine.h:70
Base state machine.
Definition: base_state_machine.h:18