Skip to content

Commit b429ac5

Browse files
committed
M1DemoMachine works! Set STATE_MACHINE_NAME to M1DemoMachine andset NO_ROBOT to OFF.
1 parent f522be0 commit b429ac5

5 files changed

Lines changed: 81 additions & 158 deletions

File tree

src/apps/M1DemoMachine/M1DemoMachine.cpp

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,13 @@ M1DemoMachine::M1DemoMachine() {
1010
idleState = new IdleState(this, robot);
1111
calibrationState = new Calibration( this, robot);
1212
monitorState = new Monitoring(this, robot);
13-
positionTracking = new M1PositionTracking(this, robot);
1413
demoState = new M1DemoState(this, robot);
1514

1615
// Create PRE-DESIGNED State Machine events objects.
1716
event2Demo = new Event2Demo(this);
1817
event2Monitor = new Event2Monitor(this);
1918
event2Cali = new Event2Cali(this);
2019
event2Idle = new Event2Idle(this);
21-
event2Pos = new Event2Pos(this);
2220

2321
/**
2422
* \brief add a tranisition object to the arch list of the first state in the NewTransition MACRO.
@@ -32,8 +30,8 @@ M1DemoMachine::M1DemoMachine() {
3230
NewTransition(idleState, event2Cali, calibrationState);
3331
NewTransition(calibrationState, event2Idle, idleState);
3432

35-
NewTransition(idleState, event2Pos, positionTracking);
36-
NewTransition(positionTracking, event2Idle, idleState);
33+
NewTransition(idleState, event2Demo, demoState);
34+
NewTransition(demoState, event2Idle, idleState);
3735

3836
//Initialize the state machine with first state of the designed state machine, using baseclass function.
3937
StateMachine::initialize(idleState);
@@ -43,7 +41,6 @@ M1DemoMachine::~M1DemoMachine() {
4341
delete demoState;
4442
delete idleState;
4543
delete monitorState;
46-
delete positionTracking;
4744
delete calibrationState;
4845
delete robot;
4946
}
@@ -115,8 +112,8 @@ void M1DemoMachine::hwStateUpdate(void) {
115112
// Events ------------------------------------------------------
116113
///////////////////////////////////////////////////////////////
117114
bool M1DemoMachine::Event2Demo::check(void) {
118-
if (OWNER->robot->keyboard->getS() == true) {
119-
std::cout << "Pressed S!" << std::endl;
115+
if (OWNER->robot->keyboard->getA() == true) {
116+
std::cout << "Pressed A!" << std::endl;
120117
return true;
121118
}
122119
return false;
@@ -144,17 +141,6 @@ bool M1DemoMachine::Event2Idle::check(void) {
144141
return false;
145142
}
146143

147-
////////////////////////////////////////////////////////////////
148-
// Events ------------------------------------------------------
149-
///////////////////////////////////////////////////////////////
150-
bool M1DemoMachine::Event2Pos::check(void) {
151-
if (OWNER->robot->keyboard->getA() == true) {
152-
// std::cout << "Pressed A!" << std::endl;
153-
return true;
154-
}
155-
return false;
156-
}
157-
158144
////////////////////////////////////////////////////////////////
159145
// Events ------------------------------------------------------
160146
///////////////////////////////////////////////////////////////

src/apps/M1DemoMachine/M1DemoMachine.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ class M1DemoMachine : public StateMachine {
5757

5858
Monitoring *monitorState;
5959
Calibration *calibrationState;
60-
M1PositionTracking *positionTracking;
6160

6261
// for logger
6362
std::chrono::steady_clock::time_point time0; // initial time that machine started
@@ -70,7 +69,6 @@ class M1DemoMachine : public StateMachine {
7069
EventObject(Event2Demo) * event2Demo;
7170
EventObject(Event2Monitor) * event2Monitor;
7271
EventObject(Event2Idle) * event2Idle;
73-
EventObject(Event2Pos) * event2Pos;
7472
EventObject(Event2Cali) * event2Cali;
7573

7674
LogHelper logHelper_;

0 commit comments

Comments
 (0)