BaseState.h
Go to the documentation of this file.
1 #ifndef BASESTATE_H
2 #define BASESTATE_H
3 
4 #include <stddef.h>
5 #include <ros/ros.h>
6 #include <ros/console.h>
7 
8 namespace rsm {
9 
10 #define INTERRUPT_END 0
11 #define EMERGENCY_STOP_INTERRUPT 1
12 #define TELEOPERATION_INTERRUPT 2
13 #define SIMPLE_GOAL_INTERRUPT 3
14 #define SIMPLE_GOAL_STOP_INTERRUPT 4
15 
16 #define EXPLORATION 0
17 #define WAYPOINT_FOLLOWING 1
18 #define SIMPLE_GOAL 2
19 
20 class StateInterface;
21 
26 class BaseState {
27 public:
28 
32  BaseState();
33 
37  virtual ~BaseState();
38 
43  void setStateInterface(StateInterface* stateinterface);
44 
50 
54  virtual void onSetup() {
55  }
56  ;
57 
61  virtual void onEntry() {
62  }
63  ;
64 
68  virtual void onActive() = 0;
69 
73  virtual void onExit() {
74  }
75  ;
76 
80  virtual void onExplorationStart(bool &success,
81  std::string &message) {
82  }
83  ;
84 
88  virtual void onExplorationStop(bool &success, std::string &message) {
89  }
90  ;
91 
95  virtual void onWaypointFollowingStart(bool &success, std::string &message) {
96  }
97  ;
98 
102  virtual void onWaypointFollowingStop(bool &success, std::string &message) {
103  }
104  ;
105 
110  virtual void onInterrupt(int interrupt) {
111  }
112  ;
113 
118  std::string getName();
119 
120 protected:
121 
133  std::string _name;
134 };
135 
136 }
137 
138 #endif
StateInterface * getStateInterface()
Definition: BaseState.cpp:18
virtual void onActive()=0
std::string getName()
Definition: BaseState.cpp:22
virtual void onWaypointFollowingStart(bool &success, std::string &message)
Definition: BaseState.h:95
virtual void onWaypointFollowingStop(bool &success, std::string &message)
Definition: BaseState.h:102
bool _interrupt_occured
Shows if an interupt occured.
Definition: BaseState.h:129
virtual void onExit()
Definition: BaseState.h:73
virtual void onExplorationStop(bool &success, std::string &message)
Definition: BaseState.h:88
Definition: BaseState.h:8
std::string _name
Name of the state.
Definition: BaseState.h:133
StateInterface * _stateinterface
Pointer to State Interface handling all state transitions.
Definition: BaseState.h:125
virtual void onEntry()
Definition: BaseState.h:61
virtual void onInterrupt(int interrupt)
Called when an operation mode interrupt was received.
Definition: BaseState.h:110
virtual void onExplorationStart(bool &success, std::string &message)
Definition: BaseState.h:80
Handles the RSM transitions between the different state classes and holds a reference to the current ...
void setStateInterface(StateInterface *stateinterface)
Definition: BaseState.cpp:14
virtual ~BaseState()
Definition: BaseState.cpp:10
virtual void onSetup()
Definition: BaseState.h:54


rsm_core
Author(s): Marco Steinbrink
autogenerated on Tue Mar 16 2021 02:44:31