Alex exoskeleton
ALEX SoftwareDocumentation
testSM.cpp
Go to the documentation of this file.
1 
11 #include "CANopen.h"
12 #include "ExoRobot.h"
13 #include "TestMachine.h"
14 //using namespace std;
15 
16 pthread_mutex_t CO_CAN_VALID_mtx = PTHREAD_MUTEX_INITIALIZER;
17 volatile uint32_t CO_timer1ms = 0U;
18 
19 /* Helper functions ***********************************************************/
20 void CO_errExit(char *msg) {
21  perror(msg);
22  exit(EXIT_FAILURE);
23 }
24 
25 /* send CANopen generic emergency message */
26 void CO_error(const uint32_t info) {
27  CO_errorReport(CO->em, CO_EM_GENERIC_SOFTWARE_ERROR, CO_EMC_SOFTWARE_INTERNAL, info);
28  fprintf(stderr, "canopend generic error: 0x%X\n", info);
29 }
30 
31 int main(void) {
32  // Create Exo object + initialise derived Joints + trajectory Generator
33  bool exit = false;
34  cout << ">>> Creating Test state machine" << endl;
35  ExoRobot exo;
36  TestMachine testMachine;
37  printf("app_Program Start \n");
38  testMachine.initRobot(&exo);
39  testMachine.init();
40  testMachine.activate();
41  while (!exo.keyboard.getQ()) {
42  usleep(500000);
43  testMachine.hwStateUpdate();
44  testMachine.update();
45  }
46 
47  // exit(0);
48 }
void CO_errExit(char *msg)
Definition: testSM.cpp:20
Example implementation of the Robot class, representing an X2 Exoskeleton, using DummyActuatedJoint a...
Definition: ExoRobot.h:27
int main(void)
Definition: testSM.cpp:31
ExoTestMachine testMachine
Definition: application.cpp:16
volatile uint32_t CO_timer1ms
Definition: testSM.cpp:17
pthread_mutex_t CO_CAN_VALID_mtx
Testing ExoRobot new classes.
Definition: testSM.cpp:16
void CO_error(const uint32_t info)
Definition: testSM.cpp:26
unsigned int uint32_t
Definition: CO_command.h:31
bool getQ()
Getter method for private Q key state.
Definition: Keyboard.cpp:122
Keyboard keyboard
Definition: ExoRobot.h:48