/* * packagetypes.h * * Created on: Jan 14, 2019 * Author: emanuele * * Strutture e definizioni dei pacchetti utilizzati dal protocollo Client Interface di UR * */ #include #include #include using namespace boost::endian; #define HEADERSIZE 4 //#define EUROMAP #define JOINT_NUMBER 6 // PACKET TYPES #define VERSION_MESSAGE 20 #define ROBOT_MESSAGE 16 // SUBPACKET TYPES #define ROBOT_MODE_DATA 0 #define JOINT_DATA 1 #define TOOL_DATA 2 #define MASTER_BOARD_DATA 3 #define CARTESIAN_INFO 4 #define KINEMATICS_INFO 5 #define CONFIGURATION_DATA 6 #define FORCE_MODE_DATA 7 #define ADDITIONAL_INFO 8 #define CALIBRATION_DATA 9 #define SAFETY_DATA 10 #define TOOL_COM_INFO 11 #define TOOL_MODE_INFO 12 enum { ROBOT_MODE_NO_CONTROLLER = -1, ROBOT_MODE_DISCONNECTED, ROBOT_MODE_CONFIRM_SAFETY, ROBOT_MODE_BOOTING, ROBOT_MODE_POWER_OFF, ROBOT_MODE_POWER_ON, ROBOT_MODE_IDLE, ROBOT_MODE_BACKDRIVE, ROBOT_MODE_RUNNING, ROBOT_MODE_UPDATING_FIRMWARE, } robotModes; enum { CONTROL_MODE_POSITION = 0, CONTROL_MODE_TEACH, CONTROL_MODE_FORCE, CONTROL_MODE_TORQUE, } controlModes; enum { JOINT_MODE_RESET =235, JOINT_MODE_SHUTTING_DOWN, JOINT_PART_D_CALIBRATION_MODE, JOINT_MODE_BACKDRIVE, JOINT_MODE_POWER_OFF, JOINT_MODE_READY_FOR_POWER_OFF, JOINT_MODE_NOT_RESPONDING, JOINT_MODE_MOTOR_INITIALISATION, JOINT_MODE_BOOTING, JOINT_PART_D_CALIBRATION_ERROR_MODE, JOINT_MODE_BOOTLOADER, JOINT_CALIBRATION_MODE, JOINT_MODE_VIOLATION, JOINT_MODE_FAULT, JOINT_MODE_RUNNING, JOINT_MODE_IDLE } jointModes; enum { SAFETY_MODE_NORMAL = 1, SAFETY_MODE_REDUCED, SAFETY_MODE_PROTECTIVE_STOP, SAFETY_MODE_RECOVERY, SAFETY_MODE_SAFEGUARD_STOP, SAFETY_MODE_SYSTEM_EMERGENCY_STOP, SAFETY_MODE_ROBOT_EMERGENCY_STOP, SAFETY_MODE_VIOLATION, SAFETY_MODE_FAULT, SAFETY_MODE_VALIDATE_JOINT_ID, SAFETY_MODE_UNDEFINED_SAFETY_MODE } safetyModes; typedef struct { int32_t packageSize; unsigned char packageType; uint64_t timestamp; char source; char robotMessageType; char projectNameSize; std::string *projectName=NULL; unsigned char majorVersion; unsigned char minorVersion; unsigned char bugFixVersion; unsigned char buildNumber; std::string *buildDate=NULL; } versionMessage_t; typedef struct { int32_t packageSize; unsigned char packageType; int64_t timestamp; unsigned char isRealRobotConnected; unsigned char isRealRobotEnabled; unsigned char isRobotPowerOn; unsigned char isEmergencyStopped; unsigned char isProtectiveStopped; unsigned char isProgramRunning; unsigned char isProgramPaused; unsigned char robotMode; unsigned char controlMode; double targetSpeedFraction; double speedScaling; double targetSpeedFractionLimit; unsigned char internalValue; } robotModeData_t; typedef struct { int32_t packageSize; unsigned char packageType; struct { double actual; double target; double speedActual; float current; float voltage; float motorTemp; float nc; unsigned char mode; } jointParam [JOINT_NUMBER]; } jointData_t; typedef struct { int32_t packageSize; unsigned char packageType; union { struct{ double X; double Y; double Z; double RX; double RY; double RZ; }; double pos [6]; } cartPosition; union { struct{ double ofstX; double ofstY; double ofstZ; double ofstRX; double ofstRY; double ofstRZ; }; double ofst [6]; } cartTCPoffset; } cartesianInfo_t; typedef struct { int32_t packageSize; unsigned char packageType; uint32_t digitalInputBits; uint32_t digitalOutputBits; unsigned char analogInputRange0; unsigned char analogInputRange1; double analogInput0; double analogInput1; char analogOutputDomain0; char analogOutputDomain1; double analogOutput0; double analogOutput1; float masterBoardTemperature; float robotVoltage48V; float robotCurrent; float masterIOCurrent; unsigned char safetyMode; unsigned char InReducedMode; char euromap67InterfaceInstalled; #ifdef EUROMAP uint32_t euromapInputBits; uint32_t euromapOutputBits; float euromapVoltage24V; float euromapCurrent; #endif uint32_t nc; unsigned char operationalModeSelectorInput; unsigned char threePositionEnblingDeviceInput; } masterBoardData_t; typedef struct { int32_t packageSize; unsigned char packageType; unsigned char analogInputRange0; unsigned char analogInputRange1; double analogInput0; double analogInput1; float toolVoltage48V; unsigned char toolOutputVoltage; float toolCurrent; float toolTemperature; unsigned char toolMode; } toolData_t; typedef struct { double DHa [JOINT_NUMBER]; double DHd [JOINT_NUMBER]; double DHalpha [JOINT_NUMBER]; double DHtheta [JOINT_NUMBER]; } kineDH_t; typedef struct { int32_t packageSize; unsigned char packageType; uint32_t checksum [JOINT_NUMBER]; kineDH_t kinematics; unsigned char calibration_status; } kinematicsInfo_t; typedef struct { int32_t packageSize; unsigned char packageType; struct { double min; double max; } jointPositionLimits [JOINT_NUMBER]; struct { double min; double max; } jointSpeedLimits [JOINT_NUMBER]; double vJointDefault; double aJointDefault; double vToolDefault; double aToolDefault; double eqRadius; kineDH_t kinematics; int32_t masterboardVersion; int32_t controllerBoxType; int32_t robotType; int32_t robotSubType; } configurationData_t; typedef struct { int32_t packageSize; unsigned char packageType; union { struct{ double FX; double FY; double FZ; double FRX; double FRY; double FRZ; }; double force[6]; } forcePosition; double robotDexterity; } forceModeData_t; typedef struct { int32_t packageSize; unsigned char packageType; unsigned char feedriveButtonPressed; unsigned char feedriveButtonEnabled; unsigned char ioEnableFeedrive; unsigned char foo; } additionalInfo_t; typedef struct { int32_t packageSize; unsigned char packageType; union { struct{ double FX; double FY; double FZ; double FRX; double FRY; double FRZ; }; double force[6]; } fcalData; } calibrationData_t; typedef struct { int32_t packageSize; unsigned char packageType; unsigned char communicationIsEnabled; int32_t baudRate; int32_t parity; int32_t stopBits; float rxIdleChars; float txIdleChars; } toolCommunicationInfo_t; typedef struct { int32_t packageSize; unsigned char packageType; unsigned char outputMode; unsigned char digitalModeOut0; unsigned char digitalModeOut1; } toolModeInfo_t; typedef struct { versionMessage_t versonMessage; configurationData_t configuration; calibrationData_t calibrationData; robotModeData_t robotMode; forceModeData_t forceMode; kinematicsInfo_t kineInfo; jointData_t jointData; cartesianInfo_t cartesianInfo; additionalInfo_t additionalInfo; toolData_t toolData; toolModeInfo_t toolMode; toolCommunicationInfo_t toolCom; masterBoardData_t masterBoard; time_t lastUpdate; } clientData_t; typedef struct { union{ struct { double X,Y,Z,RX,RY,RZ; }; double p[JOINT_NUMBER]; }; } pose_t; typedef struct { union{ struct { double J1,J2,J3,J4,J5,J6; }; double p[JOINT_NUMBER]; }; } jointPose_t;