CORC Project
CANOpen Robot Controller Software Documentation
ExoTestMachine.cpp
Go to the documentation of this file.
1 
2 #include "ExoTestMachine.h"
3 
4 #define OWNER ((ExoTestMachine *)owner)
5 
7  trajectoryGenerator = new DummyTrajectoryGenerator(6); /*<! \todo Pilot Parameters would be set in constructor here*/
9 
10  // Create PRE-DESIGNED State Machine events and state objects.
11  isAPressed = new IsAPressed(this);
12  endTraj = new EndTraj(this);
13  startButtonsPressed = new StartButtonsPressed(this);
14  startExo = new StartExo(this);
15  startSit = new StartSit(this);
16  startStand = new StartStand(this);
22 
29  NewTransition(initState, startExo, sitting);
30  NewTransition(sitting, startStand, standingUp);
32  NewTransition(standing, startSit, sittingDwn);
33  NewTransition(sittingDwn, endTraj, sitting);
34  //Initialize the state machine with first state of the designed state machine, using baseclass function.
36 }
43  DEBUG_OUT("ExoTestMachine::init()")
44  robot->initialise();
45  running = true;
46 }
47 
49 // Events ------------------------------------------------------------
51 
55 bool ExoTestMachine::EndTraj::check() {
56  return OWNER->trajectoryGenerator->isTrajectoryFinished();
57 }
58 bool ExoTestMachine::IsAPressed::check(void) {
59  if (OWNER->robot->keyboard.getA() == true) {
60  return true;
61  }
62  return false;
63 }
64 bool ExoTestMachine::StartButtonsPressed::check(void) {
65  if (OWNER->robot->keyboard.getW() == true) {
66  return true;
67  }
68  return false;
69 }
70 bool ExoTestMachine::StartExo::check(void) {
71  if (OWNER->robot->keyboard.getS() == true) {
72  std::cout << "LEAVING INIT and entering Sitting" << endl;
73  return true;
74  }
75  return false;
76 }
77 bool ExoTestMachine::StartStand::check(void) {
78  if (OWNER->robot->keyboard.getW() == true) {
79  return true;
80  }
81  return false;
82 }
83 
84 bool ExoTestMachine::StartSit::check(void) {
85  if (OWNER->robot->keyboard.getW()) {
86  return true;
87  }
88  return false;
89 }
96  robot->updateRobot();
97 }
Example implementation of the Robot class, representing an X2 Exoskeleton, using DummyActuatedJoint a...
Definition: ExoRobot.h:36
State for the ExoTestMachine (implementing ExoTestState) - representing when the exo is standing up (...
Definition: StandingUp.h:21
Example Implementation of TrajectoryGenerator. Includes only two trajectories (Sit-to-Stand and Stand...
ExoRobot * robot
InitState * initState
void init()
start function for running any designed statemachine specific functions for example initialising robo...
State for the ExoTestMachine (implementing ExoTestState) - representing when the exoskeleton is sitti...
Definition: Sitting.h:23
void hwStateUpdate()
Statemachine to hardware interface method. Run any hardware update methods that need to run every pro...
Initialisation State for the ExoTestMachine (implementing ExoTestState)
Definition: InitState.h:23
SittingDwn * sittingDwn
StandingUp * standingUp
Sitting * sitting
#define OWNER
DummyTrajectoryGenerator * trajectoryGenerator
Standing * standing
#define DEBUG_OUT(x)
Definition: DebugMacro.h:19
State for the ExoTestMachine (implementing ExoTestState) - representing when the exoskeleton is stand...
Definition: Standing.h:21
#define NewTransition(_from_, _event_, _to_)
Macro to create statemachine transitions. Add a tranition object to the from states arch list to a sp...
Definition: StateMachine.h:89
State for the ExoTestMachine (implementing ExoTestState) - representing when the exo is sitting down ...
Definition: SittingDwn.h:20
void updateRobot()
update current state of the robot, including input and output devices. Overloaded Method from the Rob...
Definition: ExoRobot.cpp:115
void initialize(State *i)
Sets the current state. Note: No check made.
bool initialise()
Initialize memory for the designed Robot classes specific Joint objects + sensors (if available) usin...
Definition: Robot.cpp:24