ASCO Aerial Autonomy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
sample_logic_state_machine.h
Go to the documentation of this file.
1 #pragma once
7 #include <type_traits>
8 
12 struct EmptyRobotSystem {};
13 
20 template <class RobotSystemT>
21 class SampleLogicStateMachine_ : public BaseStateMachine<RobotSystemT> {
25  std::type_index type_index_event_ = typeid(NULL);
29  PositionYaw pose_event_;
30 
31 public:
37  SampleLogicStateMachine_(RobotSystemT &robot_system)
38  : BaseStateMachine<RobotSystemT>(robot_system) {}
39 
46  template <class Event> void process_event(const Event &event) {
47  type_index_event_ = typeid(event);
48  }
49 
55  void process_event(const PositionYaw &event) {
56  type_index_event_ = typeid(event);
57  pose_event_ = event;
58  }
64  std::type_index getProcessEventTypeId() { return type_index_event_; }
70  PositionYaw getPoseEvent() { return pose_event_; }
71 };
72 
SampleLogicStateMachine_(RobotSystemT &robot_system)
Constructor that takes robot system.
Definition: sample_logic_state_machine.h:37
void process_event(const PositionYaw &event)
process pose event message
Definition: sample_logic_state_machine.h:55
std::type_index getProcessEventTypeId()
retrieve the event type_index of last processed event
Definition: sample_logic_state_machine.h:64
Robot system that does not perform any actions.
Definition: sample_logic_state_machine.h:12
Stores Position, yaw. PositionYaw is used as the goal for UAV systems.
Definition: position_yaw.h:10
PositionYaw getPoseEvent()
retrieve poseyaw event message
Definition: sample_logic_state_machine.h:70
void process_event(const Event &event)
Generic process event that stores the event type.
Definition: sample_logic_state_machine.h:46
Base state machine.
Definition: base_state_machine.h:18
Example Logic state machine that stores triggered event.
Definition: sample_logic_state_machine.h:21