Spaceshot Flight Software
The Illinois Space Society's Homemade Rocket Firmware
rocketFSM.h
1 
2 #ifndef ROCKET_FSM_H
3 #define ROCKET_FSM_H
4 
5 // #include "sensors.h"
6 #include <ChRt.h>
7 #include <stdint.h>
8 
9 // forward declare pointers
10 struct pointers;
11 
12 class RocketFSM {
13  public:
17  enum class FSM_State {
18  STATE_INIT,
19  STATE_IDLE,
20  STATE_LAUNCH_DETECT,
21  STATE_BOOST,
22  STATE_BURNOUT_DETECT,
23  STATE_COAST_PREGNC,
24  STATE_COAST_GNC,
25  STATE_APOGEE_DETECT,
26  STATE_APOGEE,
27  STATE_DROGUE_DETECT,
28  STATE_DROGUE,
29  STATE_MAIN_DETECT,
30  STATE_MAIN,
31  STATE_LANDED_DETECT,
32  STATE_LANDED,
33  STATE_ABORT
34  };
35 
36  virtual void tickFSM() = 0;
37 
38  FSM_State getFSMState() const { return rocket_state_; }
39 
40  protected:
41  FSM_State rocket_state_ = FSM_State::STATE_INIT;
42 };
43 
50 template <size_t count>
52  RocketFSM::FSM_State rocketStates[count];
53  systime_t timeStamp_RS = 0;
54 
55  rocketStateData() : rocketStates() {
56  for (size_t i = 0; i < count; i++) {
57  rocketStates[i] = RocketFSM::FSM_State::STATE_INIT;
58  }
59  }
60 };
61 
62 #endif
Definition: rocketFSM.h:12
FSM_State
Labels for each FSM state. Contains intermediary states (eg: Launch Detect) along with actual states ...
Definition: rocketFSM.h:17
Definition: dataLog.h:208
Structure for all values related to rocket state.
Definition: rocketFSM.h:51