6 #include <aerial_autonomy/uav_basic_events.h>
9 #include <boost/msm/front/functor_row.hpp>
10 #include <boost/msm/front/state_machine_def.hpp>
12 #include <parsernode/common.h>
17 namespace be = uav_basic_events;
24 template <
class LogicStateMachineT>
28 VLOG(1) <<
"Enabling SDK";
39 template <
class LogicStateMachineT>
43 parsernode::common::quaddata data = robot_system.
getUAVData();
44 if (data.batterypercent <
46 LOG(WARNING) <<
"Battery too low! " << data.batterypercent;
49 return data.rc_sdk_control_switch;
58 template <
class LogicStateMachineT>
68 bool run(
UAVSystem &robot_system, LogicStateMachineT &logic_state_machine) {
69 parsernode::common::quaddata data = robot_system.
getUAVData();
71 if (data.rc_sdk_control_switch) {
73 VLOG(1) <<
"Switching to Landed mode";
74 logic_state_machine.process_event(be::Land());
76 VLOG(1) <<
"Switching to Hovering mode";
77 logic_state_machine.process_event(be::Takeoff());
90 template <
class LogicStateMachineT>
Guard to avoid switching to SDK mode unless hardware allows it.
Definition: manual_control_functors.h:40
Base state for all states in logic state machine.
Definition: base_state.h:24
void run(UAVSystem &robot_system)
Override this run function for different sub classes. This function performs the logic checking for e...
Definition: manual_control_functors.h:27
Internal action that returns whether it processed an event.
Definition: base_functors.h:208
Action functor that does not require the event triggering it.
Definition: base_functors.h:113
Owns, initializes, and facilitates communication between different hardware/software components...
Definition: uav_system.h:21
bool run(UAVSystem &robot_system, LogicStateMachineT &logic_state_machine)
Check if hardware is allowing to switch to sdk mode and trigger appropriate events.
Definition: manual_control_functors.h:68
void enableAutonomousMode()
Public API call to enable Quadcopter SDK. This call is only necessary if Quad goes into manual mode d...
Definition: uav_system.h:125
parsernode::common::quaddata getUAVData() const
Get sensor data from UAV.
Definition: uav_system.h:109
bool guard(UAVSystem &robot_system)
Override this run function for different sub classes. This function performs the logic checking for e...
Definition: manual_control_functors.h:42
Check if hardware is allowing to switch sdk mode.
Definition: manual_control_functors.h:59
Guard functor that does not require the event triggering it.
Definition: base_functors.h:157
UAVSystemConfig getConfiguration()
Get system configuration.
Definition: uav_system.h:192
Basic events such as takeoff land etc.
Definition: manual_control_functors.h:25