CORC Project
CANOpen Robot Controller Software Documentation
CopleyDrive.cpp
Go to the documentation of this file.
1 
5 #include "CopleyDrive.h"
6 
7 #include <iostream>
8 
9 #include "DebugMacro.h"
10 
11 CopleyDrive::CopleyDrive(int NodeID) : Drive::Drive(NodeID) {
12  this->NodeID = NodeID;
13 }
15  DEBUG_OUT(" CopleyDrive Deleted ")
16 }
17 
19  return false;
20 }
21 
22 bool CopleyDrive::initPosControl(motorProfile posControlMotorProfile) {
23  DEBUG_OUT("NodeID " << NodeID << " Initialising Position Control")
24 
25  sendSDOMessages(generatePosControlConfigSDO(posControlMotorProfile));
26 
27  // \Todo set additional parameters (bit 5 in 0x6041 makes updates happen immediately)
28  return true;
29 }
30 
31 bool CopleyDrive::initVelControl(motorProfile velControlMotorProfile) {
32  DEBUG_OUT("NodeID " << NodeID << " Initialising Velocity Control")
33  /*\todo create velControlMOTORPROFILE and test on exo*/
34  /*\todo Tune velocity loop gain index 0x2381 to optimize V control */
35  sendSDOMessages(generateVelControlConfigSDO(velControlMotorProfile));
36  return true;
37 }
38 
40  return true;
41 }
42 std::vector<std::string> CopleyDrive::generatePosControlConfigSDO(motorProfile positionProfile) {
43  return Drive::generatePosControlConfigSDO(positionProfile); /*<!execute base class function*/
44 };
45 
46 std::vector<std::string> CopleyDrive::generateVelControlConfigSDO(motorProfile velocityProfile) {
47  return Drive::generateVelControlConfigSDO(velocityProfile); /*<!execute base class function*/
48 };
~CopleyDrive()
Destroy the Copley Drive object.
Definition: CopleyDrive.cpp:14
CopleyDrive(int NodeID)
Construct a new Copley Drive object.
Definition: CopleyDrive.cpp:11
Defines some macros for debugging output.
Abstract class describing a Drive used to communicate with a CANbus device. Note that many functions ...
Definition: Drive.h:105
bool initVelControl(motorProfile velControlMotorProfile)
Definition: CopleyDrive.cpp:31
std::vector< std::string > generatePosControlConfigSDO(motorProfile positionProfile)
Overloaded method from Drive, specifically for Copley Drive implementation. Generates the list of com...
Definition: CopleyDrive.cpp:42
std::vector< std::string > generateVelControlConfigSDO(motorProfile velocityProfile)
Generates the list of commands required to configure Velocity control in CANopen motor drive...
Definition: Drive.cpp:240
int NodeID
The CAN Node ID used to address this particular drive on the CAN bus.
Definition: Drive.h:111
An implementation of the Drive Object, specifically for the Copley Drive.
std::vector< std::string > generateVelControlConfigSDO(motorProfile velocityProfile)
Overloaded method from Drive, specifically for Copley Drive implementation. Generates the list of com...
Definition: CopleyDrive.cpp:46
bool initTorqControl()
Definition: CopleyDrive.cpp:39
struct to hold desired velocity, acceleration and deceleration values for a drives motor controller p...
Definition: Drive.h:94
int sendSDOMessages(std::vector< std::string > messages)
messages Properly formatted SDO Messages
Definition: Drive.cpp:272
#define DEBUG_OUT(x)
Definition: DebugMacro.h:19
bool initPosControl(motorProfile posControlMotorProfile)
Definition: CopleyDrive.cpp:22
std::vector< std::string > generatePosControlConfigSDO(motorProfile positionProfile)
Generates the list of commands required to configure Position control in CANopen motor drive...
Definition: Drive.cpp:209