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