C++ IndyDCP client
C++ IndyDCP client is a C++ class for users to interface with Indy based on IndyDCP Protocol. Users can use every function by including single header file, IndyDCPConnector.h.
Installation
Please download the source file and project file of C++ IndyDCP client in the same version as Indy SW in Download Page.
C++ IndyDCP client is tested and verified in both Windows and Linux. If you want to use IndyDCP client in Windows environment, you can open Visual Studio project in below path.
- /IndyDCPClientWindows/IndyDCPClientWindows.sln
Notes
1 2 |
|
Initializing and terminating socket
Before using C++ IndyDCP client, the socket library should be Initialized. Socket initialization and termination is done in different ways in Windows and Linux.
1 2 3 4 5 6 7 8 9 10 11 12 |
|
1 2 3 4 5 6 7 |
|
Connecting to and disconnecting from your Indy
All communication with Indy can be done using IndyDCPConnector class, defined in IndyDCPConnector.h. To initialize IndyDCPConnector, the IP address and name of the robot is required. All available robot names are defined in the namespace, NRMKIndy::Service::DCP.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
C++ IndyDCP Command List
The following shows examples of C++ IndyDCP commands. Commands not included in the example can be found in the whole command list. For more information about how to use it, please refer to the downloaded C ++ IndyDCP code.
Note
1 |
|
Function | Description |
---|---|
stopEmergency() | Emergency stop |
resetRobot() | Reset robot |
setServoOnOff(const char * const servoVec) setServoOnOff(const bool * const servoVec) setServoOnOff(std::initializer_list |
Servo on/off depending on servoVec |
setBrakeOnOff(const char * const brakeVec) setBrakeOnOff(const bool * const brakeVec) setBrakeOnOff(std::initializer_list |
Brake on/off depending on brakeVec |
stopMotion() | Stop robot motion |
executeMoveCommand(const std::string & cmdName) | Execute Move Command, which has name cmdName, teached by Conty |
moveJointHome() | Move Indy to the home position |
moveJointZero() | Move Indy to the zero position |
moveJointTo(const double * const qvec) moveJointTo(std::initializer_list |
Move every joints of Indy to the values in qvec |
moveJointBy(const double * const qvec) moveJointBy(std::initializer_list |
Move every joints of Indy by the values in qvec, relatively from current angles |
moveTaskTo(const double * const pvec) moveTaskTo(std::initializer_list |
Move end-effector of Indy to the 6 DoF position described by pvec |
moveTaskBy(const double * const pvec) moveTaskBy(std::initializer_list |
Move end-effector of Indy by the 6 DoF transformation described by pvec, relatively from current position |
startCurrProgram() | Execute the loaded robot program |
pauseProgram() | Pause robot program in currently running state |
resumeProgram() | Resume the paused robot program |
stopProgram() | Stop the robot program |
startRegisteredDefaultProgram() | Execute the registered default robot program |
registerDefaultProgram(int idx) | Register default robot program by an index 1 to 10 |
getRegisteredDefaultProgram(int &ret) | Request the registered default robot program's index |
isRobotRunning(bool& ret) | Check if robot software is runnig |
isRobotReady(bool& ret) | Check if robot is ready to move |
isEmergencyStopped(bool& ret) | Check if robot is stopped by emergency |
isCollided(bool& ret) | Check if robot is stopped by collision |
isErrorState(bool& ret) | Check if robot is in error state |
isBusy(bool& ret) | Check if robot is in motion |
isMoveFinished(bool& ret) | Check if robot is not moving |
isHome(bool& ret) | Check if robot is at the home position |
isZero(bool& ret) | Check if robot is at the zero position |
isInResetting(bool& ret) | Check if robot is restting |
isDirectTeachingMode(bool& ret) | Check if robot is direct teaching mode |
isTeachingMode(bool& ret) | Check if robot is teaching mode (direct teaching or jogging) |
isProgramRunning(bool& ret) | Check if robot is runnig a program |
isProgramPaused(bool& ret) | Check if robot program is paused |
isContyConnected(bool& ret) | Check if Conty is connected to the robot |
changeToDirectTeachingMode() | Start the direct teaching mode |
finishDirectTeachingMode() | Terminate the direct teaching mode |
addJointWaypointSet(const double * const qvec) addJointWaypointSet(std::initializer_list |
Add a joint waypoint |
removeJointWaypointSet() | Remove the last joint waypoint |
clearJointWaypointSet() | Clear all joint waypoints |
executeJointWaypointSet() | Start moving along the saved joint waypoints |
addTaskWaypointSet(const double * const pvec) addTaskWaypointSet(std::initializer_list |
Add an end-effector waypoint |
removeTaskWaypointSet() | Remove the last end-effector waypoint |
clearTaskWaypointSet() | Clear all end-effector waypoints |
executeTaskWaypointSet() | Start moving along the saved end-effector waypoints |
setDefaultTCP(const double * const tcpVec) setDefaultTCP(std::initializer_list |
Set default TCP value as tcpVec |
resetDefaultTCP() | Reset the default TCP value |
setTCPCompensation(const double * const tcpVec) setTCPCompensation(std::initializer_list |
Set TCP compensation value as tcpVec |
resetTCPCompensation() | Reset the TCP compensation value |
setReferenceFrame(const double * const refFrameVec) setReferenceFrame(std::initializer_list |
Set the Reference frame value as refFrameVec |
resetReferenceFrame() | Reset the Reference frame value |
setJointBoundaryLevel(int level) | Set the limit level of velocity/acceleration of JointMove (1-9) |
setTaskBoundaryLevel(int level) | Set the limit level of velocity/acceleration of TaskMove (1-9) |
setJointBlendingRadius(double radius) | Set blend radius of JointMove as radius |
setTaskBlendingRadius(double radius) | Set blend radius of TaskMove as radius |
setJointWaypointTime(double time) | Set travel time between waypoints of JointMove as time |
setTaskWaypointTime(double time) | Set travel time between waypoints of TaskMove as time |
setTaskBaseMode(int mode) | Set the base frame mode of TaskMove (0 = Reference frame, 1 = TCP frame) |
getDefaultTCP(double * const ret) | Request for default TCP value |
getTCPCompensation(double * const ret) | Request for TCP compensation value |
getReferenceFrame(double * const ret) | Request for Reference Frame value |
getCollisionDetectionLevel(int &ret) | Request for collision detection sensitivity level value |
getJointBoundaryLevel(int &ret) | Request for the limit level of velocity/acceleration of JointMove |
getTaskBoundaryLevel(int &ret) | Request for the limit level of velocity/acceleration of TaskMove |
getJointBlendingRadius(double &ret) | Request for the blend radius of JointMove |
getTaskBlendingRadius(double &ret) | Request for the blend radius of TaskMove |
getJointWaypointTime(double &ret) | Request for the travel time between waypoints of JointMove |
getTaskWaypointTime(double &ret) | Request for the travel time between waypoints of TaskMove |
getTaskBaseMode(int &ret) | Request for based frame mode of TaskMove |
getRobotRunningTime(double &ret) | Request for total runtime after robot initialization |
getControlMode(int &ret) | Request for current robot control mode |
getJointServoState(char * const ret) getJointServoState(char * const retServo, char * const retBrake) getJointServoState(bool * const retServo, bool * const retBrake) |
Request for status of servo and brake |
getJointPosition(double * const ret) | Request for current joint angles |
getJointVelocity(double * const ret) | Request for current joint angular velocity |
getTaskPosition(double * const ret) | Request for current task position |
getTaskVelocity(double * const ret) | Request for current task velocity |
getTorque(double * const ret) | Request for current robot torques |
getLastEmergencyInfo(int & retCode, int * const retIntArgs, double * const retDoubleArgs) | Request the latest emergency status information of the robot |
getSmartDigitalInput(int idx, char & ret) | Request value of idx-th DI channel. The result is stored in the reference variable ret |
getSmartDigitalInputs(char * const & ret) | Request all DIs' values. The each DI value is stored in each bit of ret |
setSmartDigitalOutput(int idx, char val) | Assign val value to the idx-th DO channel value |
setSmartDigitalOutputs(const char * const val) | Assign values to all DO channels. The value of each channel is assigned to each bit value of val |
getSmartDigitalOutput(int idx, char & ret) | Request value of idx-th DO channel. The result is stored in the reference variable ret |
getSmartDigitalOutputs(char * const & ret) | Request all DOs' values. The each DO value is stored in each bit of ret |
getSmartAnalogInput(int idx, int & ret) | Request idx-th AI channel values. The result is stored in ret (range 0-10000) |
setSmartAnalogOutput(int idx, int val) | Assign val value to idx-th AO channel value (range 0-10000) |
getSmartAnalogOutput(int idx, int & ret) | Request idx-th AI channel values. The result is stored in ret (range 0-10000) |
setEndtoolDigitalOutput(int endtoolType, char val) | Assign val value to the end-tool's DO with a type of endtoolType (endtoolType: 0 = NPN, 1 = PNP, 2 = Not use, 3 = eModi) |
getEndtoolDigitalOutput(int endtoolType, char & ret) | Request value of end-tool's DO with a type of endtoolType. The result is stored in the reference variable ret (endtoolType: 0 = NPN, 1 = PNP, 2 = Not use, 3 = eModi) |
getRobotCanFTSensorRaw(int * const ret) | Request for the raw data of FT sensor connected to robot end-tool CAN port |
getRobotCanFTSensorTransformed(double * const ret) | Request for transformed data value of FT sensor connected to robot end-tool CAN port |
getCBCanFTSensorRaw(int * const ret) | Request for raw data value of FT sensor connected to CAN port of control box |
getCBCanFTSensorTransformed(double * const ret) | Request for transformed data value of FT sensor connected to CAN port of control box |
readDirectVariable(int type, int addr, void * ret) | Read single value of direct variable with type type and addr address |
readDirectVariables(int type, int addr, int len, void * ret) | Read success value of len length of direct variable with type type and addr address |
writeDirectVariable(int type, int addr, void * ptrVal) | Write a single ptrVal value to a direct variable with type type and addr address |
writeDirectVariables(int type, int addr, int len, void * ptrVal) | Write consecutive ptrVal values len length to a direct variable with type type and addr address |
Units
- 6 DoF position is composed of 3 doubles for tranlations (x, y, z) and 3 doubles for orientation (θx, θy, θz). The rotation is applied in the order of z-y-x.
- The translations are in meters and orientations are in degrees.
- All joint angles are represented in degrees.
Simple motion & DIO example
In this section, an example code for simple robot motion and DIO control will be introduced. In this example, we assume the robot is Indy7 and the robot's IP address is 192.168.0.100.
Warning
1 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
|