ASCO Aerial Autonomy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
base_state_machine.h
Go to the documentation of this file.
1 #pragma once
2 
3 // Logging library
4 #include <glog/logging.h>
5 
6 // Store state machine states
7 #include <array>
8 
9 // Type index
10 #include <typeindex>
11 
12 // Robot system container
14 
18 template <class RobotSystemT> class BaseStateMachine {
19 
20 protected:
24  std::type_index no_transition_event_index_ = typeid(NULL);
25 
26 public:
41 
46  std::type_index get_no_transition_event_index() const {
48  }
49 
56  BaseStateMachine(RobotSystemT &robot_system)
57  : robot_system_container_(robot_system) {}
58 
68  template <class FSM, class Event>
69  void no_transition(Event const &e, FSM &, int state_index) {
70  no_transition_event_index_ = typeid(e);
71  LOG(WARNING) << "Event " << no_transition_event_index_.name()
72  << " triggered no transition";
73  }
74 };
BaseStateMachine(RobotSystemT &robot_system)
Constructor with arguments to store robot system.
Definition: base_state_machine.h:56
std::type_index no_transition_event_index_
type index to store the event that did not trigger any transition
Definition: base_state_machine.h:24
void no_transition(Event const &e, FSM &, int state_index)
Print event typeid if no action present for the corresponding event.
Definition: base_state_machine.h:69
std::type_index get_no_transition_event_index() const
Returns the index of the event that did not trigger any transition.
Definition: base_state_machine.h:46
Container class that stores robot system and provides it to only selected friend classes.
Definition: robot_system_container.h:9
RobotSystemContainer< RobotSystemT > robot_system_container_
robot system container used by states to get sensor data and send commands Use the operator function ...
Definition: base_state_machine.h:40
Base state machine.
Definition: base_state_machine.h:18