Alex exoskeleton
ALEX SoftwareDocumentation
All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ExoTestMachine.h
Go to the documentation of this file.
1 
8  * /brief The <code>ExoTestMachine</code> class represents an example implementation of an exoskeleton state machine
9  * with five states. Initialisation, sitting, standing, standing up and sitting down. The test machine
10  * is made as example for developers to structure their specific use cases with.
11  * For more detail on the architecture and mechanics of the state machine class see:https://embeded.readthedocs.io/en/latest/StaeMachines/.
12  *
13  * State transition Diagram.
14  *
15  * startExo startStand
16  * initState +-----> sitting +---------> standingUp
17  * ^ +
18  * EndTraj | | EndTraj
19  * | |
20  * + |
21  * sittingDwn <---------+ standing
22  * startSit
23  *
24  * Version 0.1
25  * Date: 07/04/2020
26  *
27  */
28 #ifndef EXO_SM_H
29 #define EXO_SM_H
30 
31 #include <sys/time.h>
32 
33 #include <array>
34 #include <cmath>
35 #include <fstream>
36 #include <iostream>
37 #include <string>
38 
39 #include "ExoRobot.h"
40 #include "ExoTestState.h"
41 #include "StateMachine.h"
42 
43  // State Classes
44 #include "InitState.h"
45 #include "Sitting.h"
46 #include "SittingDwn.h"
47 #include "Standing.h"
48 #include "StandingUp.h"
49 
54 class ExoTestMachine : public StateMachine {
55  public:
56  bool running = false;
57  ExoTestMachine();
58  void init();
59  void activate();
60  void deactivate();
61 
62  void hwStateUpdate();
63  State *gettCurState();
64  void initRobot(ExoRobot *rb);
65  bool trajComplete;
66  DummyTrajectoryGenerator *trajectoryGenerator;
67 
68  // Pointers to the relevant states - initialised in init
69  InitState *initState;
70  SittingDwn *sittingDwn;
71  StandingUp *standingUp;
72  Sitting *sitting;
73  Standing *standing;
74 
75  protected:
76  // Pointer to the Robot
77  ExoRobot *robot;
78 
79  private:
80  // Event Objects defined using Macro defined in StateMachine.h
81  // Defines the Class itself, as well as initialises an object of that class
82  // An events check function are defined in the .cpp file.
83  EventObject(EndTraj) * endTraj;
84  EventObject(IsAPressed) * isAPressed;
85  EventObject(StartButtonsPressed) * startButtonsPressed;
86  EventObject(StartExo) * startExo;
87  EventObject(StartSit) * startSit;
88  EventObject(StartStand) * startStand;
89  };
90 
91 #endif /*EXO_SM_H*/
*brief The< code > ExoTestMachine</code > class represents an example implementation of an exoskeleton state machine *with five states sitting
Definition: ExoTestMachine.h:8
*brief The< code > ExoTestMachine</code > class represents an example implementation of an exoskeleton state machine *with five states Initialisation
Definition: ExoTestMachine.h:8
Abstract class representing a state in a StateMachine.
Definition: State.h:30
*brief The< code > ExoTestMachine</code > class represents an example implementation of an exoskeleton state machine *with five states standing
Definition: ExoTestMachine.h:8