Alex exoskeleton
ALEX SoftwareDocumentation
testDrives.cpp
Go to the documentation of this file.
1 
11 #include <iostream>
12 
13 #include "CANopen.h"
14 #include "CopleyDrive.h"
15 #include "Drive.h"
16 
17 pthread_mutex_t CO_CAN_VALID_mtx = PTHREAD_MUTEX_INITIALIZER;
18 volatile uint32_t CO_timer1ms = 0U;
19 
20 /* Helper functions ***********************************************************/
21 void CO_errExit(char *msg) {
22  perror(msg);
23  exit(EXIT_FAILURE);
24 }
25 
26 /* send CANopen generic emergency message */
27 void CO_error(const uint32_t info) {
28  CO_errorReport(CO->em, CO_EM_GENERIC_SOFTWARE_ERROR, CO_EMC_SOFTWARE_INTERNAL, info);
29  fprintf(stderr, "canopend generic error: 0x%X\n", info);
30 }
31 
32 int main() {
33  // Create a Drive Object
34  std::cout << "1. Construct a CopleyDrive Object (which implements Drive Class), with NODE ID = 100 \n";
35  Drive *testDrive = new CopleyDrive(1);
36 
37  std::cout << "2. Try to run the InitPDO() Function \n"
38  << testDrive->initPDOs();
39 }
volatile uint32_t CO_timer1ms
Definition: testDrives.cpp:18
Abstract class describing a Drive used to communicate with a CANbus device. Note that many functions ...
Definition: Drive.h:93
void CO_errExit(char *msg)
Definition: testDrives.cpp:21
int main()
Definition: testDrives.cpp:32
virtual bool initPDOs()
Initialises a standard set of PDOs for the use of the drive. These are:
Definition: Drive.cpp:84
void CO_error(const uint32_t info)
Definition: testDrives.cpp:27
unsigned int uint32_t
Definition: CO_command.h:31
An implementation of the Drive Object, specifically for Copley-branded devices (currently used on the...
Definition: CopleyDrive.h:16
pthread_mutex_t CO_CAN_VALID_mtx
Definition: testDrives.cpp:17